v1.0.58: add logging around the update-check so silent failures are visible

This commit is contained in:
pdmarf
2026-10-07 18:41:04 +01:00
parent c8667c3844
commit 608b804e5e
5 changed files with 36 additions and 11 deletions
+15 -4
View File
@@ -6438,7 +6438,7 @@ async function stopTimer(token, entryId) {
}
// src/plugin.ts
var CURRENT_VERSION = "1.0.57";
var CURRENT_VERSION = "1.0.58";
var GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild";
var SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
@@ -6460,12 +6460,17 @@ async function checkForUpdates(sendStatus) {
try {
const resp = await fetchWithTimeout2(`${GITEA_BASE}/version.json`);
if (!resp.ok) {
plugin_default.logger.warn(`Update check: version.json fetch returned ${resp.status}`);
sendStatus?.("Update check failed");
return;
}
const { version } = await resp.json();
if (!/^\d+\.\d+\.\d+$/.test(version)) return;
if (!/^\d+\.\d+\.\d+$/.test(version)) {
plugin_default.logger.warn(`Update check: version.json had unexpected content: ${JSON.stringify(version)}`);
return;
}
if (!isNewerVersion(version, CURRENT_VERSION)) {
plugin_default.logger.info(`Update check: up to date (v${CURRENT_VERSION}, server has v${version})`);
sendStatus?.(`Already up to date (v${CURRENT_VERSION})`);
return;
}
@@ -6758,8 +6763,14 @@ plugin_default.ui.onSendToPlugin(async (ev) => {
});
var UPDATE_CHECK_INTERVAL_MS = 30 * 60 * 1e3;
plugin_default.connect();
setTimeout(() => checkForUpdates(), 1e4);
setInterval(() => checkForUpdates(), UPDATE_CHECK_INTERVAL_MS);
setTimeout(() => {
plugin_default.logger.info("Running initial (10s post-launch) update check");
checkForUpdates();
}, 1e4);
setInterval(() => {
plugin_default.logger.info("Running scheduled (30min) update check");
checkForUpdates();
}, UPDATE_CHECK_INTERVAL_MS);
/*! Bundled license information:
@elgato/schemas/dist/streamdeck/plugins/index.mjs:
@@ -1 +1 @@
ûˆXÁ뜖-Ðrº—¸àÆ7Y?B»-A¦Ïív÷דëá¦Ï¯<ã…e¹�Æ”øŸ¦UPmÜ ü¨ÜƒÁÕ
sâ–Å4£¿óŸP¿0?¸#"Q”XúáŒjžÔ`¥}R }»w­ë­ª�ÎbP•½V�t$=h¶?ÄãZ¤°
Binary file not shown.
+19 -5
View File
@@ -1,4 +1,4 @@
const CURRENT_VERSION = "1.0.57";
const CURRENT_VERSION = "1.0.58";
const GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild";
const SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
@@ -22,10 +22,18 @@ function fetchWithTimeout(url: string): Promise<Response> {
async function checkForUpdates(sendStatus?: (msg: string) => void | Promise<void>): Promise<void> {
try {
const resp = await fetchWithTimeout(`${GITEA_BASE}/version.json`);
if (!resp.ok) { sendStatus?.("Update check failed"); return; }
if (!resp.ok) {
streamDeck.logger.warn(`Update check: version.json fetch returned ${resp.status}`);
sendStatus?.("Update check failed");
return;
}
const { version } = await resp.json() as { version: string };
if (!/^\d+\.\d+\.\d+$/.test(version)) return;
if (!/^\d+\.\d+\.\d+$/.test(version)) {
streamDeck.logger.warn(`Update check: version.json had unexpected content: ${JSON.stringify(version)}`);
return;
}
if (!isNewerVersion(version, CURRENT_VERSION)) {
streamDeck.logger.info(`Update check: up to date (v${CURRENT_VERSION}, server has v${version})`);
sendStatus?.(`Already up to date (v${CURRENT_VERSION})`);
return;
}
@@ -382,5 +390,11 @@ streamDeck.connect();
// Initial check shortly after startup, then keep rechecking — a plugin process
// can run for days without Stream Deck restarting, and the old code only ever
// checked once per process lifetime.
setTimeout(() => checkForUpdates(), 10_000);
setInterval(() => checkForUpdates(), UPDATE_CHECK_INTERVAL_MS);
setTimeout(() => {
streamDeck.logger.info("Running initial (10s post-launch) update check");
checkForUpdates();
}, 10_000);
setInterval(() => {
streamDeck.logger.info("Running scheduled (30min) update check");
checkForUpdates();
}, UPDATE_CHECK_INTERVAL_MS);
+1 -1
View File
@@ -1 +1 @@
{ "version": "1.0.57" }
{ "version": "1.0.58" }