Commit 466ad4b6 authored by jan.koester's avatar jan.koester
Browse files

test

parent 3e373afa
Loading
Loading
Loading
Loading
+48 −4
Changes for admin/static/app.js: 48 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -94,11 +94,22 @@ const ProxyPlusAdmin = (() => {
    body.innerHTML = "";
    for (const r of relays) {
      const tr = document.createElement("tr");
      tr.innerHTML = `<td>${r.id}</td><td>${r.domain}</td><td>${r.smarthost}</td><td>${r.smarthost_pool}</td><td>${r.owner_group_id}</td>`;
      tr.innerHTML = `<td>${r.id}</td><td>${r.domain}</td><td>${r.smarthost}</td><td>${r.smarthost_pool}</td><td>${r.owner_group_id}</td><td></td>`;
      addDeleteButton(tr, "Relay", () => deleteRelay(r.id));
      body.appendChild(tr);
    }
  }

  async function deleteRelay(id) {
    if (!confirm("Relay '" + id + "' wirklich löschen?")) return;
    try {
      await api("DELETE", "/api/v1/smtp/relays", { id });
      await refreshRelays();
    } catch (e) {
      document.getElementById("relay-error").textContent = e.message;
    }
  }

  async function refreshPools() {
    const pools = await api("GET", "/api/v1/pools");
    const body = document.querySelector("#lb-pools tbody");
@@ -108,33 +119,66 @@ const ProxyPlusAdmin = (() => {
        .map((t) => `${t.address} (w=${t.weight}${t.healthy === undefined ? "" : t.healthy ? ", up" : ", DOWN"})`)
        .join(", ");
      const tr = document.createElement("tr");
      tr.innerHTML = `<td>${p.id}</td><td>${p.kind}</td><td>${p.algorithm}</td><td>${targets}</td>`;
      tr.innerHTML = `<td>${p.id}</td><td>${p.kind}</td><td>${p.algorithm}</td><td>${targets}</td><td></td>`;
      addDeleteButton(tr, "Pool", () => deletePool(p.id));
      body.appendChild(tr);
    }
  }

  async function deletePool(id) {
    if (!confirm("Pool '" + id + "' wirklich löschen?")) return;
    try {
      await api("DELETE", "/api/v1/pools", { id });
      await refreshPools();
    } catch (e) {
      document.getElementById("pool-error").textContent = e.message;
    }
  }

  async function refreshTlsProfiles() {
    const profiles = await api("GET", "/api/v1/tls/profiles");
    const body = document.querySelector("#tls-profiles tbody");
    body.innerHTML = "";
    for (const p of profiles) {
      const tr = document.createElement("tr");
      tr.innerHTML = `<td>${p.profile}</td><td>${(p.domains || []).join(", ")}</td><td>${p.acme_enabled ? "ja" : "nein"}</td><td>${p.acme_email}</td><td>${p.ca_plugin}</td>`;
      tr.innerHTML = `<td>${p.profile}</td><td>${(p.domains || []).join(", ")}</td><td>${p.acme_enabled ? "ja" : "nein"}</td><td>${p.acme_email}</td><td>${p.ca_plugin}</td><td></td>`;
      addDeleteButton(tr, "TLS-Profil", () => deleteTlsProfile(p.profile));
      body.appendChild(tr);
    }
  }

  async function deleteTlsProfile(profile) {
    if (!confirm("TLS-Profil '" + profile + "' wirklich löschen?")) return;
    try {
      await api("DELETE", "/api/v1/tls/profiles", { profile });
      await refreshTlsProfiles();
    } catch (e) {
      document.getElementById("tls-profile-error").textContent = e.message;
    }
  }

  async function refreshDkimKeys() {
    const keys = await api("GET", "/api/v1/security/dkim-keys");
    const body = document.querySelector("#dkim-keys tbody");
    body.innerHTML = "";
    for (const k of keys) {
      const tr = document.createElement("tr");
      tr.innerHTML = `<td>${k.domain}</td><td>${k.selector}</td><td>${k.key_path}</td><td>${k.enabled ? "ja" : "nein"}</td>`;
      tr.innerHTML = `<td>${k.domain}</td><td>${k.selector}</td><td>${k.key_path}</td><td>${k.enabled ? "ja" : "nein"}</td><td></td>`;
      addDeleteButton(tr, "DKIM-Key", () => deleteDkimKey(k.domain));
      body.appendChild(tr);
    }
  }

  async function deleteDkimKey(domain) {
    if (!confirm("DKIM-Key fuer '" + domain + "' wirklich löschen?")) return;
    try {
      await api("DELETE", "/api/v1/security/dkim-keys", { domain });
      await refreshDkimKeys();
    } catch (e) {
      document.getElementById("dkim-key-error").textContent = e.message;
    }
  }

  async function refreshAll() {
    await Promise.all([
      refreshStatus(),
+4 −4
Changes for admin/static/index.html: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@
  </div>

  <h2>SMTP-Relays</h2>
  <table id="smtp-relays"><thead><tr><th>ID</th><th>Domain</th><th>Smarthost</th><th>Pool</th><th>Owner-Gruppe</th></tr></thead><tbody></tbody></table>
  <table id="smtp-relays"><thead><tr><th>ID</th><th>Domain</th><th>Smarthost</th><th>Pool</th><th>Owner-Gruppe</th><th>Aktionen</th></tr></thead><tbody></tbody></table>
  <button onclick="ProxyPlusAdmin.showNewRelayForm()">Neues Relay</button>
  <div id="new-relay-form" hidden>
    <input id="relay-id" placeholder="ID">
@@ -50,7 +50,7 @@
  </div>

  <h2>TLS-Profile / Zertifikate</h2>
  <table id="tls-profiles"><thead><tr><th>Profil</th><th>Domains</th><th>ACME</th><th>E-Mail</th><th>CA-Plugin</th></tr></thead><tbody></tbody></table>
  <table id="tls-profiles"><thead><tr><th>Profil</th><th>Domains</th><th>ACME</th><th>E-Mail</th><th>CA-Plugin</th><th>Aktionen</th></tr></thead><tbody></tbody></table>
  <button onclick="ProxyPlusAdmin.showNewTlsProfileForm()">Neues Profil</button>
  <div id="new-tls-profile-form" hidden>
    <input id="tls-profile-id" placeholder="Profil-ID, z.B. www">
@@ -68,7 +68,7 @@
  </div>

  <h2>DKIM-Schluessel</h2>
  <table id="dkim-keys"><thead><tr><th>Domain</th><th>Selector</th><th>Key-Pfad</th><th>Aktiv</th></tr></thead><tbody></tbody></table>
  <table id="dkim-keys"><thead><tr><th>Domain</th><th>Selector</th><th>Key-Pfad</th><th>Aktiv</th><th>Aktionen</th></tr></thead><tbody></tbody></table>
  <button onclick="ProxyPlusAdmin.showNewDkimKeyForm()">Neuer Schluessel</button>
  <div id="new-dkim-key-form" hidden>
    <input id="dkim-domain" placeholder="Signierende Domain, z.B. example.com">
@@ -80,7 +80,7 @@
  </div>

  <h2>Load-Balancer-Pools</h2>
  <table id="lb-pools"><thead><tr><th>ID</th><th>Art</th><th>Algorithmus</th><th>Ziele (Status)</th></tr></thead><tbody></tbody></table>
  <table id="lb-pools"><thead><tr><th>ID</th><th>Art</th><th>Algorithmus</th><th>Ziele (Status)</th><th>Aktionen</th></tr></thead><tbody></tbody></table>
  <button onclick="ProxyPlusAdmin.showNewPoolForm()">Neuer Pool</button>
  <div id="new-pool-form" hidden>
    <input id="pool-id" placeholder="ID">