CH-J Server ManagerPalvelimen hallinta yli SSH
Valikko
Julkaistu lähde

CH-J Server Manager

Selaile hakemistoja ja tiedostoja tietyn sovelluksen julkaisua varten.

Lataa lähde ZIP
CH-J / Server Manager 193 tiedostot
core-20261011T184039Z-4148710795d0 Lisätty: Kirjaamaton päivä · Rakennettu:
Tiedostot
httpRuntime.js Lisätty: Kirjaamaton päivä 2,1 KB · 31 rivit
Lataa tiedosto
1"use strict";
2const fs = require("node:fs");
3const path = require("node:path");
4const crypto = require("node:crypto");
5const { DiagnosticError } = require("./common");
6function 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}
10function 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"); }
24function 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;
31module.exports = { runtimePaths, validateRuntime, runtimeEnvironment };
SHA-25619246642e8b0964b0769044aef2b96b3d88c1a38d792bc54277c262349961b8e

CH-J Proprietary Software License 1.14 · Lähde ilmoitetaan CH-J Proprietary Software License 1.14-koodilla. Sen saatavuus ei muuta lisenssiehtoja eikä myönnä lisäoikeuksia.

Arkisto SHA-2565a8ea02d06a5643cf2330fe9f54b8767a06c1c59d36527705e536fa9dbca7614