Initial commit: DashCaddy v1.0

Full codebase including API server (32 modules + routes), dashboard frontend,
DashCA certificate distribution, installer script, and deployment skills.
This commit is contained in:
2026-03-05 02:26:12 -08:00
commit f61e85d9a7
337 changed files with 75282 additions and 0 deletions

View File

@@ -0,0 +1,102 @@
const { contextBridge, ipcRenderer } = require('electron');
// Expose protected methods that allow the renderer process to use
// the ipcRenderer without exposing the entire object
contextBridge.exposeInMainWorld('electronAPI', {
// Platform detection
checkPlatform: () => ipcRenderer.invoke('check-platform'),
// Dependency checking
checkDependencies: (options) => ipcRenderer.invoke('check-dependencies', options),
checkDocker: () => ipcRenderer.invoke('check-docker'),
checkCaddy: (options) => ipcRenderer.invoke('check-caddy', options),
installDocker: () => ipcRenderer.invoke('install-docker'),
installCaddy: (options) => ipcRenderer.invoke('install-caddy', options),
// Configuration
validatePath: (path) => ipcRenderer.invoke('validate-path', path),
selectFolder: () => ipcRenderer.invoke('select-folder'),
saveConfig: (config) => ipcRenderer.invoke('save-config', config),
loadConfig: (path) => ipcRenderer.invoke('load-config', path),
// File deployment
validateSources: () => ipcRenderer.invoke('validate-sources'),
deployDashboard: (installPath) => ipcRenderer.invoke('deploy-dashboard', installPath),
deployAPI: (installPath) => ipcRenderer.invoke('deploy-api', installPath),
deployComplete: (installPath) => ipcRenderer.invoke('deploy-complete', installPath),
// Caddyfile generation
createCaddyfile: (installPath, options) => ipcRenderer.invoke('create-caddyfile', installPath, options),
createDockerCompose: (installPath) => ipcRenderer.invoke('create-docker-compose', installPath),
// Browser launcher
openDashboard: (port, hostname) => ipcRenderer.invoke('open-dashboard', port, hostname),
// Installation
runInstallation: (config) => ipcRenderer.invoke('run-installation', config),
// DNS
testDNSConnection: (credentials) => ipcRenderer.invoke('test-dns-connection', credentials),
// Network detection
detectNetwork: () => ipcRenderer.invoke('detect-network'),
// Health check
healthCheck: (config) => ipcRenderer.invoke('health-check', config),
// Uninstallation
detectInstallation: () => ipcRenderer.invoke('detect-installation'),
checkPreservedSettings: (installPath) => ipcRenderer.invoke('check-preserved-settings', installPath),
restorePreservedSettings: (installPath) => ipcRenderer.invoke('restore-preserved-settings', installPath),
runUninstallation: (options) => ipcRenderer.invoke('run-uninstallation', options),
// Service management
startServices: (config) => ipcRenderer.invoke('start-services', config),
stopServices: (config) => ipcRenderer.invoke('stop-services', config),
checkServiceStatus: (config) => ipcRenderer.invoke('check-service-status', config),
// DNS credentials
saveDNSCredentials: (credentials, installPath) =>
ipcRenderer.invoke('save-dns-credentials', credentials, installPath),
// Branding
saveBranding: (branding, installPath) =>
ipcRenderer.invoke('save-branding', branding, installPath),
// File selection (for logo, etc.)
selectFile: (options) => ipcRenderer.invoke('select-file', options),
// Event listeners
onStepProgress: (callback) => {
ipcRenderer.on('step-progress', (event, data) => callback(data));
},
onStepComplete: (callback) => {
ipcRenderer.on('step-complete', (event, data) => callback(data));
},
onStepError: (callback) => {
ipcRenderer.on('step-error', (event, data) => callback(data));
},
onInstallationComplete: (callback) => {
ipcRenderer.on('installation-complete', (event, data) => callback(data));
},
onDeploymentProgress: (callback) => {
ipcRenderer.on('deployment-progress', (event, data) => callback(data));
},
onUninstallProgress: (callback) => {
ipcRenderer.on('uninstall-progress', (event, data) => callback(data));
},
onUninstallStepComplete: (callback) => {
ipcRenderer.on('uninstall-step-complete', (event, data) => callback(data));
},
onUninstallComplete: (callback) => {
ipcRenderer.on('uninstall-complete', (event, data) => callback(data));
},
onUninstallError: (callback) => {
ipcRenderer.on('uninstall-error', (event, data) => callback(data));
},
// Remove listeners
removeListener: (channel) => {
ipcRenderer.removeAllListeners(channel);
}
});