diff --git a/renderer/app.js b/renderer/app.js index 2e7ef69..f05e842 100644 --- a/renderer/app.js +++ b/renderer/app.js @@ -7387,7 +7387,13 @@ function syncSettingsSaveState(message) { button.classList.toggle('btn-success', settingsDirty && !settingsSaving); button.classList.toggle('btn-secondary', !settingsDirty || settingsSaving); } - if (feedback && message) feedback.textContent = message; + if (feedback) { + if (message) feedback.dataset.settingsMessage = message; + const mcp = window.getMcpSettingsSaveState?.(); + feedback.textContent = mcp?.saving ? 'MCP-Einstellungen werden gespeichert…' + : mcp?.dirty ? 'MCP-Änderungen noch nicht gespeichert' + : feedback.dataset.settingsMessage || 'Keine ungespeicherten Änderungen'; + } } function establishSettingsBaseline(message = 'Keine ungespeicherten Änderungen') { diff --git a/renderer/i18n.js b/renderer/i18n.js index b015459..9cf1ef1 100644 --- a/renderer/i18n.js +++ b/renderer/i18n.js @@ -5,6 +5,38 @@ })(typeof window !== 'undefined' ? window : globalThis, function () { const pairs = [ ['MCP-Fernzugriff', 'MCP remote access'], + ['MCP-Einstellungen werden gespeichert…', 'Saving MCP settings…'], + ['MCP-Änderungen noch nicht gespeichert', 'MCP changes have not been saved yet'], + ['Wird gespeichert…', 'Saving…'], + ['Änderungen speichern', 'Save changes'], + ['Änderungen werden übernommen.', 'Applying changes.'], + ['Änderungen noch nicht gespeichert.', 'Changes have not been saved yet.'], + ['Alle Einstellungen gespeichert.', 'All settings saved.'], + ['Erst speichern und aktivieren, dann den Verbindungscode kopieren.', 'Save and enable first, then copy the connection code.'], + ['Fernzugriff ist ausgeschaltet. Berechtigungen auswählen und mit „Speichern und aktivieren“ übernehmen.', 'Remote access is off. Select permissions and choose “Save and enable”.'], + ['Fernzugriff ist aktiv. Den Verbindungscode im MCP-Client hinterlegen.', 'Remote access is enabled. Add the connection code to your MCP client.'], + ['Einstellungen gespeichert. Die Verbindung wird hergestellt.', 'Settings saved. Establishing the connection.'], + ['Einstellungen gespeichert. Die Verbindung wird automatisch erneut versucht.', 'Settings saved. The connection will be retried automatically.'], + ['Der Zugang wurde abgelehnt. Zugang erneuern und den neuen Code im Client hinterlegen.', 'Access was rejected. Rotate access and add the new code to the client.'], + ['Die gespeicherten Zugangsdaten sind nicht lesbar. Lokalen Zugangsdaten-Speicher prüfen.', 'The saved credentials cannot be read. Check local credential storage.'], + ['Die Registrierung ist fehlgeschlagen. Verbindung prüfen und erneut aktivieren.', 'Registration failed. Check the connection and enable access again.'], + ['Status nicht verfügbar', 'Status unavailable'], + ['Der Verbindungsstatus wird geladen.', 'Loading the connection status.'], + ['Verbindung', 'Connection'], + ['Den Code auf diesem Gerät kopieren und im MCP-Client hinterlegen. Er gilt nur für diese Installation.', 'Copy the code on this device and add it to your MCP client. It applies only to this installation.'], + ['Einrichtung und Berechtigungen', 'Setup and permissions'], + ['Name und Berechtigungen auswählen. Änderungen werden erst mit dem Speichern wirksam.', 'Choose a name and permissions. Changes take effect only when saved.'], + ['Status, Uploads, Protokolle und Diagnose lesen.', 'Read status, uploads, logs and diagnostics.'], + ['Uploads und Konten verwalten. Kritische Aktionen lokal bestätigen.', 'Manage uploads and accounts. Confirm critical actions locally.'], + ['Auf ausgewählte Ordner zugreifen. Dateiinhalte separat freigeben.', 'Access selected directories. Allow file contents separately.'], + ['App-Updates installieren', 'Install app updates'], + ['Geprüfte Updates ohne erneute Bestätigung installieren. Uploads abschließen und danach fortsetzen. Keine Portable-Versionen.', 'Install verified updates without another confirmation. Finish uploads and resume afterwards. No portable versions.'], + ['Zugangsdaten auslesen', 'Reveal credentials'], + ['Gespeicherte Zugangsdaten ausdrücklich freigeben. Zusätzliche lokale Bestätigung erforderlich.', 'Explicitly allow saved credentials to be read. Additional local confirmation required.'], + ['Ordnerfreigaben', 'Directory access'], + ['Keine Ordner freigegeben.', 'No directories granted.'], + ['Zugang verwalten', 'Manage access'], + ['Zugang erneuern macht den bisherigen Code ungültig. Deaktivieren beendet den Fernzugriff und widerruft den Zugang.', 'Rotating access invalidates the previous code. Disabling remote access revokes access.'], ['Offizielle App-Updates ohne erneute Bestätigung erlauben', 'Allow official app updates without another confirmation'], ['Standardmäßig aus. Gilt nur für geprüfte Installer einer exakt angeforderten Version. Laufende Uploads werden abgeschlossen und die Warteschlange nach dem Neustart wieder aufgenommen. Portable-Versionen werden nicht unterstützt.', 'Disabled by default. Limited to verified installers of the exact requested version. Running uploads finish and the queue resumes after restart. Portable versions are not supported.'], ['MCP-Update wird vorbereitet', 'MCP update is being prepared'], diff --git a/renderer/mcp.css b/renderer/mcp.css index 7ebbcc6..65fe859 100644 --- a/renderer/mcp.css +++ b/renderer/mcp.css @@ -1,16 +1,58 @@ -.mcp-controls { margin-bottom: 28px; font-size: 13px; } -.mcp-controls p { line-height: 1.6; overflow-wrap: anywhere; } -.mcp-controls .settings-row input { min-width: 0; flex: 1; } -.mcp-permissions { display: flex; flex-wrap: wrap; gap: 16px 24px; border: 1px solid var(--border, #424242); border-radius: 6px; padding: 16px; margin: 16px 0; } -.mcp-permissions label, .mcp-grant label { display: flex; align-items: center; gap: 6px; } -.mcp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; } -.mcp-actions .btn { white-space: normal; } -.mcp-status { display: flex; flex-wrap: wrap; gap: 18px 32px; border: 1px solid var(--border, #424242); border-radius: 6px; padding: 16px; } -.mcp-status dt { margin-bottom: 8px; } -.mcp-status dd { margin: 0; font-weight: 600; } -.mcp-state { padding: 5px 8px; border: 1px solid var(--border, #555); border-radius: 5px; } -.mcp-state.connected { color: #a2edc1; background: #193829; border-color: #46735b; } -.mcp-grant { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border, #424242); } -.mcp-grant > span { flex: 1 1 220px; overflow-wrap: anywhere; } -.mcp-update-permission { display: flex; align-items: flex-start; gap: 8px; margin-top: 20px; font-size: 13px; line-height: 1.6; } -.mcp-update-permission input { flex: 0 0 auto; margin-top: 4px; } +.mcp-controls { display: grid; gap: 18px; margin-bottom: 28px; font-size: 13px; container-type: inline-size; } +.mcp-controls p { margin: 0; line-height: 1.6; color: var(--text-muted); overflow-wrap: anywhere; } +.mcp-card { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); } +.mcp-card-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; } +.mcp-card h4 { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.4; } +.mcp-state { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-raised); font-size: 12px; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; } +.mcp-state::before { content: ''; flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: currentColor; } +.mcp-state[data-state="online"] { color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, var(--border)); background: color-mix(in srgb, var(--success) 8%, var(--bg-card)); } +.mcp-state:is([data-state="offline"], [data-state="connecting"]) { color: var(--warning); } +.mcp-state:is([data-state="blocked"], [data-state="storage-error"], [data-state="enrollment-error"]) { color: var(--danger); } +.mcp-status { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); gap: 16px; margin: 18px 0; padding: 16px 0; border-block: 1px solid var(--border); } +.mcp-status > div { min-width: 0; } +.mcp-status dt { margin-bottom: 6px; font-size: 12px; color: var(--text-muted); } +.mcp-status dd { margin: 0; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; } +.mcp-code-row, .mcp-save-row { display: flex; align-items: center; gap: 16px; justify-content: space-between; } +.mcp-code-row p { flex: 1 1 260px; } +.mcp-controls .btn { min-height: 36px; max-width: 100%; flex-shrink: 0; font-size: 13px; white-space: normal; line-height: 1.4; } +.mcp-name-row { display: grid; grid-template-columns: minmax(130px, 0.6fr) minmax(0, 1fr); align-items: center; gap: 12px; margin: 20px 0; } +.mcp-name-row label { font-size: 14px; font-weight: 600; } +.mcp-name-row input { min-width: 0; width: 100%; } +.mcp-permissions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0; margin: 0; min-width: 0; border: 0; } +.mcp-permissions legend { margin-bottom: 10px; padding: 0; font-size: 13px; font-weight: 600; } +.mcp-permission { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 13px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-input); cursor: pointer; } +.mcp-permission:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); background: color-mix(in srgb, var(--accent) 6%, var(--bg-input)); } +.mcp-permission:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; } +.mcp-permission > span { min-width: 0; } +.mcp-permission strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.45; } +.mcp-permission-description { display: block; margin-top: 5px; color: var(--text-muted); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; } +.mcp-permission-sensitive { grid-column: 1 / -1; } +.mcp-controls input[type="checkbox"] { width: 16px; height: 16px; margin: 3px 0 0; flex: 0 0 auto; accent-color: var(--accent); } +.mcp-save-row { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); } +.mcp-save-row p { font-size: 12px; } +.mcp-save-row p.pending { color: var(--warning); } +.mcp-grant { min-width: 0; margin-top: 14px; padding: 14px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; } +#mcpControls .mcp-grant-path { color: var(--text); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; user-select: text; } +.mcp-grant-options { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 12px; } +.mcp-grant label { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; line-height: 1.5; cursor: pointer; } +.mcp-grant-options .btn { margin-left: auto; } +.mcp-controls .mcp-empty { margin-top: 14px; padding: 18px; border: 1px dashed var(--border); border-radius: 6px; text-align: center; } +.mcp-empty[hidden] { display: none; } +.mcp-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; } +.mcp-card > p + p { margin-top: 10px; } +.mcp-controls .mcp-footnote { padding: 0 2px; font-size: 12px; } +@container (max-width: 550px) { + .mcp-card { padding: 16px; } + .mcp-status { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } + .mcp-status > div:first-child { grid-column: 1 / -1; } + .mcp-code-row, .mcp-save-row { align-items: stretch; flex-direction: column; gap: 12px; } + .mcp-code-row p { flex: auto; } + .mcp-permissions { grid-template-columns: minmax(0, 1fr); } + .mcp-permission-sensitive { grid-column: auto; } +} +@container (max-width: 360px) { + .mcp-name-row { grid-template-columns: minmax(0, 1fr); gap: 8px; } + .mcp-card-heading { align-items: flex-start; flex-direction: column; } + .mcp-grant-options { align-items: flex-start; flex-direction: column; } + .mcp-grant-options .btn { margin-left: 0; } +} diff --git a/renderer/mcp.js b/renderer/mcp.js index 0202983..44486d0 100644 --- a/renderer/mcp.js +++ b/renderer/mcp.js @@ -96,64 +96,154 @@ finally { cancelled.delete(request.id); } }); let current = null; - const renderStatus = state => { - current = state; + let busy = false; + let saving = false; + const configuration = area => ({ + enabled: true, + name: area.querySelector('#mcpName').value.trim(), + capabilities: [...area.querySelectorAll('.mcp-permissions input:checked')].map(input => input.value) + }); + const hasChanges = (area, state) => { + if (!state) return false; + const draft = configuration(area); + return draft.name !== (state.name || 'Multi-Hoster-Uploader') + || draft.capabilities.slice().sort().join('|') !== (state.capabilities || []).slice().sort().join('|'); + }; + const syncConfiguration = (area, state) => { + area.querySelector('#mcpName').value = state.name || 'Multi-Hoster-Uploader'; + for (const input of area.querySelectorAll('.mcp-permissions input')) input.checked = state.capabilities?.includes(input.value) === true; + }; + window.getMcpSettingsSaveState = () => { + const area = document.getElementById('mcpControls'); + return { dirty: !!area && hasChanges(area, current), saving }; + }; + const refreshControls = () => { const area = document.getElementById('mcpControls'); if (!area) return; + const ready = current?.available !== false && current?.connection !== 'starting' && !!current; + const dirty = hasChanges(area, current); + area.setAttribute('aria-busy', String(busy)); + for (const input of area.querySelectorAll('input')) input.disabled = busy || !ready; + const enable = area.querySelector('[data-mcp-action="enable"]'); + enable.disabled = busy || !ready || (current?.enabled && !dirty && ['online', 'connecting'].includes(current.connection)); + enable.textContent = saving ? text('Wird gespeichert…', 'Saving…') : current?.enabled ? text('Änderungen speichern', 'Save changes') : text('Speichern und aktivieren', 'Save and enable'); + area.querySelector('[data-mcp-save-state]').textContent = saving ? text('Änderungen werden übernommen.', 'Applying changes.') + : dirty ? text('Änderungen noch nicht gespeichert.', 'Changes have not been saved yet.') + : current?.enabled ? text('Alle Einstellungen gespeichert.', 'All settings saved.') + : text('Erst speichern und aktivieren, dann den Verbindungscode kopieren.', 'Save and enable first, then copy the connection code.'); + area.querySelector('[data-mcp-save-state]').classList.toggle('pending', dirty); + area.querySelector('[data-mcp-action="copy"]').disabled = busy || !current?.enabled || !current?.installationId; + area.querySelector('[data-mcp-action="rotate"]').disabled = busy || !current?.enabled; + area.querySelector('[data-mcp-action="disable"]').disabled = busy || (!current?.enabled && !current?.installationId); + area.querySelector('[data-mcp-action="grant"]').disabled = busy || !ready; + for (const button of area.querySelectorAll('.mcp-grant button')) button.disabled = busy || !ready; + window.syncSettingsSaveState?.(); + }; + const renderStatus = (state, resetDraft = false) => { + const area = document.getElementById('mcpControls'); + if (!area) { current = state; return; } + const preserveDraft = !resetDraft && hasChanges(area, current); + current = state; + if (!preserveDraft) syncConfiguration(area, state); const states = { disabled: text('Deaktiviert', 'Disabled'), connecting: text('Verbindung wird hergestellt', 'Connecting'), online: text('Verbunden', 'Connected'), offline: text('Nicht verbunden – erneuter Versuch', 'Offline – retrying'), blocked: text('Zugang abgelehnt', 'Access rejected'), 'storage-error': text('Zugangsdaten nicht lesbar', 'Credentials unavailable'), 'enrollment-error': text('Registrierung fehlgeschlagen', 'Enrollment failed'), starting: text('Wird geladen', 'Loading') }; - area.querySelector('[data-mcp-status]').textContent = states[state.connection] || state.connection; - area.querySelector('[data-mcp-status]').className = `mcp-state ${state.connection === 'online' ? 'connected' : ''}`; + const descriptions = { + disabled: text('Fernzugriff ist ausgeschaltet. Berechtigungen auswählen und mit „Speichern und aktivieren“ übernehmen.', 'Remote access is off. Select permissions and choose “Save and enable”.'), + online: text('Fernzugriff ist aktiv. Den Verbindungscode im MCP-Client hinterlegen.', 'Remote access is enabled. Add the connection code to your MCP client.'), + connecting: text('Einstellungen gespeichert. Die Verbindung wird hergestellt.', 'Settings saved. Establishing the connection.'), + offline: text('Einstellungen gespeichert. Die Verbindung wird automatisch erneut versucht.', 'Settings saved. The connection will be retried automatically.'), + blocked: text('Der Zugang wurde abgelehnt. Zugang erneuern und den neuen Code im Client hinterlegen.', 'Access was rejected. Rotate access and add the new code to the client.'), + 'storage-error': text('Die gespeicherten Zugangsdaten sind nicht lesbar. Lokalen Zugangsdaten-Speicher prüfen.', 'The saved credentials cannot be read. Check local credential storage.'), + 'enrollment-error': text('Die Registrierung ist fehlgeschlagen. Verbindung prüfen und erneut aktivieren.', 'Registration failed. Check the connection and enable access again.') + }; + const status = area.querySelector('[data-mcp-status]'); + status.textContent = states[state.connection] || text('Status nicht verfügbar', 'Status unavailable'); + status.dataset.state = state.connection || 'starting'; + area.querySelector('[data-mcp-summary]').textContent = descriptions[state.connection] || text('Der Verbindungsstatus wird geladen.', 'Loading the connection status.'); area.querySelector('[data-mcp-contact]').textContent = state.lastContact ? new Date(state.lastContact).toLocaleString(getUiLocale()) : '—'; area.querySelector('[data-mcp-pending]').textContent = Number(state.pendingRevocations || 0).toLocaleString(getUiLocale()); - for (const action of ['copy', 'rotate']) area.querySelector(`[data-mcp-action="${action}"]`).disabled = !state.enabled; - area.querySelector('[data-mcp-action="disable"]').disabled = !state.enabled && !state.installationId; - area.querySelector('[data-mcp-grants]').replaceChildren(...(state.grants || []).map(grant => { - const row = document.createElement('div'); row.className = 'mcp-grant'; - const name = document.createElement('span'); name.textContent = grant.path; - const label = document.createElement('label'); const checkbox = document.createElement('input'); checkbox.type = 'checkbox'; checkbox.checked = !grant.readOnly; - label.append(checkbox, text(' Schreibzugriff', ' Write access')); - checkbox.onchange = () => act(() => window.api.mcpUpdateGrant({ id: grant.id, remove: false, readOnly: !checkbox.checked, allowTransfer: grant.allowTransfer === true })); - const transferLabel = document.createElement('label'); const transfer = document.createElement('input'); transfer.type = 'checkbox'; transfer.checked = grant.allowTransfer === true; - transferLabel.append(transfer, text(' Dateiinhalte übertragen', ' Transfer file contents')); - transfer.onchange = () => act(() => window.api.mcpUpdateGrant({ id: grant.id, remove: false, readOnly: grant.readOnly, allowTransfer: transfer.checked })); - const remove = document.createElement('button'); remove.type = 'button'; remove.className = 'btn btn-sm btn-secondary'; remove.textContent = text('Entfernen', 'Remove'); - remove.onclick = () => act(() => window.api.mcpUpdateGrant({ id: grant.id, remove: true, readOnly: true })); - row.append(name, label, transferLabel, remove); return row; - })); + area.querySelector('[data-mcp-grant-count]').textContent = Number(state.grants?.length || 0).toLocaleString(getUiLocale()); + const grants = area.querySelector('[data-mcp-grants]'); + const grantIds = JSON.stringify(state.grants || []); + if (grants.dataset.snapshot !== grantIds) { + grants.dataset.snapshot = grantIds; + grants.replaceChildren(...(state.grants || []).map(grant => { + const row = document.createElement('div'); row.className = 'mcp-grant'; + const name = document.createElement('p'); name.className = 'mcp-grant-path'; name.textContent = grant.path; + const options = document.createElement('div'); options.className = 'mcp-grant-options'; + const label = document.createElement('label'); const checkbox = document.createElement('input'); checkbox.type = 'checkbox'; checkbox.checked = !grant.readOnly; + label.append(checkbox, text(' Schreibzugriff', ' Write access')); + checkbox.onchange = () => act(() => window.api.mcpUpdateGrant({ id: grant.id, remove: false, readOnly: !checkbox.checked, allowTransfer: grant.allowTransfer === true })); + const transferLabel = document.createElement('label'); const transfer = document.createElement('input'); transfer.type = 'checkbox'; transfer.checked = grant.allowTransfer === true; + transferLabel.append(transfer, text(' Dateiinhalte übertragen', ' Transfer file contents')); + transfer.onchange = () => act(() => window.api.mcpUpdateGrant({ id: grant.id, remove: false, readOnly: grant.readOnly, allowTransfer: transfer.checked })); + const remove = document.createElement('button'); remove.type = 'button'; remove.className = 'btn btn-sm btn-secondary'; remove.textContent = text('Entfernen', 'Remove'); + remove.onclick = () => act(() => window.api.mcpUpdateGrant({ id: grant.id, remove: true, readOnly: true })); + options.append(label, transferLabel, remove); row.append(name, options); return row; + })); + } + for (const [index, grant] of (state.grants || []).entries()) { + const inputs = grants.children[index]?.querySelectorAll('input'); + if (inputs) { inputs[0].checked = !grant.readOnly; inputs[1].checked = grant.allowTransfer === true; } + } + area.querySelector('[data-mcp-grants-empty]').hidden = !!state.grants?.length; + refreshControls(); }; - const syncPermissions = state => { - for (const input of document.querySelectorAll('#mcpControls .mcp-permissions input, #mcpControls [data-mcp-updates]')) input.checked = state?.capabilities?.includes(input.value) === true; - }; - const act = async action => { - try { const state = await action(); if (state && typeof state === 'object') { renderStatus(state); syncPermissions(state); } } - catch { showCopyToast(text('MCP-Aktion fehlgeschlagen. Verbindung und lokale Berechtigungen prüfen.', 'MCP action failed. Check connection and local permissions.'), 6000, 'error'); if (current) { renderStatus(current); syncPermissions(current); } } + const act = async (action, resetDraft = false) => { + if (busy) return; + busy = true; + saving = resetDraft; + refreshControls(); + try { + const state = await action(); + if (state && typeof state === 'object') renderStatus(state, resetDraft); + } catch { + showCopyToast(text('MCP-Aktion fehlgeschlagen. Verbindung und lokale Berechtigungen prüfen.', 'MCP action failed. Check connection and local permissions.'), 6000, 'error'); + if (current) renderStatus(current); + } finally { busy = false; saving = false; refreshControls(); } }; window.renderMcpSettings = () => `
-
MCP
-

${text('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.')}

-
-
${text('Lokale Berechtigungen', 'Local permissions')}${[['read','Lesen und Diagnose','Read and diagnostics'],['control','App steuern','Control app'],['files','Freigegebene Ordner','Granted directories'],['secrets','Zugangsdaten explizit auslesen','Explicitly reveal secrets']].map(([value,de,en])=>``).join('')}
-
-
Status
—
${text('Letzter Kontakt','Last contact')}
—
${text('Ausstehende Widerrufe','Pending revocations')}
0
-

${text('Der Verbindungscode ist ein Zugangsschlüssel. Er wird weder im Backup gespeichert noch auf andere Installationen übertragen. Löschungen und andere gefährliche Aktionen verlangen eine lokale Bestätigung.', 'The connection code is a credential. It is not stored in backups or transferred to other installations. Deletions and other dangerous actions require local confirmation.')}

-
-

${text('Dateiinhalte werden nur nach zusätzlicher Freigabe pro Ordner übertragen. Bestehende Ordnerfreigaben erlauben dies nicht automatisch.', 'File contents are transferred only after additional permission for each directory. Existing directory grants do not allow this automatically.')}

- -

${text('Standardmäßig aus. Gilt nur für geprüfte Installer einer exakt angeforderten Version. Laufende Uploads werden abgeschlossen und die Warteschlange nach dem Neustart wieder aufgenommen. Portable-Versionen werden nicht unterstützt.', 'Disabled by default. Limited to verified installers of the exact requested version. Running uploads finish and the queue resumes after restart. Portable versions are not supported.')}

+
+

${text('Verbindung', 'Connection')}

${text('Wird geladen', 'Loading')}
+

${text('Der Verbindungsstatus wird geladen.', 'Loading the connection status.')}

+
${text('Letzter Kontakt','Last contact')}
—
${text('Freigegebene Ordner','Granted directories')}
0
${text('Ausstehende Widerrufe','Pending revocations')}
0
+

${text('Den Code auf diesem Gerät kopieren und im MCP-Client hinterlegen. Er gilt nur für diese Installation.', 'Copy the code on this device and add it to your MCP client. It applies only to this installation.')}

+
+
+

${text('Einrichtung und Berechtigungen', 'Setup and permissions')}

+

${text('Name und Berechtigungen auswählen. Änderungen werden erst mit dem Speichern wirksam.', 'Choose a name and permissions. Changes take effect only when saved.')}

+
+
${text('Lokale Berechtigungen', 'Local permissions')}${[ + ['read','Lesen und Diagnose','Read and diagnostics','Status, Uploads, Protokolle und Diagnose lesen.','Read status, uploads, logs and diagnostics.'], + ['control','App steuern','Control app','Uploads und Konten verwalten. Kritische Aktionen lokal bestätigen.','Manage uploads and accounts. Confirm critical actions locally.'], + ['files','Freigegebene Ordner','Granted directories','Auf ausgewählte Ordner zugreifen. Dateiinhalte separat freigeben.','Access selected directories. Allow file contents separately.'], + ['updates','App-Updates installieren','Install app updates','Geprüfte Updates ohne erneute Bestätigung installieren. Uploads abschließen und danach fortsetzen. Keine Portable-Versionen.','Install verified updates without another confirmation. Finish uploads and resume afterwards. No portable versions.'], + ['secrets','Zugangsdaten auslesen','Reveal credentials','Gespeicherte Zugangsdaten ausdrücklich freigeben. Zusätzliche lokale Bestätigung erforderlich.','Explicitly allow saved credentials to be read. Additional local confirmation required.'] + ].map(([value,de,en,description,englishDescription])=>``).join('')}
+

${text('Erst speichern und aktivieren, dann den Verbindungscode kopieren.', 'Save and enable first, then copy the connection code.')}

+
+
+

${text('Ordnerfreigaben', 'Directory access')}

+

${text('Dateiinhalte werden nur nach zusätzlicher Freigabe pro Ordner übertragen. Bestehende Ordnerfreigaben erlauben dies nicht automatisch.', 'File contents are transferred only after additional permission for each directory. Existing directory grants do not allow this automatically.')}

+

${text('Keine Ordner freigegeben.', 'No directories granted.')}

+
+
+

${text('Zugang verwalten', 'Manage access')}

+

${text('Der Verbindungscode ist ein Zugangsschlüssel. Er wird weder im Backup gespeichert noch auf andere Installationen übertragen. Löschungen und andere gefährliche Aktionen verlangen eine lokale Bestätigung.', 'The connection code is a credential. It is not stored in backups or transferred to other installations. Deletions and other dangerous actions require local confirmation.')}

+

${text('Zugang erneuern macht den bisherigen Code ungültig. Deaktivieren beendet den Fernzugriff und widerruft den Zugang.', 'Rotating access invalidates the previous code. Disabling remote access revokes access.')}

+
+
+

${text('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.')}

`; window.bindMcpSettings = async () => { const area = document.getElementById('mcpControls'); if (!area) return; - const state = await window.api.mcpStatus(); if (!state) return; - renderStatus(state); - area.querySelector('#mcpName').value = state.name || 'Multi-Hoster-Uploader'; - for (const input of area.querySelectorAll('.mcp-permissions input')) input.checked = state.capabilities?.includes(input.value) === true; - area.querySelector('[data-mcp-updates]').checked = state.capabilities?.includes('updates') === true; - const configuration = enabled => ({ enabled, name: area.querySelector('#mcpName').value.trim(), capabilities: [...area.querySelectorAll('.mcp-permissions input:checked, [data-mcp-updates]:checked')].map(input => input.value) }); - area.querySelector('[data-mcp-action="enable"]').onclick = () => act(() => window.api.mcpConfigure(configuration(true))); - area.querySelector('[data-mcp-action="disable"]').onclick = () => act(() => window.api.mcpConfigure(configuration(false))); + const state = await window.api.mcpStatus(); if (!state || !area.isConnected) return; + renderStatus(state, true); + for (const input of area.querySelectorAll('#mcpName, .mcp-permissions input')) input.addEventListener('input', refreshControls); + area.querySelector('[data-mcp-action="enable"]').onclick = () => act(() => window.api.mcpConfigure(configuration(area)), true); + area.querySelector('[data-mcp-action="disable"]').onclick = () => act(() => window.api.mcpConfigure({ enabled: false, name: current.name, capabilities: current.capabilities })); area.querySelector('[data-mcp-action="rotate"]').onclick = () => act(() => window.api.mcpRotate()); area.querySelector('[data-mcp-action="copy"]').onclick = () => act(async () => { await window.api.mcpCopyCode(); showCopyToast(text('Verbindungscode kopiert.', 'Connection code copied.')); }); area.querySelector('[data-mcp-action="grant"]').onclick = () => act(() => window.api.mcpAddGrant());