منبع منتشرشده
دانلود ZIP منبع
CH-J Server Manager
پوشهها و فایلهای یک نسخهٔ مشخص از برنامه را مرور کنید.
CH-J / Server Manager
368 فایل
core-20261017T201717Z-057348c4a70f
افزودهشده: تاریخ ثبت نشده است · ساختهشده:
1
"use strict";3
const { contextBridge, ipcRenderer } = require("electron");5
// Core provides the same chrome to bundled and already installed plugins.6
// Shadow DOM keeps plugin styles out of the title bar; the plugin remains sandboxed.7
window.addEventListener("DOMContentLoaded", () => {8
const styleUrl = new URL("/__chj_core__/window-chrome.css", window.location.href).href;9
const host = document.createElement("chj-plugin-chrome");10
host.id = "chj-plugin-window-chrome";11
const shadow = host.attachShadow({ mode: "open" });12
let loadedStyles = 0;13
const stylesheet = () => {14
const link = document.createElement("link");15
link.rel = "stylesheet";16
link.href = styleUrl;17
link.addEventListener("load", () => {18
if (++loadedStyles === 2) host.dataset.ready = "true";19
});20
return link;21
};22
document.head.append(stylesheet());23
const header = document.createElement("header");24
header.id = "chj-chrome-header";25
if (process.platform === "win32" || process.platform === "linux") header.className = "native-controls";26
const mark = document.createElement("span");27
mark.id = "chj-chrome-mark";28
mark.textContent = "CH-J";29
const title = document.createElement("span");30
title.id = "chj-chrome-title";31
title.textContent = document.title || "CH-J Server Manager";32
const collapse = document.createElement("button");33
collapse.type = "button";34
collapse.id = "chj-chrome-collapse";35
const copy = {36
cs: ["Sbalit", "Sbalit do spodní lišty aplikace"],37
de: ["Einklappen", "In die untere Leiste der Anwendung einklappen"],38
en: ["Collapse", "Collapse into the application's bottom bar"]39
};40
const translate = (language) => {41
const [label, description] = copy[language] || copy.en;42
collapse.textContent = label;43
collapse.title = description;44
collapse.setAttribute("aria-label", description);45
};46
translate("en");47
collapse.addEventListener("click", () => {48
void ipcRenderer.invoke("plugin:window:minimize").catch((error) => console.error("Plugin collapse failed.", error));49
});50
ipcRenderer.on("plugin:ui:languageChanged", (_event, language) => translate(language));51
void ipcRenderer.invoke("plugin:ui:getLanguage").then(translate).catch(() => {});52
void ipcRenderer.invoke("plugin:getInfo").then((manifest) => { title.textContent = manifest.name; }).catch(() => {});53
header.append(mark, title, collapse);54
shadow.append(stylesheet(), header);55
document.body.prepend(host);56
});58
contextBridge.exposeInMainWorld("chjPlugin", Object.freeze({59
getInfo: () => ipcRenderer.invoke("plugin:getInfo"),60
ui: Object.freeze({61
getLanguage: () => ipcRenderer.invoke("plugin:ui:getLanguage"),62
onLanguageChanged: (callback) => {63
if (typeof callback !== "function") throw new TypeError("Language callback must be a function.");64
const listener = (_event, language) => callback(language);65
ipcRenderer.on("plugin:ui:languageChanged", listener);66
return () => ipcRenderer.removeListener("plugin:ui:languageChanged", listener);67
}68
}),69
close: () => ipcRenderer.invoke("plugin:close"),70
sessions: Object.freeze({71
list: () => ipcRenderer.invoke("plugin:sessions:list")72
}),73
system: Object.freeze({74
readMetrics: (sessionId) => ipcRenderer.invoke("plugin:system:metrics", { sessionId }),75
virtualMemory: (sessionId, options = {}) => ipcRenderer.invoke("plugin:system:virtualMemory", { ...options, sessionId }),76
manageVirtualMemory: (sessionId, payload) => ipcRenderer.invoke("plugin:system:manageVirtualMemory", { ...payload, sessionId })77
}),78
keys: Object.freeze({79
generate: (payload) => ipcRenderer.invoke("plugin:keys:generate", payload),80
save: (generationId) => ipcRenderer.invoke("plugin:keys:save", { generationId })81
}),82
logs: Object.freeze({83
read: (options) => ipcRenderer.invoke("plugin:logs:read", options)84
}),85
users: Object.freeze({86
list: (sessionId) => ipcRenderer.invoke("plugin:users:list", { sessionId }),87
manage: (sessionId, payload) => ipcRenderer.invoke("plugin:users:manage", { ...payload, sessionId }),88
privileges: (sessionId, refresh = false) => ipcRenderer.invoke("plugin:users:privileges", { sessionId, refresh }),89
inventory: (sessionId, options = {}) => ipcRenderer.invoke("plugin:users:inventory", { ...options, sessionId }),90
detail: (sessionId, username, options = {}) => ipcRenderer.invoke("plugin:users:detail", { ...options, sessionId, username }),91
keys: (sessionId, payload) => ipcRenderer.invoke("plugin:users:keys", { ...payload, sessionId }),92
sshPolicy: (sessionId, payload) => ipcRenderer.invoke("plugin:users:sshPolicy", { ...payload, sessionId })93
}),94
nginx: Object.freeze({95
inspect: (sessionId) => ipcRenderer.invoke("plugin:nginx:inspect", { sessionId }),96
readConfig: (sessionId, payload) => ipcRenderer.invoke("plugin:nginx:readConfig", { ...payload, sessionId }),97
dumpConfig: (sessionId, sudoPassword) => ipcRenderer.invoke("plugin:nginx:dumpConfig", { sessionId, sudoPassword }),98
testConfig: (sessionId, sudoPassword) => ipcRenderer.invoke("plugin:nginx:testConfig", { sessionId, sudoPassword }),99
saveConfig: (sessionId, payload) => ipcRenderer.invoke("plugin:nginx:saveConfig", { ...payload, sessionId }),100
reload: (sessionId, sudoPassword, confirm = false) => ipcRenderer.invoke("plugin:nginx:reload", { sessionId, sudoPassword, confirm })101
}),102
files: Object.freeze({103
list: (sessionId, path) => ipcRenderer.invoke("plugin:files:list", { sessionId, path }),104
readText: (sessionId, path, options = {}) => ipcRenderer.invoke("plugin:files:readText", { sessionId, path, options }),105
writeText: (sessionId, path, text, options = {}) => ipcRenderer.invoke("plugin:files:writeText", { sessionId, path, text, options }),106
saveText: (sessionId, path, text, options = {}) => ipcRenderer.invoke("plugin:files:saveText", { sessionId, path, text, options }),107
listRecovery: (sessionId, options = {}) => ipcRenderer.invoke("plugin:files:listRecovery", { sessionId, options }),108
readRecovery: (sessionId, recoveryId, options = {}) => ipcRenderer.invoke("plugin:files:readRecovery", { sessionId, recoveryId, options }),109
cleanupRecovery: (sessionId, recoveryId, options = {}) => ipcRenderer.invoke("plugin:files:cleanupRecovery", { sessionId, recoveryId, options }),110
closeText: (editId) => ipcRenderer.invoke("plugin:files:closeText", { editId }),111
createFile: (sessionId, path) => ipcRenderer.invoke("plugin:files:createFile", { sessionId, path }),112
mkdir: (sessionId, path) => ipcRenderer.invoke("plugin:files:mkdir", { sessionId, path }),113
rename: (sessionId, from, to) => ipcRenderer.invoke("plugin:files:rename", { sessionId, from, to }),114
remove: (sessionId, path) => ipcRenderer.invoke("plugin:files:remove", { sessionId, path }),115
removeMany: (sessionId, paths, recursive = false) => ipcRenderer.invoke("plugin:files:removeMany", { sessionId, paths, recursive }),116
upload: (sessionId, directory) => ipcRenderer.invoke("plugin:files:upload", { sessionId, directory }),117
download: (sessionId, path) => ipcRenderer.invoke("plugin:files:download", { sessionId, path }),118
downloadMany: (sessionId, paths) => ipcRenderer.invoke("plugin:files:downloadMany", { sessionId, paths }),119
downloadArchive: (sessionId, paths, format) => ipcRenderer.invoke("plugin:files:downloadArchive", { sessionId, paths, format })120
}),121
hashing: Object.freeze({122
getAlgorithms: () => ipcRenderer.invoke("plugin:hashing:algorithms"),123
selectFiles: (multiple = false) => ipcRenderer.invoke("plugin:hashing:selectFiles", { multiple }),124
selectDirectory: () => ipcRenderer.invoke("plugin:hashing:selectDirectory"),125
selectManifest: () => ipcRenderer.invoke("plugin:hashing:selectManifest"),126
selectManifestDestination: (suggestedName) => ipcRenderer.invoke("plugin:hashing:selectManifestDestination", { suggestedName }),127
start: (payload) => ipcRenderer.invoke("plugin:hashing:start", payload),128
verify: (payload) => ipcRenderer.invoke("plugin:hashing:verify", payload),129
compare: (payload) => ipcRenderer.invoke("plugin:hashing:compare", payload),130
generateManifest: (payload) => ipcRenderer.invoke("plugin:hashing:generateManifest", payload),131
verifyManifest: (payload) => ipcRenderer.invoke("plugin:hashing:verifyManifest", payload),132
exportResults: (payload) => ipcRenderer.invoke("plugin:hashing:exportResults", payload),133
copyResult: (payload) => ipcRenderer.invoke("plugin:hashing:copyResult", payload),134
status: (jobId) => ipcRenderer.invoke("plugin:hashing:status", { jobId }),135
cancel: (jobId) => ipcRenderer.invoke("plugin:hashing:cancel", { jobId }),136
onProgress: (callback) => {137
if (typeof callback !== "function") throw new TypeError("Progress callback must be a function.");138
const listener = (_event, job) => callback(job);139
ipcRenderer.on("plugin:hashing:progress", listener);140
return () => ipcRenderer.removeListener("plugin:hashing:progress", listener);141
}142
})143
}));SHA-256
dfde44a2deefbf856ba9dafafebe1d7c4ee929d47375e8e2f62df0dfc151f7a6CH-J Proprietary Software License 1.14 · کد منبع تحت CH-J Proprietary Software License 1.14 ارائه میشود. در دسترس بودن آن شرایط مجوز را تغییر نمیدهد و حق اضافهای اعطا نمیکند.
SHA-256 بایگانی
cf4455b698f0f28e456a37b1834976a0194d8486acb7101052d59a838745cca3