Published source
Download source ZIP
CH-J Server Manager
Browse directories and files for a specific application release.
Source is provided under the CH-J Proprietary Software License 1.14. Its availability does not change the license terms or grant additional rights.
1
"use strict";3
const { contextBridge, ipcRenderer } = require("electron");5
function subscribe(channel, callback) {6
if (typeof callback !== "function") return () => {};7
const listener = (_event, payload) => callback(payload);8
ipcRenderer.on(channel, listener);9
return () => ipcRenderer.removeListener(channel, listener);10
}12
async function biometricRequest(channel) {13
const result = await ipcRenderer.invoke(channel);14
if (!result.ok) throw Object.assign(new Error(result.error.message), { code: result.error.code });15
return result.value;16
}18
contextBridge.exposeInMainWorld("chjCore", Object.freeze({19
platform: process.platform,20
diagnostics: Object.freeze({21
resolve: (options) => ipcRenderer.invoke("diagnostics:resolve", options),22
start: (options) => ipcRenderer.invoke("diagnostics:start", options),23
cancel: (id, tool) => ipcRenderer.invoke("diagnostics:cancel", { id, tool }),24
get: (id) => ipcRenderer.invoke("diagnostics:get", { id }),25
history: () => ipcRenderer.invoke("diagnostics:history"),26
removeHistory: (id) => ipcRenderer.invoke("diagnostics:removeHistory", { id }),27
export: (id, format) => ipcRenderer.invoke("diagnostics:export", { id, format }),28
copy: (id, format = "txt") => ipcRenderer.invoke("diagnostics:copy", { id, format }),29
import: () => ipcRenderer.invoke("diagnostics:import"),30
onProgress: (callback) => subscribe("diagnostics:progress", callback)31
}),32
getInfo: () => ipcRenderer.invoke("core:getInfo"),33
openLegalDocument: (document) => ipcRenderer.invoke("legal:open", { document }),34
getConfig: () => ipcRenderer.invoke("config:get"),35
updateConfig: (payload) => ipcRenderer.invoke("config:update", payload),36
listPlugins: () => ipcRenderer.invoke("plugins:list"),37
getPluginState: () => ipcRenderer.invoke("plugins:getState"),38
checkPluginCatalog: () => ipcRenderer.invoke("plugins:checkCatalog"),39
installPlugin: (releaseId) => ipcRenderer.invoke("plugins:install", { releaseId }),40
uninstallPlugin: (pluginId) => ipcRenderer.invoke("plugins:uninstall", { pluginId }),41
openPlugin: (pluginId) => ipcRenderer.invoke("plugins:open", { pluginId }),42
onPluginWindowState: (callback) => subscribe("core:pluginWindowState", callback),43
getVaultStatus: () => ipcRenderer.invoke("vault:status"),44
createVault: (password) => ipcRenderer.invoke("vault:create", { password }),45
unlockVault: (password) => ipcRenderer.invoke("vault:unlock", { password }),46
lockVault: () => ipcRenderer.invoke("vault:lock"),47
resetVault: (confirmation) => ipcRenderer.invoke("vault:reset", { confirmation }),48
getBiometricStatus: () => biometricRequest("biometrics:status"),49
enableBiometrics: () => biometricRequest("biometrics:enable"),50
disableBiometrics: () => biometricRequest("biometrics:disable"),51
unlockVaultWithBiometrics: () => biometricRequest("biometrics:unlock"),52
authenticateSensitiveAction: () => biometricRequest("biometrics:authenticate"),53
onVaultLocked: (callback) => subscribe("vault:locked", callback),54
listProfiles: () => ipcRenderer.invoke("profiles:list"),55
saveProfile: (payload) => ipcRenderer.invoke("profiles:save", payload),56
deleteProfile: (id) => ipcRenderer.invoke("profiles:delete", { id }),57
selectPrivateKey: () => ipcRenderer.invoke("profiles:selectPrivateKey"),58
listSshSessions: () => ipcRenderer.invoke("ssh:list"),59
connectSsh: (payload) => ipcRenderer.invoke("ssh:connect", payload),60
trustSshHostKey: (payload) => ipcRenderer.invoke("ssh:trustHostKey", payload),61
disconnectSsh: (sessionId) => ipcRenderer.invoke("ssh:disconnect", { sessionId }),62
sendTerminalInput: (sessionId, data) => ipcRenderer.send("ssh:input", { sessionId, data }),63
resizeTerminal: (sessionId, cols, rows) => ipcRenderer.invoke("ssh:resize", { sessionId, cols, rows }),64
getUpdateState: () => ipcRenderer.invoke("updates:getState"),65
checkForUpdates: () => ipcRenderer.invoke("updates:check"),66
selectUpdateRelease: (id) => ipcRenderer.invoke("updates:select", { id }),67
downloadUpdate: () => ipcRenderer.invoke("updates:download"),68
installUpdate: () => ipcRenderer.invoke("updates:install"),69
revealUpdate: () => ipcRenderer.invoke("updates:reveal"),70
onUpdateState: (callback) => subscribe("core:updateState", callback),71
onSshData: (callback) => subscribe("ssh:data", callback),72
onSshState: (callback) => subscribe("ssh:state", callback),73
onSshError: (callback) => subscribe("ssh:error", callback)74
}));SHA-256: c9f698d964a2a58cceb1bd4cbe04f67763bf241057e88d8ccab7b77a4cd2486a
Archive SHA-256: 5ac91caf4fa32a6fdb114f2430deed486fbe7489d5eea343d1f034169fafb5e0