diff --git a/com.pdma.notion-timer.sdPlugin/bin/plugin.js b/com.pdma.notion-timer.sdPlugin/bin/plugin.js index 74e7676..3a5cc91 100644 --- a/com.pdma.notion-timer.sdPlugin/bin/plugin.js +++ b/com.pdma.notion-timer.sdPlugin/bin/plugin.js @@ -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: diff --git a/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig b/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig index dead7e6..3c2e79f 100644 --- a/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig +++ b/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig @@ -1 +1 @@ -ûˆXÁ뜖-Ðrº—¸àÆ7Y?B»-A¦Ïív÷דëá¦Ï¯<ã…e¹�Æ”øŸ¦UPmÜ ü¨ÜƒÁÕ \ No newline at end of file +sâ–Å4£¿óŸP¿0?¸#"Q”XúáŒjžÔ`¥}R }»w­ë­ª�ÎbP•½V�t$=h¶?ÄãZ¤° \ No newline at end of file diff --git a/notion-timer.streamDeckPlugin b/notion-timer.streamDeckPlugin index 0ee5a2e..ade242a 100644 Binary files a/notion-timer.streamDeckPlugin and b/notion-timer.streamDeckPlugin differ diff --git a/src/plugin.ts b/src/plugin.ts index 8334dfd..5a18ed1 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -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 { async function checkForUpdates(sendStatus?: (msg: string) => void | Promise): Promise { 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); diff --git a/version.json b/version.json index 290b841..a00d4f5 100644 --- a/version.json +++ b/version.json @@ -1 +1 @@ -{ "version": "1.0.57" } +{ "version": "1.0.58" }