Add provider update startup check
This commit is contained in:
@@ -243,6 +243,14 @@ CONFIG_HTML = r"""<!doctype html>
|
||||
}
|
||||
.badge.ok { color: #95e4ba; border-color: rgba(149, 228, 186, 0.24); }
|
||||
.badge.bad { color: #ffd0da; border-color: rgba(255, 144, 164, 0.22); }
|
||||
.badge.warn { color: #ffe6a8; border-color: rgba(255, 217, 118, 0.28); }
|
||||
.provider-update-list {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
.provider-update-list:empty {
|
||||
display: none;
|
||||
}
|
||||
.field-hint {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
@@ -466,6 +474,13 @@ CONFIG_HTML = r"""<!doctype html>
|
||||
</div>
|
||||
<button class="ghost wide-button" id="openChangelogBtn" type="button">Changelog</button>
|
||||
</section>
|
||||
<section class="settings" id="providerUpdatesPanel">
|
||||
<h2>Provider updates</h2>
|
||||
<div class="stack muted">
|
||||
<p id="providerUpdatesLine">Checking upstream provider files...</p>
|
||||
<div class="provider-update-list" id="providerUpdatesList"></div>
|
||||
</div>
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
<main>
|
||||
@@ -1084,6 +1099,52 @@ CONFIG_HTML = r"""<!doctype html>
|
||||
$("providerLine").textContent = `Providers: ${(data.providers || []).join(", ") || "Unavailable"}`;
|
||||
}
|
||||
|
||||
function providerUpdateBadgeClass(status) {
|
||||
if (status === "up_to_date") return "ok";
|
||||
if (status === "updates_available") return "warn";
|
||||
if (status === "error") return "bad";
|
||||
return "";
|
||||
}
|
||||
|
||||
function renderProviderUpdates(data) {
|
||||
const line = $("providerUpdatesLine");
|
||||
const list = $("providerUpdatesList");
|
||||
const status = data.status || "idle";
|
||||
const checked = data.checked_files ? `${data.checked_files} checked` : "";
|
||||
const checkedAt = data.checked_at ? ` · ${new Date(data.checked_at).toLocaleString()}` : "";
|
||||
line.textContent = `${data.message || "Provider update status unavailable."}${checked ? ` · ${checked}` : ""}${checkedAt}`;
|
||||
list.innerHTML = "";
|
||||
|
||||
const files = [
|
||||
...(data.updated_files || []).map((item) => item.path),
|
||||
...(data.missing_upstream_files || [])
|
||||
];
|
||||
if (!files.length && status !== "checking") {
|
||||
const badge = document.createElement("span");
|
||||
badge.className = `badge ${providerUpdateBadgeClass(status)}`;
|
||||
badge.textContent = status === "up_to_date" ? "up to date" : status.replace(/_/g, " ");
|
||||
list.appendChild(badge);
|
||||
return;
|
||||
}
|
||||
for (const path of files) {
|
||||
const badge = document.createElement("span");
|
||||
badge.className = `badge ${providerUpdateBadgeClass(status)}`;
|
||||
badge.textContent = path;
|
||||
list.appendChild(badge);
|
||||
}
|
||||
}
|
||||
|
||||
async function loadProviderUpdates() {
|
||||
try {
|
||||
renderProviderUpdates(await api("/api/provider-updates"));
|
||||
} catch (error) {
|
||||
renderProviderUpdates({
|
||||
status: "error",
|
||||
message: error.message || "Provider update status unavailable."
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function openChangelog() {
|
||||
try {
|
||||
changelogContent.textContent = "Loading changelog...";
|
||||
@@ -1138,9 +1199,11 @@ CONFIG_HTML = r"""<!doctype html>
|
||||
await pollJellyfinSyncStatus(false);
|
||||
await loadDeps();
|
||||
await loadVersion();
|
||||
await loadProviderUpdates();
|
||||
window.setInterval(() => {
|
||||
pollJellyfinSyncStatus();
|
||||
}, 2500);
|
||||
window.setInterval(loadProviderUpdates, 10000);
|
||||
} catch (error) {
|
||||
setNotice(error.message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user