CH-J Server ManagerZarządzanie serwerem przez SSH
Menu
Opublikowane źródło

CH-J Server Manager

Przeglądaj katalogi i pliki dla konkretnego wydania aplikacji.

Pobierz źródło ZIP
CH-J / Server Manager 339 pliki
core-20261014T184258Z-3fbed0b93fdf Dodano: Data niezanotowana · Built:
Pliki
httpRuntime.js Dodano: Data niezanotowana 2,1 KB · 31 linie
Pobierz plik PDF
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 · Źródło jest dostarczane pod CH-J Proprietary Software License 1.14. Jego dostępność nie zmienia warunków licencji ani nie przyznaje dodatkowych praw.

SHA-2563df08cf5e899262a6ce92d7ec2caf5c42b683f1f2b57055662b845ff7dde67a8