Loading admin/static/app.js +40 −0 Changes for admin/static/app.js: 40 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -331,6 +331,44 @@ const ProxyPlusAdmin = (() => { } } async function exportConfig() { document.getElementById("config-import-error").textContent = ""; try { const config = await api("GET", "/api/v1/config/export"); const blob = new Blob([JSON.stringify(config, null, 2)], { type: "application/json" }); const url = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = url; a.download = "proxyplus-config.json"; a.click(); URL.revokeObjectURL(url); } catch (e) { document.getElementById("config-import-error").textContent = e.message; } } async function importConfig() { document.getElementById("config-import-error").textContent = ""; document.getElementById("config-import-result").textContent = ""; try { const file = document.getElementById("config-import-file").files[0]; const text = file ? await file.text() : document.getElementById("config-import-json").value; let config; try { config = JSON.parse(text); } catch (e) { throw new Error("ungueltiges JSON: " + e.message); } const result = await api("POST", "/api/v1/config/import", config); document.getElementById("config-import-result").textContent = result.imported + " Eintraege importiert" + (result.errors && result.errors.length ? "; Fehler: " + result.errors.join("; ") : ""); await refreshAll(); } catch (e) { document.getElementById("config-import-error").textContent = e.message; } } return { login, logout, Loading @@ -344,5 +382,7 @@ const ProxyPlusAdmin = (() => { createDkimKey, showNewPoolForm, createPool, exportConfig, importConfig, }; })(); admin/static/index.html +13 −0 Changes for admin/static/index.html: 13 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -103,6 +103,19 @@ <div id="pool-error" class="error"></div> </div> <h2>Konfiguration Export/Import</h2> <p>Umfasst HTTP-Routen, SMTP-Relays, TLS-Profile (inkl. versiegeltem Schluesselmaterial fuer eigene Zertifikate), Pools und DKIM-Schluessel. Import ergaenzt/ueberschreibt nur die genannten Einträge, loescht nichts Unerwaehntes.</p> <button onclick="ProxyPlusAdmin.exportConfig()">Export herunterladen</button> <div id="new-import-form"> <input type="file" id="config-import-file" accept="application/json"> <textarea id="config-import-json" placeholder="...oder JSON hier einfuegen" rows="6"></textarea> <button onclick="ProxyPlusAdmin.importConfig()">Importieren</button> <div id="config-import-result"></div> <div id="config-import-error" class="error"></div> </div> <button onclick="ProxyPlusAdmin.logout()">Logout</button> </section> Loading Loading
admin/static/app.js +40 −0 Changes for admin/static/app.js: 40 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -331,6 +331,44 @@ const ProxyPlusAdmin = (() => { } } async function exportConfig() { document.getElementById("config-import-error").textContent = ""; try { const config = await api("GET", "/api/v1/config/export"); const blob = new Blob([JSON.stringify(config, null, 2)], { type: "application/json" }); const url = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = url; a.download = "proxyplus-config.json"; a.click(); URL.revokeObjectURL(url); } catch (e) { document.getElementById("config-import-error").textContent = e.message; } } async function importConfig() { document.getElementById("config-import-error").textContent = ""; document.getElementById("config-import-result").textContent = ""; try { const file = document.getElementById("config-import-file").files[0]; const text = file ? await file.text() : document.getElementById("config-import-json").value; let config; try { config = JSON.parse(text); } catch (e) { throw new Error("ungueltiges JSON: " + e.message); } const result = await api("POST", "/api/v1/config/import", config); document.getElementById("config-import-result").textContent = result.imported + " Eintraege importiert" + (result.errors && result.errors.length ? "; Fehler: " + result.errors.join("; ") : ""); await refreshAll(); } catch (e) { document.getElementById("config-import-error").textContent = e.message; } } return { login, logout, Loading @@ -344,5 +382,7 @@ const ProxyPlusAdmin = (() => { createDkimKey, showNewPoolForm, createPool, exportConfig, importConfig, }; })();
admin/static/index.html +13 −0 Changes for admin/static/index.html: 13 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -103,6 +103,19 @@ <div id="pool-error" class="error"></div> </div> <h2>Konfiguration Export/Import</h2> <p>Umfasst HTTP-Routen, SMTP-Relays, TLS-Profile (inkl. versiegeltem Schluesselmaterial fuer eigene Zertifikate), Pools und DKIM-Schluessel. Import ergaenzt/ueberschreibt nur die genannten Einträge, loescht nichts Unerwaehntes.</p> <button onclick="ProxyPlusAdmin.exportConfig()">Export herunterladen</button> <div id="new-import-form"> <input type="file" id="config-import-file" accept="application/json"> <textarea id="config-import-json" placeholder="...oder JSON hier einfuegen" rows="6"></textarea> <button onclick="ProxyPlusAdmin.importConfig()">Importieren</button> <div id="config-import-result"></div> <div id="config-import-error" class="error"></div> </div> <button onclick="ProxyPlusAdmin.logout()">Logout</button> </section> Loading