This commit is contained in:
Mateusz Gruszczyński committed 2026-10-19 11:09:48 +02:00
1 parent 4afa88a65e
commit 2ab44c4c62
49 files changed
+1523 -176

No files matched your search

+28 -1
View File
@@ -109,6 +109,33 @@ function renderCertificates() {
box.append(details);
const buttons = el("div", undefined, "entity-actions");
const assignPane = el("div", undefined, "certificate-bulk-assign");
assignPane.hidden = true;
const assignmentList = el("div", undefined, "certificate-bulk-list");
for (const host of envelope.config.vhosts || []) {
const label = el("label", undefined, "check");
const check = document.createElement("input");
check.type = "checkbox"; check.value = host.id;
check.checked = host.certificate_id === cert.id;
label.append(check, el("span", `${host.id} · ${(host.frontend?.hosts || []).join(", ")}`));
assignmentList.append(label);
}
const applyBindings = action(t("certAssignApply"), async () => {
if (busy) return;
const selected = new Set([...assignmentList.querySelectorAll('input:checked')].map(input => input.value));
const next = structuredClone(envelope.config);
for (const host of next.vhosts) {
if (selected.has(host.id)) host.certificate_id = cert.id;
else if (host.certificate_id === cert.id) host.certificate_id = null;
}
await saveSection("vhosts", next.vhosts);
});
assignPane.append(el("p", t("certAssignHelp"), "fine"), assignmentList, applyBindings);
const assignButton = action(t("certAssignVhosts"), () => {
assignPane.hidden = !assignPane.hidden;
});
assignButton.disabled = !(envelope.config.vhosts || []).length;
buttons.append(assignButton);
if (!managed) {
buttons.append(action(t("reloadCertificate"), async () => {
if (busy) return;
@@ -125,7 +152,7 @@ function renderCertificates() {
}
const remove = action(t("remove"), async () => { if (inUse) { toast(t("certInUse"), true); return; } if (!(await appConfirm(t("confirmDelete"), { danger: true }))) return; const next = structuredClone(envelope.config); next.tls.certificates = next.tls.certificates.filter(v => v.id !== cert.id); await saveSection("tls", next.tls); });
remove.disabled = inUse; remove.title = inUse ? t("certInUse") : ""; buttons.append(remove);
box.append(buttons);
box.append(buttons, assignPane);
return box;
});
$("certificate-list").replaceChildren(...entries);