CH-J Server ManagerSSH를 통한 서버 관리
메뉴
공개된 소스

CH-J Server Manager

특정 애플리케이션 릴리스의 디렉터리와 파일을 살펴보세요.

소스 ZIP 다운로드
CH-J / Server Manager 368 개 파일
core-20261017T201717Z-057348c4a70f 추가됨: 날짜 기록 없음 · 빌드됨:
nativeRunner.js 추가됨: 날짜 기록 없음 2.6 KB · 43 줄
코드 파일 다운로드
1"use strict";
2const { spawn } = require("node:child_process");
3function biometricError(code, message = code) { return Object.assign(new Error(message), { code }); }
4class NativeRunner {
5 constructor({ executable, args = [], timeoutMs = 65000, spawnImpl = spawn } = {}) { Object.assign(this, { executable, args, timeoutMs, spawnImpl }); }
6 run(request, { signal } = {}) {
7 if (signal?.aborted) return Promise.reject(biometricError("BIOMETRIC_CANCELLED"));
8 return new Promise((resolve, reject) => {
9 let child, output = Buffer.alloc(0), settled = false, timer;
10 const finish = (error, result) => {
11 if (settled) { if (result?.key) result.key = null; return; }
12 settled = true; clearTimeout(timer); signal?.removeEventListener("abort", abort);
13 output.fill(0); output = Buffer.alloc(0);
14 if (error) { try { child?.kill(); } catch {} reject(error); } else resolve(result);
15 };
16 const abort = () => finish(biometricError("BIOMETRIC_CANCELLED"));
17 try { child = this.spawnImpl(this.executable, this.args, { shell: false, windowsHide: true, stdio: ["pipe", "pipe", "pipe"] }); }
18 catch { finish(biometricError("BIOMETRIC_UNAVAILABLE")); return; }
19 signal?.addEventListener("abort", abort, { once: true });
20 timer = setTimeout(() => finish(biometricError("BIOMETRIC_TIMEOUT")), request.op === "status" ? Math.min(8000, this.timeoutMs) : this.timeoutMs);
21 child.on("error", () => finish(biometricError("BIOMETRIC_UNAVAILABLE")));
22 child.stdin.on("error", () => finish(biometricError("BIOMETRIC_UNAVAILABLE")));
23 // Never forward helper stderr, stdin or raw responses to logs or the renderer.
24 child.stderr.on("data", () => {});
25 child.stdout.on("data", chunk => {
26 if (settled) return;
27 if (output.length + chunk.length > 16384) { finish(biometricError("BIOMETRIC_FAILED")); return; }
28 const previous = output; output = Buffer.concat([output, chunk]); previous.fill(0);
29 });
30 child.once("close", code => {
31 if (settled) return;
32 try {
33 const value = JSON.parse(output.toString("utf8"));
34 if (code !== 0 || value.ok !== true) throw biometricError(/^BIOMETRIC_[A-Z_]+$/.test(value.code) ? value.code : "BIOMETRIC_FAILED");
35 finish(null, value);
36 } catch (error) { finish(error.code?.startsWith("BIOMETRIC_") ? error : biometricError("BIOMETRIC_FAILED")); }
37 });
38 const input = Buffer.from(JSON.stringify(request) + "\n");
39 child.stdin.end(input, () => input.fill(0));
40 });
41 }
43module.exports = { NativeRunner, biometricError };
SHA-2569be476532a518be0a6b27290ecf0a15ead61e35b3ffa4040731fd168f2ca325d

CH-J Proprietary Software License 1.14 · 소스는 CH-J Proprietary Software License 1.14에 따라 제공됩니다. 소스를 공개한다고 해서 라이선스 조항이 바뀌거나 추가 권리가 부여되지는 않습니다.

압축 파일 SHA-256cf4455b698f0f28e456a37b1834976a0194d8486acb7101052d59a838745cca3
파일