This commit is contained in:
Mateusz Gruszczyński committed 2026-10-10 20:56:36 +02:00
1 parent f213d853e2
commit 76b8bb7ee2
78 files changed
+7750 -5204

No files matched your search

+14 -6
View File
@@ -155,15 +155,21 @@
if (!list.children.length) list.append(el("p", t("renewalNone"), "empty"));
}
async function refresh() {
if (!authenticated || currentPanel !== "tls" || loading) return; loading = true; const epoch = authEpoch;
async function loadAcme({ signal, isCurrent }) {
if (!authenticated || currentPanel !== "tls" || loading) return;
loading = true;
const epoch = authEpoch;
try {
const data = await api("/api/acme");
if (authenticated && epoch === authEpoch) { renderRuntime(data.runtime); render(data.job); renderRenewals(data.renewals, data.log_directories); }
const data = await api("/api/acme", { signal });
if (isCurrent() && epoch === authEpoch) { renderRuntime(data.runtime); render(data.job); renderRenewals(data.renewals, data.log_directories); }
} catch (error) {
if (epoch === authEpoch) { toast(error.message, true); if (error.status === 401) lock(); }
if (error?.name !== "AbortError" && epoch === authEpoch && isCurrent()) {
toast(error.message, true);
if (error.status === 401) lock();
}
} finally { loading = false; }
}
function refresh() { return rustProxyRefresh.manual("acme"); }
$("acme-environment").addEventListener("change", () => { $("acme-confirm-production").required = $("acme-environment").value === "production"; });
$("acme-form").addEventListener("submit", async event => {
event.preventDefault(); if (!authenticated || pending || job?.status === "running" || !runtimeAvailable) return;
@@ -197,7 +203,9 @@
else next.tls.certificates.push(cert);
if (await saveSection("tls", next.tls || {})) { toast(t("acmeImported")); $("acme-import").hidden = true; selectTab("installed"); }
});
setInterval(() => { if (!document.hidden) void refresh(); }, 3000);
rustProxyRefresh.register("acme", {
interval: () => 3, active: () => currentPanel === "tls", run: loadAcme
});
window.rustProxyAcme = {
refresh,
select: selectTab,