diff --git a/com.pdma.notion-timer.sdPlugin/bin/plugin.js b/com.pdma.notion-timer.sdPlugin/bin/plugin.js index fe7ddc7..7ed3b9a 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.50"; +var CURRENT_VERSION = "1.0.51"; 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= @@ -6512,7 +6512,7 @@ async function checkForUpdates(sendStatus) { } fs3.writeFileSync(__filename, newCode); plugin_default.logger.info(`Updated to ${version}, restarting\u2026`); - await sendStatus?.(`Updated to v${version} \u2014 restarting\u2026`); + await sendStatus?.(`Updated to v${version}. Click any other button above to confirm version update has been successful.`); await new Promise((resolve) => setTimeout(resolve, 200)); process.exit(0); } catch (err) { @@ -6543,12 +6543,10 @@ function setRunningEntry(entryId, actionId) { plugin_default.settings.getGlobalSettings().then((stored) => plugin_default.settings.setGlobalSettings({ ...stored, runningEntryId: entryId, runningActionId: actionId })).catch((err) => plugin_default.logger.error("Failed to persist running state:", err)); } async function sendProjectsToPI(tokenOverride) { - plugin_default.logger.info(`[diag] sendProjectsToPI called, version=${CURRENT_VERSION}, hasToken=${!!tokenOverride}`); try { const global = await getGlobal(); const token = tokenOverride ?? global.notionToken; if (!token) { - plugin_default.logger.info("[diag] sendProjectsToPI: no token, sending error payload"); await plugin_default.ui.sendToPropertyInspector({ event: "projects", data: [], error: "Enter your Notion API token above.", version: CURRENT_VERSION }); return; } @@ -6560,7 +6558,6 @@ async function sendProjectsToPI(tokenOverride) { }) ]); await plugin_default.ui.sendToPropertyInspector({ event: "projects", data: projects, users: usersResult, version: CURRENT_VERSION }); - plugin_default.logger.info(`[diag] sendProjectsToPI: sent projects payload, version=${CURRENT_VERSION}`); } catch (err) { plugin_default.logger.error("Failed to fetch projects:", err); await plugin_default.ui.sendToPropertyInspector({ event: "projects", data: [], error: String(err), version: CURRENT_VERSION }); @@ -6638,8 +6635,7 @@ var TimerToggle = class extends SingletonAction { await Promise.all([ev.action.setState(0), ev.action.setTitle(title)]); } } - async onPropertyInspectorDidAppear(ev) { - plugin_default.logger.info(`[diag] onPropertyInspectorDidAppear fired for ${ev.action.id}, version=${CURRENT_VERSION}`); + async onPropertyInspectorDidAppear(_ev) { await sendProjectsToPI(); } async onKeyDown(ev) { @@ -6725,7 +6721,6 @@ TimerToggle = __decorateClass([ var timerAction = new TimerToggle(); plugin_default.actions.registerAction(timerAction); plugin_default.ui.onSendToPlugin(async (ev) => { - plugin_default.logger.info(`[diag] onSendToPlugin received event=${ev.payload.event}, version=${CURRENT_VERSION}`); if (ev.payload.event === "saveSettings" && ev.payload.settings) { await ev.action.setSettings(ev.payload.settings); const title = buttonTitle(ev.payload.settings.projectName || ""); diff --git a/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig b/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig index f077a92..dcabfd0 100644 --- a/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig +++ b/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig @@ -1 +1 @@ -u…o%]¹8®ú~/†l�bßϨRŸ1‚ôŽÜ®¸u»†Í%]çâ4Cñ®¥Ri1ü¢Â×05@KfíÙ#X \ No newline at end of file +…æË>· o“ˆ!óhŰù!HC1ÈÉÒÉ_gY’|vnû¦»­÷1Ûá´¨*ò�˜M(ªºþ0C5ó= \ No newline at end of file diff --git a/com.pdma.notion-timer.sdPlugin/ui/property-inspector.html b/com.pdma.notion-timer.sdPlugin/ui/property-inspector.html index 443339a..3dc4c73 100644 --- a/com.pdma.notion-timer.sdPlugin/ui/property-inspector.html +++ b/com.pdma.notion-timer.sdPlugin/ui/property-inspector.html @@ -147,7 +147,6 @@

-

@@ -177,31 +176,6 @@ el.className = cls || ""; } - // TEMP diagnostic trail — remove once the update-refresh flow is confirmed working. - var debugLines = []; - function debugLog(msg) { - var t = new Date().toISOString().slice(11, 19); - debugLines.push(t + " " + msg); - if (debugLines.length > 8) debugLines.shift(); - document.getElementById("debugText").textContent = debugLines.join("\n"); - } - - // The plugin process restarts after an update, and a freshly-restarted - // process has no way to push to an already-open panel (Stream Deck only - // tells a plugin a panel is visible via a live didAppear/onSendToPlugin - // round trip, which a cold-started process hasn't received yet). So the - // panel re-requests the version itself a few times after the restart - // window, instead of waiting on the plugin to notify it. - function pollForVersionRefresh() { - var token = document.getElementById("notionToken").value.trim(); - [1500, 3500, 6000, 9000].forEach(function(delay) { - setTimeout(function() { - debugLog("poll: sending refreshProjects (+" + delay + "ms)"); - $PI.sendToPlugin({ event: "refreshProjects", token: token }); - }, delay); - }); - } - // Collapsible credentials section document.getElementById("credToggle").addEventListener("click", function() { var section = document.getElementById("credSection"); @@ -280,7 +254,6 @@ } $PI.onConnected(function(jsn) { - debugLog("$PI.onConnected fired (panel loaded/reloaded)"); currentSettings = jsn.actionInfo.payload.settings || {}; $PI.getSettings(); $PI.getGlobalSettings(); @@ -289,10 +262,8 @@ document.getElementById("notionToken").addEventListener("input", scheduleCredSave); document.getElementById("userId").addEventListener("change", saveCredentials); document.getElementById("updateBtn").addEventListener("click", function() { - debugLog("Check for Updates clicked"); document.getElementById("updateStatus").textContent = ""; $PI.sendToPlugin({ event: "checkForUpdates" }); - pollForVersionRefresh(); }); }); @@ -332,7 +303,6 @@ $PI.onSendToPropertyInspector(ACTION_UUID, function(jsn) { var payload = jsn.payload; - debugLog("received: " + payload.event + (payload.version ? " v" + payload.version : "")); if (payload.event === "updateStatus") { document.getElementById("updateStatus").textContent = payload.message; } diff --git a/notion-timer.streamDeckPlugin b/notion-timer.streamDeckPlugin index 97d676f..8e5c3ef 100644 Binary files a/notion-timer.streamDeckPlugin and b/notion-timer.streamDeckPlugin differ diff --git a/src/plugin.ts b/src/plugin.ts index 200d08d..83655d2 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -1,4 +1,4 @@ -const CURRENT_VERSION = "1.0.50"; +const CURRENT_VERSION = "1.0.51"; 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= @@ -74,9 +74,9 @@ async function checkForUpdates(sendStatus?: (msg: string) => void | Promise setTimeout(resolve, 200)); process.exit(0); } catch (err) { @@ -140,12 +140,10 @@ function setRunningEntry(entryId: string | null, actionId: string | null): void } async function sendProjectsToPI(tokenOverride?: string): Promise { - streamDeck.logger.info(`[diag] sendProjectsToPI called, version=${CURRENT_VERSION}, hasToken=${!!tokenOverride}`); try { const global = await getGlobal(); const token = tokenOverride ?? global.notionToken; if (!token) { - streamDeck.logger.info("[diag] sendProjectsToPI: no token, sending error payload"); await streamDeck.ui.sendToPropertyInspector({ event: "projects", data: [], error: "Enter your Notion API token above.", version: CURRENT_VERSION }); return; } @@ -157,7 +155,6 @@ async function sendProjectsToPI(tokenOverride?: string): Promise { }), ]); await streamDeck.ui.sendToPropertyInspector({ event: "projects", data: projects, users: usersResult, version: CURRENT_VERSION }); - streamDeck.logger.info(`[diag] sendProjectsToPI: sent projects payload, version=${CURRENT_VERSION}`); } catch (err) { streamDeck.logger.error("Failed to fetch projects:", err); await streamDeck.ui.sendToPropertyInspector({ event: "projects", data: [], error: String(err), version: CURRENT_VERSION }); @@ -243,8 +240,7 @@ class TimerToggle extends SingletonAction { } } - async onPropertyInspectorDidAppear(ev: PropertyInspectorDidAppearEvent): Promise { - streamDeck.logger.info(`[diag] onPropertyInspectorDidAppear fired for ${ev.action.id}, version=${CURRENT_VERSION}`); + async onPropertyInspectorDidAppear(_ev: PropertyInspectorDidAppearEvent): Promise { await sendProjectsToPI(); } @@ -341,7 +337,6 @@ const timerAction = new TimerToggle(); streamDeck.actions.registerAction(timerAction); streamDeck.ui.onSendToPlugin<{ event: string; settings?: TimerSettings; token?: string }>(async (ev) => { - streamDeck.logger.info(`[diag] onSendToPlugin received event=${ev.payload.event}, version=${CURRENT_VERSION}`); if (ev.payload.event === "saveSettings" && ev.payload.settings) { await ev.action.setSettings(ev.payload.settings); const title = buttonTitle(ev.payload.settings.projectName || ""); diff --git a/version.json b/version.json index b5f5ad4..272ea99 100644 --- a/version.json +++ b/version.json @@ -1 +1 @@ -{ "version": "1.0.50" } +{ "version": "1.0.51" }