Section 31 point 7: fill the multisig card from /api/setup

This commit is contained in:
ai-bot committed 2026-10-13 07:43:33 +00:00
1 parent 604cba935e
commit 559c95b744
1 file changed
+17 -1
+17 -1
View File
@@ -2,6 +2,8 @@
const keyList = document.querySelector("#key-list"); const keyList = document.querySelector("#key-list");
const keyCount = document.querySelector("#key-count"); const keyCount = document.querySelector("#key-count");
const setupTitle = document.querySelector("#setup-title");
const setupDescription = document.querySelector("#setup-description");
const nextCheckTitle = document.querySelector("#next-check-title"); const nextCheckTitle = document.querySelector("#next-check-title");
const nextCheckDetail = document.querySelector("#next-check-detail"); const nextCheckDetail = document.querySelector("#next-check-detail");
const overdueTitle = document.querySelector("#overdue-title"); const overdueTitle = document.querySelector("#overdue-title");
@@ -168,6 +170,16 @@ function createKeyAlertNote(entry, open) {
return note; return note;
} }
function renderSetupShape(setup) {
// The setup card reads the threshold and the key count from the API, because
// the single setup may be any shape, not only 2-of-3 (section 31 point 7).
if (!setup || typeof setup.threshold !== "number" || typeof setup.key_count !== "number") {
return;
}
setupTitle.textContent = `${setup.threshold}-of-${setup.key_count}`;
setupDescription.textContent = `${setup.threshold} of ${setup.key_count} keys are required to sign. This app records check results only — never keys or seed phrases.`;
}
function renderSummary(status) { function renderSummary(status) {
const scheduled = status.filter((entry) => entry.next_check_due); const scheduled = status.filter((entry) => entry.next_check_due);
if (!scheduled.length) { if (!scheduled.length) {
@@ -432,10 +444,11 @@ function renderAlerts() {
} }
async function loadDashboard() { async function loadDashboard() {
const [statusResult, alertResult, settingsResult] = await Promise.allSettled([ const [statusResult, alertResult, settingsResult, setupResult] = await Promise.allSettled([
fetchJson("/api/key-status"), fetchJson("/api/key-status"),
fetchJson("/api/alerts"), fetchJson("/api/alerts"),
fetchJson("/api/settings"), fetchJson("/api/settings"),
fetchJson("/api/setup"),
]); ]);
if (settingsResult.status === "fulfilled") { if (settingsResult.status === "fulfilled") {
@@ -451,6 +464,9 @@ async function loadDashboard() {
keyStatus = statusResult.value; keyStatus = statusResult.value;
keysLoaded = true; keysLoaded = true;
} }
if (setupResult.status === "fulfilled") {
renderSetupShape(setupResult.value);
}
renderKeyCards(); renderKeyCards();
renderAlerts(); renderAlerts();