Publicerad källa
Ladda ner källa ZIP
CH-J Server Manager
Bläddra i kataloger och filer för en specifik programutgåva.
CH-J / Server Manager
339 filer
core-20261014T184258Z-3fbed0b93fdf
Tillagd: Datum inte noterat · Byggd:
1
"use strict";2
const fs = require("node:fs");3
const path = require("node:path");4
const crypto = require("node:crypto");5
const { DiagnosticError } = require("./common");6
function runtimePaths({ resourcesPath = process.resourcesPath && fs.existsSync(path.join(process.resourcesPath, "app.asar")) ? process.resourcesPath : null, platform = process.platform, arch = process.arch } = {}) {7
const root = resourcesPath ? path.join(resourcesPath, "native-runtime", `${platform}-${arch}`) : path.resolve(__dirname, "../../../build/native-runtime", `${platform}-${arch}`);8
return { root, executable: path.join(root, platform === "win32" ? "curl.exe" : "curl"), caPath: path.join(root, "ca-bundle.pem"), platform, arch };9
}10
function validateRuntime(options) {11
const runtime = runtimePaths(options);12
try {13
const manifest = JSON.parse(fs.readFileSync(path.join(runtime.root, "manifest.json"), "utf8"));14
if (manifest.platform !== runtime.platform || manifest.arch !== runtime.arch) throw new Error("architecture");15
const executableName = path.basename(runtime.executable);16
for (const name of [executableName, "ca-bundle.pem"]) {17
const content = fs.readFileSync(path.join(runtime.root, name));18
if (!/^[a-f0-9]{64}$/.test(manifest.files?.[name]) || crypto.createHash("sha256").update(content).digest("hex") !== manifest.files[name]) throw new Error("checksum");19
}20
if (runtime.platform !== "win32") fs.accessSync(runtime.executable, fs.constants.X_OK);21
return { ...runtime, manifest };22
} catch (error) { throw new DiagnosticError(error.code === "ENOENT" ? "HTTP_RUNTIME_MISSING" : "HTTP_RUNTIME_INVALID"); }23
}24
function runtimeEnvironment() {25
// Explicit allowlist: no curl config, proxy, trust override, TLS key logging,26
// injected dynamic libraries or inherited credentials in this subprocess.27
const result = { LANG: "C", LC_ALL: "C" };28
for (const name of ["SystemRoot", "SYSTEMROOT", "WINDIR", "TEMP", "TMP", "TMPDIR"]) if (process.env[name]) result[name] = process.env[name];29
return result;30
}31
module.exports = { runtimePaths, validateRuntime, runtimeEnvironment };SHA-256
19246642e8b0964b0769044aef2b96b3d88c1a38d792bc54277c262349961b8eCH-J Proprietary Software License 1.14 · Källan finns under CH-J Proprietary Software License 1.14. Dess tillgänglighet ändrar inte licensvillkoren eller ger ytterligare rättigheter.
Arkiv SHA-256
3df08cf5e899262a6ce92d7ec2caf5c42b683f1f2b57055662b845ff7dde67a8