CH-J Server Managerserver management over SSH
Menu
Published source

CH-J Server Manager

Browse directories and files for a specific application release.

Download source ZIP
CH-J Proprietary Software License 1.14

Source is provided under the CH-J Proprietary Software License 1.14. Its availability does not change the license terms or grant additional rights.

2,4 KB · 23 linesDownload file
1"use strict";
2const fs = require("node:fs");
3const path = require("node:path");
4const { execFileSync } = require("node:child_process");
5const appRoot = path.resolve(__dirname, ".."), out = path.join(appRoot, "build", "biometrics"), source = path.join(appRoot, "src/main/security/biometrics/native");
6fs.mkdirSync(out, { recursive: true });
7if (process.platform === "darwin") {
8 const compiler = fs.existsSync("/Library/Developer/CommandLineTools/usr/bin/swiftc") ? "/Library/Developer/CommandLineTools/usr/bin/swiftc" : "/usr/bin/swiftc";
9 const sdk = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk";
10 const target = `${process.arch === "arm64" ? "arm64" : "x86_64"}-apple-macos12.0`;
11 execFileSync(compiler, [...(fs.existsSync(sdk) ? ["-sdk", sdk] : []), "-target", target, "-O", "-framework", "Security", "-framework", "LocalAuthentication", path.join(source, "mac.swift"), "-o", path.join(out, "chj-biometric")], { stdio: "inherit" });
12} else if (process.platform === "win32") {
13 const vswhere = path.join(process.env["ProgramFiles(x86)"] || "C:\\Program Files (x86)", "Microsoft Visual Studio", "Installer", "vswhere.exe");
14 const installation = execFileSync(vswhere, ["-latest", "-products", "*", "-requires", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", "-property", "installationPath"], { encoding: "utf8" }).trim();
15 if (!installation) throw new Error("Biometric helper requires Visual Studio C++ Build Tools and Windows SDK with C++/WinRT.");
16 const batch = path.join(out, "compile.cmd");
17 fs.writeFileSync(batch, `@echo off\r\ncall "${installation}\\VC\\Auxiliary\\Build\\vcvars64.bat" >nul\r\nif errorlevel 1 exit /b 1\r\ncd /d "${out}"\r\ncl.exe /nologo /std:c++17 /EHsc /O2 /DUNICODE /D_UNICODE "${path.join(source, "windows.cpp")}" /Fe:"${path.join(out, "chj-biometric.exe")}" /link windowsapp.lib crypt32.lib advapi32.lib user32.lib\r\nexit /b %errorlevel%\r\n`);
18 try { execFileSync(process.env.ComSpec || "cmd.exe", ["/d", "/c", batch], { stdio: "inherit" }); } finally { fs.unlinkSync(batch); }
19 for (const name of ["windows.obj", "chj-biometric.pdb"]) { try { fs.unlinkSync(path.join(out, name)); } catch {} }
20} else if (process.platform === "linux") {
21 fs.copyFileSync(path.join(source, "linux.py"), path.join(out, "linux.py"));
22} else throw new Error("Biometric helpers are not supported on this platform.");
23console.log(`Biometric helper prepared for ${process.platform}/${process.arch}.`);

SHA-256: bc10244b1013f9043b7a499a2c31581b0ef1a51505fb5a64adffa206f416ddbb

Archive SHA-256: 5ac91caf4fa32a6fdb114f2430deed486fbe7489d5eea343d1f034169fafb5e0