CH-J Server Manager
Durchsuchen Sie Verzeichnisse und Dateien einer bestimmten Anwendungsausgabe.
Die Quellen werden unter der CH-J Proprietary Software License 1.14 bereitgestellt. Ihre Verfügbarkeit ändert die Lizenzbedingungen nicht und gewährt keine zusätzlichen Rechte.
"use strict";// Exercises the actual production bootstrap in an isolated profile.const { app, BrowserWindow } = require("electron");const assert = require("node:assert/strict");const fs = require("node:fs"), os = require("node:os"), path = require("node:path");const { LicenseAcceptance } = require("../src/main/legal/licenseAcceptance");const root = fs.mkdtempSync(path.join(os.tmpdir(), "chj-license-ui-"));// Electron launched with a script otherwise treats scripts/ as the app root.app.setAppPath(path.join(__dirname, ".."));app.getVersion = () => require("../package.json").version;process.env.CHJ_BUILD_SMOKE_USER_DATA_DIR = root;const mode = process.env.CHJ_LICENSE_SMOKE_CASE || "accept";const acceptance = new LicenseAcceptance({ storageRoot: root, licensePath: path.join(__dirname, "..", "LICENSE"), appVersion: require("../package.json").version, buildId: require("../src/shared/buildInfo.json").buildId });if (mode === "update") { const previous = new LicenseAcceptance({ storageRoot: root, licensePath: path.join(__dirname, "..", "LICENSE"), appVersion: require("../package.json").version, buildId: "core-previous-release-same-version" }); previous.accept({ accepted: true, sha256: previous.identity.sha256, guidanceShown: true, guidanceSha256: previous.identity.guidanceSha256 });}let sawLicense = false, checked = false, sawMain = false, failure = null;let createdWindows = 0;const wait = ms => new Promise(resolve => setTimeout(resolve, ms));app.on("browser-window-created", (_event, window) => { if (++createdWindows > 1) sawMain = true; window.webContents.once("did-finish-load", () => { void inspect(window).catch(error => { failure = error; console.error(error); app.exit(1); }); });});async function inspect(window) { if (!window.webContents.getURL().endsWith("/license.html")) { sawMain = true; return; } sawLicense = true; for (let n = 0; n < 100; n++) { if (await window.webContents.executeJavaScript('document.getElementById("licenseText").textContent.length > 10000')) break; await wait(30); } assert.equal(await window.webContents.executeJavaScript('document.getElementById("licenseText").textContent'), acceptance.text); assert.equal(await window.webContents.executeJavaScript('document.getElementById("licenseText").hidden'), true); assert.equal(await window.webContents.executeJavaScript('document.getElementById("guidanceText").hidden'), false); assert.equal(await window.webContents.executeJavaScript('document.getElementById("accept").disabled'), true); assert.equal(await window.webContents.executeJavaScript('document.getElementById("consent").checked'), false); assert.equal(await window.webContents.executeJavaScript('typeof window.require'), "undefined"); assert.equal(await window.webContents.executeJavaScript('typeof window.chj'), "undefined"); const preferences = window.webContents.getLastWebPreferences(); assert.equal(preferences.sandbox, true); assert.equal(preferences.contextIsolation, true); assert.equal(preferences.nodeIntegration, false); app.emit("activate"); assert.equal(BrowserWindow.getAllWindows().length, 1); const beforeGuidance = { accepted: true, sha256: acceptance.identity.sha256, guidanceSha256: acceptance.identity.guidanceSha256 }; assert.equal(await window.webContents.executeJavaScript(`window.licenseApi.accept(${JSON.stringify(beforeGuidance)}).then(() => false, () => true)`), true); for (const [language, label] of [["cs", "Přijmout a pokračovat"], ["de", "Akzeptieren und fortfahren"], ["en", "Accept and continue"]]) { await window.webContents.executeJavaScript(`document.getElementById("language").value = '${language}'; document.getElementById("language").dispatchEvent(new Event("change"));`); assert.equal(await window.webContents.executeJavaScript('document.getElementById("accept").textContent'), label); assert.equal(await window.webContents.executeJavaScript('document.getElementById("guidanceText").textContent'), acceptance.guidance[language]); } assert.equal(await window.webContents.executeJavaScript('window.licenseApi.accept({accepted:false}).then(() => false, () => true)'), true); assert.equal(acceptance.isAccepted(), false); checked = true; const artifacts = process.env.CHJ_LICENSE_SMOKE_ARTIFACT_DIR; if (artifacts) { fs.mkdirSync(artifacts, { recursive: true }); fs.writeFileSync(path.join(artifacts, "license.png"), (await window.webContents.capturePage()).toPNG()); } if (mode === "close") window.close(); else if (mode === "decline") await window.webContents.executeJavaScript('document.getElementById("decline").click()'); else { await window.webContents.executeJavaScript('document.getElementById("continue").click()'); for (let n = 0; n < 100; n++) { if (await window.webContents.executeJavaScript('!document.getElementById("licenseText").hidden')) break; await wait(30); } assert.equal(await window.webContents.executeJavaScript('document.getElementById("guidanceText").hidden'), true); assert.equal(await window.webContents.executeJavaScript('document.getElementById("consentRow").hidden'), false); await window.webContents.executeJavaScript('document.getElementById("consent").click(); document.getElementById("accept").click()'); }}app.on("will-quit", () => { try { assert.equal(failure, null); assert.equal(sawLicense, true); assert.equal(checked, true); const shouldAccept = !["close", "decline"].includes(mode); assert.equal(sawMain, shouldAccept); assert.equal(acceptance.isAccepted(), shouldAccept); console.log(`CHJ_LICENSE_UI_OK: ${mode}, guidance before license, full CS/DE/EN text, actual bootstrap, explicit consent, sandbox, activate guard`); } catch (error) { console.error(error); app.exit(1); } fs.rmSync(root, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });});setTimeout(() => { console.error("License UI smoke timed out"); app.exit(1); }, 20000).unref();require("../src/main/index");SHA-256: 434365b12c7954070e866f1098af867d307c7b3df6fb6e13b8aa8e1289126261
SHA-256 des Archivs: 5ac91caf4fa32a6fdb114f2430deed486fbe7489d5eea343d1f034169fafb5e0