diff --git a/README.md b/README.md index 115da89..207a5b6 100644 --- a/README.md +++ b/README.md @@ -301,7 +301,22 @@ Permissions are configured locally, never through remote tools: Destructive operations require a native local confirmation for the exact action and arguments. Cancel is the default, approval expires within 60 seconds, and no remote tool or boolean can grant it. Starting transfers also requires confirmation when current settings enable automatic source deletion or power actions. Cancellation and expiry prevent pending actions from starting; they cannot undo an action already committed. -The legacy screen/input connection remains available during migration. Screen streaming, granting new filesystem roots, changing MCP permissions and obtaining the connection code are not remote MCP operations. A compatible Streamable HTTP client must be configured separately. Local support-package export remains available without MCP. +MCP replaces both legacy remote listeners. The old screen/input and diagnostic servers no longer start, their activation controls are removed, and settings imports cannot reactivate them. A compatible Streamable HTTP client must be configured separately. Local support-package export remains available without MCP. + +The previous diagnostic operations map to these MCP tools: + +| Previous operation | MCP replacement | +| --- | --- | +| System information and server health | `mhu_diagnostics_summary` | +| Redacted configuration | `mhu_settings_get`, `mhu_accounts_list` | +| Log list, read and tail | `mhu_logs_list`, `mhu_logs_read` | +| Application events | `mhu_app_events` | +| Classified errors | `mhu_errors` | +| Queue snapshot | `mhu_app_state`, `mhu_queue_list` with current renderer state | +| History and hoster statistics | `mhu_history_list`, `mhu_history_summary` | +| Rotation state and configured hosters | `mhu_diagnostics_summary`; `mhu_accounts_check` for explicit live checks | + +Screen streaming and arbitrary mouse/keyboard control are intentionally not MCP operations. CAPTCHA and interactive authentication challenges remain local; supported one-time account codes can be submitted with `mhu_accounts_otp`. Granting new directories, changing MCP permissions and obtaining the connection code are local security decisions. These boundaries do not disable ordinary upload, queue, account, automation, history or backup operations exposed through the structured tool catalog. ## Development and Windows builds diff --git a/eslint.config.mjs b/eslint.config.mjs index aa534ef..6046a33 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -109,7 +109,7 @@ export default [ 'getUiLocale', 'config', 'hosterSettings', 'ensureAccountStatusEntries', 'syncSelectedUploadHosters', 'renderAccounts', 'renderHosterSummary', 'rebuildJobIndex', '_queueStatsCache', 'syncSelectedFilesFromQueue', 'renderQueueTable', 'updateUploadView', 'updateStatusBar', 'queueJobs', 'uploading', 'selectedFiles', 'findAccountById', 'accountStatuses', 'existingImportPaths', 'createAutomationPreviewJob', 'clearDedupKeysForPaths', - 'persistQueueStateNow', 'isStartableQueueStatus', 'startSelectedUpload', '_jobIndexByUploadId', '_deletedJobIds', 'removeJobFromIndex', 'showCopyToast' + 'persistQueueStateNow', 'isStartableQueueStatus', 'startSelectedUpload', '_jobIndexByUploadId', '_deletedJobIds', 'removeJobFromIndex', 'showCopyToast', 'getSelectedHosters' ].map(name => [name, 'writable'])) } }, diff --git a/lib/config-store.js b/lib/config-store.js index af85d8c..73b55f9 100644 --- a/lib/config-store.js +++ b/lib/config-store.js @@ -108,23 +108,6 @@ const DEFAULTS = { paused: false, pausedAt: null }, - remote: { - enabled: false, - port: 9100, - token: '', - allowInput: true - }, - diagnostics: { - enabled: false, - port: 9110, - token: '', - label: '', - codeIssuedAt: 0, - bindMode: 'local', - publicHost: '', - allowlist: [], - bindAddress: '127.0.0.1' - } }, history: [], rotationCursors: {} @@ -466,6 +449,8 @@ class ConfigStore { globalSettings[key] = { ...def, ...(savedGlobal[key] || {}) }; } } + delete globalSettings.remote; + delete globalSettings.diagnostics; // Normalize logMode at this single boundary. Legacy sessionLog: true // means *daily* (the old field was named after a misnomer); see log-mode.js. // Downstream readers consume logMode only and must NOT derive from @@ -499,6 +484,8 @@ class ConfigStore { _serializeForDisk(config) { const hosters = this._clone(config.hosters || {}); const globalSettings = this._clone(config.globalSettings || {}); + delete globalSettings.remote; + delete globalSettings.diagnostics; delete globalSettings.allowPlaintextCredentialStorage; secretStore.encryptCredentials({ hosters, globalSettings }); return JSON.stringify({ ...config, globalSettings, hosters }, null, 2); @@ -712,8 +699,6 @@ class ConfigStore { return this._enqueueWrite(() => { const current = this.load(); const currentGlobalSettings = current.globalSettings || {}; - const currentRemote = currentGlobalSettings.remote || {}; - const incomingRemote = snapshot.remote || {}; const currentFolderMonitor = currentGlobalSettings.folderMonitor || {}; const incomingFolderMonitor = snapshot.folderMonitor || {}; current.globalSettings = { @@ -721,7 +706,6 @@ class ConfigStore { pendingQueue: currentGlobalSettings.pendingQueue ?? null, uploadRecovery: currentGlobalSettings.uploadRecovery ?? null, lastBrowseDirectory: currentGlobalSettings.lastBrowseDirectory || '', - diagnostics: this._clone(currentGlobalSettings.diagnostics || {}), cloudLogSync: this._clone(currentGlobalSettings.cloudLogSync || {}), historyRetention: currentGlobalSettings.historyRetention || 'all', folderMonitor: { @@ -729,10 +713,6 @@ class ConfigStore { ...incomingFolderMonitor, paused: currentFolderMonitor.paused === true, pausedAt: currentFolderMonitor.pausedAt ?? null - }, - remote: { - ...incomingRemote, - token: incomingRemote.token || currentRemote.token || '' } }; this._guardHosters(current, false); @@ -749,18 +729,12 @@ class ConfigStore { }); } - saveRemoteSettings(remoteSettings, createToken) { - const incoming = this._clone(remoteSettings || {}); + saveRemoteSettings() { return this._enqueueWrite(async () => { const current = this.load(); - const currentGlobalSettings = current.globalSettings || {}; - const currentRemote = currentGlobalSettings.remote || {}; - const token = incoming.token || currentRemote.token || (incoming.enabled && typeof createToken === 'function' ? createToken() : ''); - const canonical = { ...incoming, token }; - current.globalSettings = { ...currentGlobalSettings, remote: canonical }; this._guardHosters(current, false); await this._commit(current); - return this._clone(canonical); + return { enabled: false, retired: true, token: '' }; }); } diff --git a/lib/diagnostics-collectors.js b/lib/diagnostics-collectors.js index 41f890d..eef85bf 100644 --- a/lib/diagnostics-collectors.js +++ b/lib/diagnostics-collectors.js @@ -172,7 +172,8 @@ function createCollectors(deps) { function listErrors(args) { const a = args || {}; const cfg = loadConfig(); - const { errors, byCategory } = _historyErrors(cfg.history, a); + const history = typeof loadHistory === 'function' ? loadHistory() : cfg.history; + const { errors, byCategory } = _historyErrors(history, a); const limit = Math.min(Math.max(Number(a.limit) || 100, 1), 1000); const window = Number.isFinite(a.sinceMs) ? `since ${new Date(a.sinceMs).toISOString()}` : 'all history'; return { window, total: errors.length, byCategory, errors: errors.slice(-limit) }; @@ -244,7 +245,7 @@ function createCollectors(deps) { const hosters = cfg.hosters && typeof cfg.hosters === 'object' ? Object.keys(cfg.hosters).filter(h => Array.isArray(cfg.hosters[h]) && cfg.hosters[h].length > 0) : []; return { reachabilityKnown: false, - hint: 'Live hoster probing (run_health_check) is disabled in this build. Configured hosters with at least one account are listed.', + hint: 'Configured hosters with at least one account are listed. Use an explicit account check for live reachability.', configuredHosters: hosters }; } diff --git a/lib/mcp-app.js b/lib/mcp-app.js index fe48e51..3d36eea 100644 --- a/lib/mcp-app.js +++ b/lib/mcp-app.js @@ -126,8 +126,11 @@ function createMcpApp({ loadConfig, invoke, invokeGuarded = (_context, channel, return page(rows, args); }, mhu_history_prune: args => invoke('prune-history', { retention: args.retention, dryRun: false }), + mhu_history_summary: args => collectors.getHistory({ limit: args.limit || 20 }), mhu_history_clear: () => invoke('clear-history'), - mhu_diagnostics_summary: () => ({ system: collectors.getSystemInfo(), health: collectors.getHealth(), rotation: collectors.getRotationState() }), + mhu_diagnostics_summary: () => ({ system: collectors.getSystemInfo(), health: collectors.getHealth(), rotation: collectors.getRotationState(), server: collectors.serverHealth({ errorLimit: 20 }) }), + mhu_app_events: args => collectors.getAppEvents(args), + mhu_errors: args => collectors.listErrors(args), mhu_logs_list: () => collectors.listLogs(), mhu_logs_read: args => collectors.readLog(args), mhu_cloud_status: () => invoke('cloud-log:status'), diff --git a/lib/mcp-tools.js b/lib/mcp-tools.js index ad97997..579875b 100644 --- a/lib/mcp-tools.js +++ b/lib/mcp-tools.js @@ -58,9 +58,12 @@ const definitions = [ ['automation_scan', 'Run a read-only folder monitoring test scan.', 'read', {}, []], ['automation_reconcile', 'Reconcile the monitored directory with the queue.', 'control', {}, []], ['history_list', 'Read a bounded page of upload history.', 'read', page, []], + ['history_summary', 'Read aggregate hoster statistics and recent batch summaries.', 'read', { limit: integer(1, 200) }, []], ['history_prune', 'Apply a retention policy to upload history.', 'control', { retention }, ['retention'], true], ['history_clear', 'Clear upload history.', 'control', {}, [], true], ['diagnostics_summary', 'Read filtered application diagnostics.', 'diagnostics', {}, []], + ['app_events', 'Read recent secret-filtered application events.', 'read', { limit: integer(1, 200) }, []], + ['errors', 'Read classified upload failures from persisted history.', 'read', { limit: integer(1, 200), sinceMs: integer(0, 8640000000000000), category: text(80), hoster }, []], ['logs_list', 'List the application-managed diagnostic logs.', 'diagnostics', {}, []], ['logs_read', 'Read a bounded, secret-filtered application log tail.', 'diagnostics', { name: enumeration(['debug', 'fileuploader', 'uploadAudit', 'accountRotation', 'crash']), diff --git a/lib/settings-backup.js b/lib/settings-backup.js index 8a5f175..4f9c3b1 100644 --- a/lib/settings-backup.js +++ b/lib/settings-backup.js @@ -35,6 +35,8 @@ function createPortableSettingsSnapshot(config) { snapshot.globalSettings.pendingQueue = null; snapshot.globalSettings.uploadRecovery = null; snapshot.globalSettings.lastBrowseDirectory = ''; + delete snapshot.globalSettings.remote; + delete snapshot.globalSettings.diagnostics; if (snapshot.globalSettings.cloudLogSync) { delete snapshot.globalSettings.cloudLogSync.accountId; delete snapshot.globalSettings.cloudLogSync.ip; diff --git a/main.js b/main.js index 64122e5..470a5a0 100644 --- a/main.js +++ b/main.js @@ -32,7 +32,6 @@ const { createPortableSettingsSnapshot, prepareImportedSettings } = require('./l const { createSettingsImportGate } = require('./lib/settings-import-gate'); const FolderMonitor = require('./lib/folder-monitor'); const { walkFolderAsync } = require('./lib/file-discovery'); -const RemoteServer = require('./lib/remote-server'); const { maybeRotateLogFile } = require('./lib/log-rotation'); const { hosterLogToFileEnabled } = require('./lib/log-policy'); const { formatUploadLogLine, iterateUploadLogEntries, summarizeBatchPlan, formatUploadPlanLogLine } = require('./lib/upload-log'); @@ -42,7 +41,6 @@ const { sanitizeConfig, buildSupportBundleText, collectSecretValues, redactLogTe const { buildWebhookRequest, isAllAborted } = require('./lib/webhook-notify'); const stats = require('./lib/stats'); const { createCollectors } = require('./lib/diagnostics-collectors'); -const { createAgent } = require('./lib/diagnostics-agent'); const { buildSessionReport, buildSessionReportCsv } = require('./lib/session-report'); const { inspectImportEntries, inspectReadableImportPath } = require('./lib/import-preflight'); const { normalizeAutomationSettings, automationCompletionKey, createAutomationCompletionWriter, isPathWithinAutomationFolder, normalizeAutomationCompletion } = require('./lib/automation-control'); @@ -202,8 +200,6 @@ function requestUploadFinalization(summary, preserveQueue = false) { } const activeUploadProducerTrackers = new Set(); const settingsImportGate = createSettingsImportGate(() => !!(uploadManager && uploadManager.running)); -let diagnosticAgent = null; -let _diagHandler = null; function assertConfigWriteAllowed() { if (!settingsImportGate.canStartUpload()) throw new Error('Einstellungen werden gerade importiert'); @@ -472,10 +468,6 @@ function _appendJobLog(jobId, entry) { arr.push(entry); } const folderMonitor = new FolderMonitor(); -let remoteServer = null; -let captureWindow = null; -let captureWindowReady = false; -let signalingQueue = []; const HEALTH_CHECK_TIMEOUT = 25000; const doodstreamHealthCoordinator = createDoodstreamOtpCoordinator({ createUploader: () => new DoodstreamUploader() @@ -1947,24 +1939,6 @@ app.whenReady().then(async () => { debugLog(`folder-monitor auto-start failed: ${err.message}`); } - // Auto-start remote server if enabled - try { - const _remCfg = configStore.load(); - const remoteConfig = _remCfg.globalSettings && _remCfg.globalSettings.remote; - if (remoteConfig && remoteConfig.enabled) { - startRemoteServer().catch(err => { - debugLog(`remote-server auto-start failed: ${err.message}`); - }); - } - const diagConfig = _remCfg.globalSettings && _remCfg.globalSettings.diagnostics; - if (diagConfig && diagConfig.enabled) { - startDiagnosticAgent().catch(err => { - debugLog(`diagnostics-agent auto-start failed: ${err.message}`); - }); - } - } catch (err) { - debugLog(`remote-server auto-start failed: ${err.message}`); - } // Auto-show drop target if enabled try { @@ -2013,11 +1987,6 @@ app.on('will-quit', () => { if (restartAfterClosePreparation) app.relaunch(); if (uploadManager) try { uploadManager.cancel(); } catch {} try { stopFolderMonitor(); } catch {} - try { - if (remoteServer) { remoteServer.stop(); remoteServer = null; } - destroyCaptureWindow(); - } catch {} - try { stopDiagnosticAgent(); } catch {} try { destroyDropTargetWindow(); } catch {} try { if (tray && !tray.isDestroyed()) { tray.destroy(); tray = null; } } catch {} // Flush pending log buffers synchronously so no lines are lost. @@ -3199,26 +3168,7 @@ async function syncImportedRuntime(config) { debugLog(`backup folder monitor sync failed: ${error.message}`); warnings.push('Ordnerüberwachung'); } - try { - const remoteSettings = config.globalSettings.remote; - if (remoteSettings && remoteSettings.enabled) await startRemoteServer(); - else if (remoteServer) { - remoteServer.stop(); - remoteServer = null; - destroyCaptureWindow(); - } - } catch (error) { - debugLog(`backup remote sync failed: ${error.message}`); - warnings.push('Remote-Steuerung'); - } - try { - const diagnostics = config.globalSettings.diagnostics; - if (diagnostics && diagnostics.enabled) await startDiagnosticAgent(); - else stopDiagnosticAgent(); - } catch (error) { - debugLog(`backup diagnostics sync failed: ${error.message}`); - warnings.push('Diagnose'); - } + try { if (config.globalSettings.showDropTarget) createDropTargetWindow(); else destroyDropTargetWindow(); @@ -4011,12 +3961,6 @@ ipcMain.handle('folder-monitor:select-folder', async () => { return result.filePaths[0]; }); -// --- Remote Control --- -function generateToken() { - const crypto = require('crypto'); - return crypto.randomBytes(32).toString('hex'); -} - // --- Remote Diagnostics (read-only) --- function _diagAppInfo() { return { @@ -4053,15 +3997,8 @@ function _diagSystemInfo() { } function _diagAgentInfo() { - const cfg = configStore.load(); - const diag = (cfg.globalSettings && cfg.globalSettings.diagnostics) || {}; - return { - version: app.getVersion(), - port: diag.port || 9110, - bindAddress: _diagBindHost(diag), - clientCount: diagnosticAgent ? diagnosticAgent.getClientCount() : 0, - lastAccess: diagnosticAgent ? diagnosticAgent.getLastAccess() : null - }; + const state = mcpService?.state(); + return { version: app.getVersion(), transport: 'mcp-relay', enabled: state?.enabled === true, connection: state?.connection || 'disabled', activeRequests: state?.activeRequests || 0, lastContact: state?.lastContact || null }; } function createAppCollectors() { @@ -4172,416 +4109,12 @@ ipcMain.handle('mcp:update-grant', async (event, args) => { return mcpService.updateGrant(args.id, args.remove, args.readOnly); }); -function _buildDiagnosticHandler() { - const collectors = createCollectors({ - loadConfig: () => configStore.load(), - loadHistory: () => configStore.loadHistory(), - getAllLogPaths, - support: { sanitizeConfig, collectSecretValues, redactLogText, valueScrub, collectFile, REDACTED }, - stats, - appInfo: _diagAppInfo, - systemInfo: _diagSystemInfo, - agentInfo: _diagAgentInfo - }); - const agent = createAgent(collectors); - return (msg, _client, reply) => { - let result; - try { result = agent.handle(msg.op, msg.args); } - catch (e) { result = { ok: false, error: String((e && e.message) || e) }; } - reply(result); - }; +const retiredRemoteState = Object.freeze({ retired: true, enabled: false, running: false, token: '', code: '', port: null, clientCount: 0 }); +for (const channel of ['remote:get-settings', 'remote:save-settings', 'remote:status', 'diagnostics:get-settings', 'diagnostics:save-settings', 'diagnostics:regenerate', 'diagnostics:status']) { + ipcMain.handle(channel, () => ({ ...retiredRemoteState })); } - -function _getSuggestedRemoteHosts() { - const os = require('os'); - const hosts = []; - try { - for (const entry of Object.values(os.networkInterfaces())) { - for (const net of (entry || [])) { - if (net && net.family === 'IPv4' && !net.internal && net.address) hosts.push(net.address); - } - } - } catch {} - return [...new Set(hosts)]; -} - -function _diagAllowlist(diag) { - return Array.isArray(diag && diag.allowlist) ? diag.allowlist.map((x) => String(x).trim()).filter(Boolean) : []; -} - -function _diagBindHost(diag) { - const mode = (diag && diag.bindMode) || 'local'; - if (mode === 'network' && _diagAllowlist(diag).length > 0) return '0.0.0.0'; - return '127.0.0.1'; -} - -function _diagPublicHost(diag) { - const explicit = String((diag && diag.publicHost) || '').trim(); - if (explicit) return explicit; - if (_diagBindHost(diag) === '127.0.0.1') return '127.0.0.1'; - return _getSuggestedRemoteHosts()[0] || '127.0.0.1'; -} - -function buildDiagnosticCode(diag, fp) { - const payload = { v: 1, h: _diagPublicHost(diag), p: diag.port || 9110, t: diag.token, n: diag.label || require('os').hostname() }; - if (fp) { payload.fp = fp; payload.s = 'wss'; } - return 'mhu1_' + Buffer.from(JSON.stringify(payload)).toString('base64url'); -} - -async function startDiagnosticAgent() { - if (diagnosticAgent) { try { diagnosticAgent.stop(); } catch {} diagnosticAgent = null; } - const config = configStore.load(); - const diag = config.globalSettings && config.globalSettings.diagnostics; - if (!diag || !diag.enabled) return; - - let token = diag.token; - if (!token) { - token = generateToken(); - const gs = { ...config.globalSettings, diagnostics: { ...diag, token, codeIssuedAt: Date.now() } }; - await configStore.save({ globalSettings: gs }); - } - - if (!_diagHandler) _diagHandler = _buildDiagnosticHandler(); - const host = _diagBindHost(diag); - const allowlist = _diagAllowlist(diag); - diagnosticAgent = new RemoteServer(); - try { - await diagnosticAgent.start({ - port: diag.port || 9110, - host, - token, - diagnosticMode: true, - allowlist, - onDiagnosticRequest: _diagHandler - }); - debugLog(`diagnostics-agent started on ${host}:${diagnosticAgent.getPort()} (allowlist ${allowlist.length})`); - } catch (e) { - debugLog(`diagnostics-agent start failed: ${e.message}`); - diagnosticAgent = null; - } -} - -function stopDiagnosticAgent() { - if (diagnosticAgent) { try { diagnosticAgent.stop(); } catch {} diagnosticAgent = null; } -} - -ipcMain.handle('diagnostics:get-settings', () => { - const cfg = configStore.load(); - const diag = (cfg.globalSettings && cfg.globalSettings.diagnostics) || {}; - return { - enabled: !!diag.enabled, - port: diag.port || 9110, - bindMode: diag.bindMode === 'network' ? 'network' : 'local', - bindAddress: _diagBindHost(diag), - publicHost: diag.publicHost || '', - allowlist: _diagAllowlist(diag), - suggestedHosts: _getSuggestedRemoteHosts(), - label: diag.label || require('os').hostname(), - codeIssuedAt: diag.codeIssuedAt || 0, - code: diag.token ? buildDiagnosticCode(diag) : '' - }; -}); - -ipcMain.handle('diagnostics:save-settings', async (_e, incoming) => { - assertConfigWriteAllowed(); - const cfg = configStore.load(); - const cur = (cfg.globalSettings && cfg.globalSettings.diagnostics) || {}; - const next = { - ...cur, - enabled: !!(incoming && incoming.enabled), - port: (incoming && Number(incoming.port)) || cur.port || 9110, - bindMode: (incoming && incoming.bindMode === 'network') ? 'network' : 'local', - publicHost: (incoming && incoming.publicHost !== null && incoming.publicHost !== undefined) ? String(incoming.publicHost).trim() : (cur.publicHost || ''), - allowlist: (incoming && Array.isArray(incoming.allowlist)) - ? incoming.allowlist.map((x) => String(x).trim()).filter(Boolean) - : _diagAllowlist(cur), - label: (incoming && incoming.label !== null && incoming.label !== undefined) ? String(incoming.label) : cur.label - }; - next.bindAddress = _diagBindHost(next); - const gs = { ...cfg.globalSettings, diagnostics: next }; - await configStore.save({ globalSettings: gs }); - await startDiagnosticAgent(); - return { ok: true, bindAddress: next.bindAddress, allowlistCount: next.allowlist.length }; -}); - -ipcMain.handle('diagnostics:regenerate', async () => { - assertConfigWriteAllowed(); - const cfg = configStore.load(); - const cur = (cfg.globalSettings && cfg.globalSettings.diagnostics) || {}; - const next = { ...cur, token: generateToken(), codeIssuedAt: Date.now() }; - const gs = { ...cfg.globalSettings, diagnostics: next }; - await configStore.save({ globalSettings: gs }); - if (next.enabled) await startDiagnosticAgent(); - return { ok: true, code: buildDiagnosticCode(next), codeIssuedAt: next.codeIssuedAt }; -}); - -ipcMain.handle('diagnostics:status', () => { - const cfg = configStore.load(); - const diag = (cfg.globalSettings && cfg.globalSettings.diagnostics) || {}; - return { - running: !!diagnosticAgent, - port: diagnosticAgent ? diagnosticAgent.getPort() : (diag.port || 9110), - bindMode: diag.bindMode === 'network' ? 'network' : 'local', - bindAddress: _diagBindHost(diag), - publicHost: _diagPublicHost(diag), - allowlistCount: _diagAllowlist(diag).length, - clientCount: diagnosticAgent ? diagnosticAgent.getClientCount() : 0, - lastAccess: diagnosticAgent ? diagnosticAgent.getLastAccess() : null - }; -}); - -function createCaptureWindow() { - if (captureWindow && !captureWindow.isDestroyed()) return; - captureWindowReady = false; - captureWindow = new BrowserWindow({ - show: false, - webPreferences: { - contextIsolation: true, - nodeIntegration: false, - preload: path.join(__dirname, 'lib', 'remote-capture-preload.js') - } - }); - captureWindow.loadFile(path.join(__dirname, 'lib', 'remote-capture.html')); - - // Wait for window to be fully loaded before sending signaling messages - captureWindow.webContents.on('dom-ready', () => { - debugLog('remote: capture window ready, draining', signalingQueue.length, 'queued messages'); - captureWindowReady = true; - for (const msg of signalingQueue) { - captureWindow.webContents.send('remote:signaling-to-capture', msg); - } - signalingQueue = []; - }); - - // Crash recovery: if hidden window closes unexpectedly while clients connected, recreate it - captureWindow.on('closed', () => { - captureWindow = null; - captureWindowReady = false; - signalingQueue = []; - if (remoteServer && remoteServer.getClientCount() > 0) { - debugLog('remote: capture window crashed, recreating...'); - createCaptureWindow(); - } - }); -} - -function destroyCaptureWindow() { - if (captureWindow && !captureWindow.isDestroyed()) { - captureWindow.close(); - captureWindow = null; - } -} - -async function startRemoteServer() { - if (remoteServer) { - remoteServer.stop(); - remoteServer = null; - } - - const config = configStore.load(); - const remote = config.globalSettings && config.globalSettings.remote; - if (!remote || !remote.enabled) return; - - let token = remote.token; - if (!token) { - const canonical = await configStore.saveRemoteSettings(remote, generateToken); - token = canonical.token; - } - - remoteServer = new RemoteServer(); - try { - await remoteServer.start({ - port: remote.port || 9100, - token, - allowInput: remote.allowInput !== false, - mainWindow, - onSignalingToCapture: (data) => { - if (!captureWindow || captureWindow.isDestroyed()) { - debugLog('remote: signaling dropped, no capture window'); - return; - } - if (captureWindowReady) { - captureWindow.webContents.send('remote:signaling-to-capture', data); - } else { - debugLog('remote: capture window not ready, queuing', data.type, 'message'); - signalingQueue.push(data); - } - }, - onCreateCaptureWindow: () => createCaptureWindow(), - onDestroyCaptureWindow: () => destroyCaptureWindow() - }); - } catch (error) { - try { remoteServer.stop(); } catch {} - remoteServer = null; - destroyCaptureWindow(); - throw error; - } - - debugLog(`remote-server started on port ${remoteServer.getPort()}`); -} - -// IPC: Signaling from capture window back to dashboard client -ipcMain.on('remote:signaling-from-capture', (_event, data) => { - if (remoteServer && data.clientId) { - remoteServer.sendToClient(data.clientId, data); - } -}); - -// IPC: Debug logging from capture window -ipcMain.on('remote:capture-log', (_event, msg) => { - debugLog('remote-capture:', msg); -}); - -// IPC: Input events from capture window -ipcMain.on('remote:input-event', (_event, data) => { - if (!mainWindow || mainWindow.isDestroyed()) return; - - const config = configStore.load(); - const remote = config.globalSettings && config.globalSettings.remote; - if (!remote || !remote.allowInput) return; - if (data.role !== 'admin') return; - - // Capture includes window frame (title bar) but NOT invisible DWM borders - // sendInputEvent coordinates are relative to web content area - const winBounds = mainWindow.getBounds(); - const contentBounds = mainWindow.getContentBounds(); - // Windows 10/11: getBounds() includes ~7px invisible resize borders not in capture - const dwm = process.platform === 'win32' ? 7 : 0; - const capturedW = winBounds.width - 2 * dwm; - const capturedH = winBounds.height - dwm; // only bottom has invisible border - const contentOffsetX = contentBounds.x - (winBounds.x + dwm); - const contentOffsetY = contentBounds.y - winBounds.y; - const rawX = typeof data.x === 'number' && isFinite(data.x) ? data.x : 0; - const rawY = typeof data.y === 'number' && isFinite(data.y) ? data.y : 0; - const x = Math.round(rawX * capturedW - contentOffsetX); - const y = Math.round(rawY * capturedH - contentOffsetY); - - switch (data.type) { - case 'mousemove': - mainWindow.webContents.sendInputEvent({ type: 'mouseMove', x, y }); - break; - case 'mousedown': - mainWindow.webContents.sendInputEvent({ - type: 'mouseDown', x, y, - button: data.button === 'right' ? 'right' : 'left', - clickCount: 1 - }); - break; - case 'mouseup': - mainWindow.webContents.sendInputEvent({ - type: 'mouseUp', x, y, - button: data.button === 'right' ? 'right' : 'left', - clickCount: 1 - }); - break; - case 'scroll': - mainWindow.webContents.sendInputEvent({ - type: 'mouseWheel', x, y, - deltaX: data.deltaX || 0, - deltaY: data.deltaY || 0 - }); - break; - case 'keydown': - mainWindow.webContents.sendInputEvent({ - type: 'keyDown', - keyCode: data.key, - modifiers: buildModifiers(data) - }); - if (data.key.length === 1) { - mainWindow.webContents.sendInputEvent({ - type: 'char', - keyCode: data.key, - modifiers: buildModifiers(data) - }); - } - break; - case 'keyup': - mainWindow.webContents.sendInputEvent({ - type: 'keyUp', - keyCode: data.key, - modifiers: buildModifiers(data) - }); - break; - } -}); - -function buildModifiers(data) { - const mods = []; - if (data.shift) mods.push('shift'); - if (data.ctrl) mods.push('control'); - if (data.alt) mods.push('alt'); - return mods; -} - -// IPC: Get capture source ID (desktopCapturer must run in main process in Electron 33+) -ipcMain.handle('remote:get-capture-source-id', async () => { - if (!mainWindow || mainWindow.isDestroyed()) { - debugLog('remote: capture source - mainWindow not available'); - return null; - } - // Use getMediaSourceId() for exact window capture without enumeration - const sourceId = mainWindow.getMediaSourceId(); - debugLog('remote: capture source - getMediaSourceId:', sourceId); - if (sourceId) return sourceId; - - // Fallback: enumerate sources - const { desktopCapturer } = require('electron'); - const sources = await desktopCapturer.getSources({ types: ['window', 'screen'] }); - const title = mainWindow.getTitle(); - debugLog('remote: capture source - fallback, looking for title:', title); - let source = sources.find(s => s.name === title); - if (!source) source = sources.find(s => s.name.includes('Multi-Hoster')); - if (!source) source = sources.find(s => s.id.startsWith('screen:')); - debugLog('remote: capture source -', source ? `found: ${source.name} (${source.id})` : 'NONE FOUND'); - return source ? source.id : null; -}); - -// IPC: Client count updates from capture window -ipcMain.on('remote:client-count', (_event, count) => { - safeSend('remote:client-count', count); -}); - -// IPC: Remote settings -ipcMain.handle('remote:get-settings', () => { - const config = configStore.load(); - return config.globalSettings && config.globalSettings.remote || {}; -}); - -ipcMain.handle('remote:save-settings', async (_event, remoteSettings) => { - assertConfigWriteAllowed(); - const canonicalSettings = await configStore.saveRemoteSettings(remoteSettings, generateToken); - - let runtimeError = ''; - try { - if (canonicalSettings.enabled) { - await startRemoteServer(); - } else if (remoteServer) { - remoteServer.stop(); - remoteServer = null; - destroyCaptureWindow(); - debugLog('remote-server stopped'); - } - } catch (error) { - runtimeError = error && error.message ? error.message : String(error); - } - return { - saved: true, - runtimeError, - settings: canonicalSettings - }; -}); - -ipcMain.handle('remote:generate-token', () => { - return generateToken(); -}); - -ipcMain.handle('remote:status', () => { - return { - running: !!remoteServer, - port: remoteServer ? remoteServer.getPort() : null, - clientCount: remoteServer ? remoteServer.getClientCount() : 0 - }; -}); +ipcMain.handle('remote:generate-token', () => ''); +ipcMain.handle('remote:get-capture-source-id', () => null); // --- Always on top --- ipcMain.handle('set-always-on-top', async (_event, value) => { diff --git a/preload.js b/preload.js index add55e0..67e190b 100644 --- a/preload.js +++ b/preload.js @@ -211,21 +211,6 @@ contextBridge.exposeInMainWorld('api', { onLogPathAutoUpdated: (callback) => { ipcRenderer.on('log-path-auto-updated', (_event, data) => callback(data)); }, - // Remote Control - remoteGetSettings: () => ipcRenderer.invoke('remote:get-settings'), - remoteSaveSettings: (settings) => ipcRenderer.invoke('remote:save-settings', settings), - remoteGenerateToken: () => ipcRenderer.invoke('remote:generate-token'), - remoteStatus: () => ipcRenderer.invoke('remote:status'), - onRemoteClientCount: (callback) => { - ipcRenderer.on('remote:client-count', (_event, count) => callback(count)); - }, - - // Remote Diagnostics (read-only) - diagnosticsGetSettings: () => ipcRenderer.invoke('diagnostics:get-settings'), - diagnosticsSaveSettings: (settings) => ipcRenderer.invoke('diagnostics:save-settings', settings), - diagnosticsRegenerate: () => ipcRenderer.invoke('diagnostics:regenerate'), - diagnosticsStatus: () => ipcRenderer.invoke('diagnostics:status'), - // File path from drag & drop (Electron 33+ compatible) getPathForFile: (file) => webUtils.getPathForFile(file), removeAllListeners: () => { @@ -245,6 +230,5 @@ contextBridge.exposeInMainWorld('api', { ipcRenderer.removeAllListeners('drop-target:files'); ipcRenderer.removeAllListeners('account-switched'); ipcRenderer.removeAllListeners('session-failed-accounts-changed'); - ipcRenderer.removeAllListeners('remote:client-count'); } }); diff --git a/renderer/app.js b/renderer/app.js index bd4b520..2a24b6d 100644 --- a/renderer/app.js +++ b/renderer/app.js @@ -17,11 +17,6 @@ function localizeUiText(value) { return window.I18n.translateText(value, uiLocalizer.getLanguage()); } -function formatRemoteClientStatus(port, count) { - const clients = count === 1 ? '1 Client' : `${count} Clients`; - return localizeUiText(`Aktiv auf Port ${port} — ${clients} verbunden`); -} - function refreshLocalizedRuntimeUi() { renderQueueTable(); renderAccounts(); @@ -407,16 +402,6 @@ function setAlwaysOnTopTracked(value) { return runConfigWrite(() => window.api.setAlwaysOnTop(enabled)); } -function saveDiagnosticsSettingsTracked(settings) { - const payload = snapshotConfigWritePayload(settings); - return runConfigWrite(() => window.api.diagnosticsSaveSettings(payload)); -} - -function saveRemoteSettingsTracked(settings) { - const payload = snapshotConfigWritePayload(settings); - return runConfigWrite(() => window.api.remoteSaveSettings(payload)); -} - function flushConfigWrites() { if (configFlushPromise) return configFlushPromise; configFlushPromise = (async () => { @@ -1629,18 +1614,6 @@ async function init() { addPathsToQueue(paths); }); - // Remote client count updates (registered once, not per renderSettings call) - window.api.onRemoteClientCount(() => { - const el = document.getElementById('remoteConnectionStatus'); - if (el && el.style.color === 'rgb(16, 185, 129)') { - window.api.remoteStatus().then(status => { - if (status.running) { - el.textContent = formatRemoteClientStatus(status.port, status.clientCount); - } - }).catch(() => {}); - } - }); - window.api.debugLog('init complete, all listeners registered'); // Restore always-on-top state @@ -6561,7 +6534,6 @@ function renderSettings() { const configuredAccounts = getAvailableHosters(); const fm = globalSettings.folderMonitor || {}; const normalizedFm = window.AutomationControl.normalizeAutomationSettings(fm); - const remoteSettings = globalSettings.remote || {}; const pageDefinitions = [ { id: 'allgemein', label: 'Allgemein', group: 'base', icon: 'sliders', description: 'Fenster, Sprache und Updates', search: 'fenster window vordergrund foreground always on top drop target oberfläche interface updates update aktualisierung version language sprache' }, @@ -6569,8 +6541,7 @@ function renderSettings() { { id: 'automatik', label: 'Automatik', group: 'base', icon: 'clock', description: 'Wiederholungen und Ordner', search: 'automatisch automation automatic retry wiederholen ordner folder monitor überwachen watch dateierweiterungen extensions unterordner subfolders duplikate duplicates' }, { id: 'benachrichtigungen', label: 'Benachrichtigungen', group: 'connections', icon: 'bell', description: 'Meldungen und Webhooks', search: 'benachrichtigungen notifications webhook discord meldung message ping erwähnung mention batch fertig completed' }, { id: 'logs', label: 'Logs & Support', group: 'management', icon: 'files', description: 'Protokolle und Supportpakete', search: 'log logs protokoll logging debug verbose diagnose diagnostics support paket package datei file ordner folder' }, - { id: 'remote', label: 'Fernsteuerung', group: 'connections', icon: 'monitor', description: 'Server und Verbindungen', search: 'remote control fernsteuerung mcp server input port api token verbindung connection client' }, - { id: 'diagnose', label: 'Diagnose-Zugriff', group: 'connections', icon: 'shield', description: 'Zugriff und Freigaben', search: 'diagnose diagnostics access zugriff lesen read allowlist netzwerk network lokal local verbindung connection code support' }, + { id: 'remote', label: 'MCP-Fernzugriff', group: 'connections', icon: 'monitor', description: 'Zugriff und Freigaben', search: 'remote control fernsteuerung mcp diagnose diagnostics access zugriff lesen read berechtigungen permissions verbindung connection client' }, { id: 'backup', label: 'Backup & Übertragen', group: 'management', icon: 'archive', description: 'Sichern, importieren und exportieren', search: 'backup transfer sichern export import online schlüssel key einstellungen settings accounts übertragen' } ]; const navigationGroups = [{ id: 'base', label: 'Grundlagen' }, { id: 'connections', label: 'Verbindungen' }, { id: 'management', label: 'Verwaltung' }]; @@ -6952,82 +6923,8 @@ function renderSettings() { `; pages.remote.innerHTML = ` - ${pageHeader('Fernsteuerung', 'Upload-Funktionen über einen verbundenen Client steuern.')} + ${pageHeader('MCP-Fernzugriff', 'App-Funktionen über einen freigegebenen MCP-Client steuern.')} ${window.renderMcpSettings ? window.renderMcpSettings() : ''} -
- Erlaubt nur lesenden Zugriff auf Logs, Queue-Status und bereinigte Einstellungen. Passwörter, API-Keys und Tokens werden maskiert. Bildschirm und Eingabesteuerung bleiben gesperrt. Der Verbindungs-Code ist ein Zugangsschlüssel — nur mit vertrauenswürdigen Stellen teilen; bei Verdacht „Neu" klicken. Standard-Bindung ist 127.0.0.1 und damit nur über einen SSH- oder VPN-Tunnel erreichbar.
-
0.0.0.0. Nur IPs/CIDRs aus der Allowlist dürfen verbinden (Loopback immer) — zusätzlich zum Token. Über Tailscale: trage deinen Tailnet-Bereich ein (z.B. 100.64.0.0/10) und die Tailscale-IP/MagicDNS oben als Code-Adresse. Transport ist plaintext über den Tunnel — Tailscale/WireGuard verschlüsselt.'
- : 'Bindet nur an 127.0.0.1. Fernzugriff nur über einen Tunnel (z.B. Tailscale/SSH) — die sicherste Variante.';
- const hosts = Array.isArray(suggestedHosts) ? suggestedHosts : [];
- if (hosts.length) {
- suggestRow.style.display = '';
- suggestChips.innerHTML = '';
- for (const h of hosts) {
- const b = document.createElement('button');
- b.className = 'btn btn-xs btn-secondary';
- b.textContent = h;
- b.addEventListener('click', () => { diagnosticsEditedFields.add(publicHostEl.id); publicHostEl.value = h; markSettingsDirty(); });
- suggestChips.appendChild(b);
- }
- } else {
- suggestRow.style.display = 'none';
- }
- };
- let lastSuggested = [];
- const applySettings = (s) => {
- if (!s) return;
- if (!diagnosticsEditedFields.has(enabledEl.id)) enabledEl.checked = !!s.enabled;
- if (!diagnosticsEditedFields.has(portEl.id)) portEl.value = s.port || 9110;
- if (!diagnosticsEditedFields.has(modeEl.id)) modeEl.value = s.bindMode === 'network' ? 'network' : 'local';
- if (!diagnosticsEditedFields.has(publicHostEl.id)) publicHostEl.value = s.publicHost || '';
- if (!diagnosticsEditedFields.has(allowlistEl.id)) allowlistEl.value = Array.isArray(s.allowlist) ? s.allowlist.join('\n') : '';
- lastSuggested = Array.isArray(s.suggestedHosts) ? s.suggestedHosts : [];
- codeEl.value = s.code || '';
- issuedEl.textContent = fmtIssued(s.codeIssuedAt);
- renderModeUi(lastSuggested);
- if (badgeEl) {
- badgeEl.textContent = enabledEl.checked ? 'Aktiv' : 'Inaktiv';
- badgeEl.className = 'panel-status' + (enabledEl.checked ? ' active' : '');
- }
- };
- const refreshStatus = () => {
- window.api.diagnosticsStatus().then((st) => {
- const el = document.getElementById('diagConnectionStatus');
- if (!el || !st) return;
- if (st.running) {
- const last = st.lastAccess ? new Date(st.lastAccess).toLocaleString(getUiLocale()) : '—';
- const scope = st.bindMode === 'network' ? `Netzwerk (Allowlist: ${st.allowlistCount})` : 'nur lokal';
- el.textContent = `Aktiv auf ${st.bindAddress}:${st.port} (${scope}) — ${st.clientCount} ${st.clientCount === 1 ? 'Client' : 'Clients'} — Letzter Zugriff: ${last}`;
- el.style.color = '#10b981';
- } else {
- el.textContent = 'Nicht aktiv';
- el.style.color = '#94a3b8';
- }
- }).catch(() => {});
- };
- const validate = () => {
- const allowlist = parseAllowlist();
- if (enabledEl.checked && modeEl.value === 'network' && allowlist.length === 0) {
- if (bindHintEl) { bindHintEl.innerHTML = 'Netzwerkmodus braucht mindestens eine IP/CIDR in der Allowlist — sonst bleibt es fail-closed auf Loopback.'; }
- return false;
- }
- return true;
- };
-
- [enabledEl, portEl, modeEl, publicHostEl, allowlistEl].forEach(element => {
- const markEdited = () => diagnosticsEditedFields.add(element.id);
- element.addEventListener('input', markEdited);
- element.addEventListener('change', markEdited);
- });
- window.api.diagnosticsGetSettings().then(applySettings).catch(() => {});
- refreshStatus();
-
- enabledEl.addEventListener('change', () => { if (validate()) markSettingsDirty(); });
- portEl.addEventListener('change', () => { if (validate()) markSettingsDirty(); });
- modeEl.addEventListener('change', () => { renderModeUi(lastSuggested); if (validate()) markSettingsDirty(); });
- publicHostEl.addEventListener('change', () => { if (validate()) markSettingsDirty(); });
- allowlistEl.addEventListener('change', () => { if (validate()) markSettingsDirty(); });
- document.getElementById('diagCopyCodeBtn').addEventListener('click', async () => {
- if (!codeEl.value) return;
- await window.api.copyToClipboard(codeEl.value);
- const b = document.getElementById('diagCopyCodeBtn');
- b.textContent = 'Kopiert!';
- setTimeout(() => { b.textContent = 'Kopieren'; }, 1500);
- });
- document.getElementById('diagRegenerateBtn').addEventListener('click', async () => {
- const confirmed = await showAppConfirm({ title: 'Verbindungs-Code neu erzeugen?', message: 'Der bisherige Diagnose-Code wird sofort ungültig.', confirmText: 'Neu erzeugen', danger: true });
- if (!confirmed) return;
- const r = await runConfigWrite(() => window.api.diagnosticsRegenerate());
- if (r && r.code) { codeEl.value = r.code; issuedEl.textContent = fmtIssued(r.codeIssuedAt); }
- refreshStatus();
- });
- })();
document.getElementById('exportBackupBtn').addEventListener('click', () => doBackupExport());
document.getElementById('importBackupBtn').addEventListener('click', () => doBackupImport());
@@ -7677,7 +7434,6 @@ async function performSaveSettings(options = {}) {
const newHosterSettings = { ...(config.hosterSettings || {}) };
const cur = config.globalSettings || {};
const curFm = cur.folderMonitor || {};
- const curRemote = cur.remote || {};
const elTxt = (id, fb) => { const el = document.getElementById(id); return el ? el.value : fb; };
const elChk = (id, fb) => { const el = document.getElementById(id); return el ? !!el.checked : fb; };
const elInt = (id, curVal, dflt, lo, hi) => {
@@ -7738,13 +7494,6 @@ async function performSaveSettings(options = {}) {
hosters: document.querySelector('.fm-hoster-checkbox')
? Array.from(document.querySelectorAll('.fm-hoster-checkbox:checked')).map(el => el.dataset.fmHoster)
: (curFm.hosters || [])
- },
- remote: {
- ...curRemote,
- enabled: elChk('remoteEnabledInput', !!curRemote.enabled),
- port: elInt('remotePortInput', curRemote.port || 9100, 9100, 1024, 65535),
- token: elTxt('remoteTokenInput', curRemote.token || '').trim(),
- allowInput: elChk('remoteAllowInputInput', curRemote.allowInput !== false)
}
};
@@ -7781,16 +7530,7 @@ async function performSaveSettings(options = {}) {
saveHosterSettingsTracked(newHosterSettings),
saveGlobalSettingsTracked(globalSettings)
];
- const diagnosticsEnabled = document.getElementById('diagEnabledInput');
- if (diagnosticsEnabled) {
- saves.push(saveDiagnosticsSettingsTracked({
- enabled: diagnosticsEnabled.checked,
- port: Math.min(65535, Math.max(1024, parseInt(document.getElementById('diagPortInput')?.value, 10) || 9110)),
- bindMode: document.getElementById('diagBindModeInput')?.value === 'network' ? 'network' : 'local',
- publicHost: document.getElementById('diagPublicHostInput')?.value.trim() || '',
- allowlist: (document.getElementById('diagAllowlistInput')?.value || '').split(/\r?\n/).map(value => value.trim()).filter(Boolean)
- }));
- }
+
await Promise.all(saves);
config.hosterSettings = newHosterSettings;
config.globalSettings = globalSettings;
@@ -7824,42 +7564,6 @@ async function performSaveSettings(options = {}) {
try { await refreshAutomationRuntimeStatus(); } catch {}
refreshAutomationControlCenter();
- // Start/stop remote server based on settings
- const remoteSettings = globalSettings.remote;
- const remoteBadge = document.getElementById('remoteStatusBadge');
- if (remoteSettings) {
- try {
- const remoteSaveResult = await saveRemoteSettingsTracked(remoteSettings);
- if (remoteSaveResult && remoteSaveResult.settings) {
- globalSettings.remote = { ...remoteSaveResult.settings };
- config.globalSettings = { ...(config.globalSettings || {}), remote: { ...remoteSaveResult.settings } };
- const tokenInput = document.getElementById('remoteTokenInput');
- if (tokenInput) tokenInput.value = remoteSaveResult.settings.token || '';
- }
- if (remoteSaveResult && remoteSaveResult.runtimeError) throw new Error(remoteSaveResult.runtimeError);
- if (remoteBadge) {
- remoteBadge.textContent = remoteSettings.enabled ? 'Aktiv' : 'Inaktiv';
- remoteBadge.className = `panel-status${remoteSettings.enabled ? ' active' : ''}`;
- }
- // Update status display
- const status = await window.api.remoteStatus();
- const statusEl = document.getElementById('remoteConnectionStatus');
- if (statusEl) {
- if (status.running) {
- statusEl.textContent = formatRemoteClientStatus(status.port, status.clientCount);
- statusEl.style.color = '#10b981';
- } else {
- statusEl.textContent = 'Nicht aktiv';
- statusEl.style.color = '#94a3b8';
- }
- }
- } catch {
- if (remoteBadge) {
- remoteBadge.textContent = 'Fehler';
- remoteBadge.className = 'panel-status';
- }
- }
- }
const feedback = document.getElementById('saveFeedback');
if (feedback) feedback.textContent = feedbackText;
diff --git a/renderer/i18n.js b/renderer/i18n.js
index a26a178..cd0a21d 100644
--- a/renderer/i18n.js
+++ b/renderer/i18n.js
@@ -4,6 +4,8 @@
if (root) root.I18n = api;
})(typeof window !== 'undefined' ? window : globalThis, function () {
const pairs = [
+ ['MCP-Fernzugriff', 'MCP remote access'],
+ ['App-Funktionen über einen freigegebenen MCP-Client steuern.', 'Control app functions through an authorized MCP client.'],
['Strukturierter Fernzugriff über HTTPS. Nur bei laufender Anwendung; keine Portfreigabe erforderlich. Berechtigungen werden ausschließlich hier vergeben.', 'Structured remote access over HTTPS. Available while the app is running; no inbound port required. Permissions can only be granted here.'],
['Installationsname', 'Installation name'],
['Lokale Berechtigungen', 'Local permissions'],
diff --git a/renderer/mcp.js b/renderer/mcp.js
index 9ded0ee..dff7da4 100644
--- a/renderer/mcp.js
+++ b/renderer/mcp.js
@@ -19,10 +19,10 @@
return jobs;
};
const handlers = {
- state: async () => ({ uploading, queueCount: queueJobs.length, selectedFileCount: selectedFiles.length, counts: queueJobs.reduce((out, job) => { out[job.status] = (out[job.status] || 0) + 1; return out; }, {}) }),
+ state: async () => ({ source: 'live', stale: false, uploading, queueCount: queueJobs.length, selectedFileCount: selectedFiles.length, selectedHosters: getSelectedHosters(), counts: queueJobs.reduce((out, job) => { out[job.status] = (out[job.status] || 0) + 1; return out; }, {}) }),
refresh,
'account-results': async args => { for (const row of args.results) { if (findAccountById(row.accountId)) accountStatuses[row.accountId] = { status: row.status, message: row.message, storage: row.storage, checkedAt: row.checkedAt || new Date().toISOString() }; } renderAccounts(); return { updated: args.results.length }; },
- 'queue-list': async args => page(queueJobs.filter(job => !args.status || job.status === args.status).map(job => ({ id: job.id, fileName: job.fileName, hoster: job.hoster, status: job.status, bytesUploaded: job.bytesUploaded, bytesTotal: job.bytesTotal, speedKbs: job.speedKbs, error: job.error, result: job.result, attempt: job.attempt })), args),
+ 'queue-list': async args => page(queueJobs.filter(job => !args.status || job.status === args.status).map(job => ({ id: job.id, file: job.file, fileName: job.fileName, hoster: job.hoster, status: job.status, bytesUploaded: job.bytesUploaded, bytesTotal: job.bytesTotal, speedKbs: job.speedKbs, error: job.error, result: job.result, attempt: job.attempt })), args),
'queue-add': async (args, guard) => {
const inspection = await window.api.inspectImportFiles(args.paths, existingImportPaths());
await guard();