v1.0.51: stop chasing auto-refresh, tell the user to confirm manually instead
v1.0.49's panel-polling approach and v1.0.50's diagnostic logging did not produce a working auto-refresh in testing -- the panel still hung after the restarting message until a different button was clicked. Rather than keep guessing at Stream Deck's PI-reconnect lifecycle, removed the polling/debug scaffolding entirely and changed the final status message to explicitly instruct the user: 'Updated to vX. Click any other button above to confirm version update has been successful.'
This commit is contained in:
+5
-10
@@ -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<void
|
||||
fs.writeFileSync(__filename, newCode);
|
||||
streamDeck.logger.info(`Updated to ${version}, restarting…`);
|
||||
// Await + a short delay so the message actually reaches the socket before
|
||||
// the process dies — best-effort only, the property inspector doesn't
|
||||
// depend on this arriving (it polls for the new version itself).
|
||||
await sendStatus?.(`Updated to v${version} — restarting…`);
|
||||
// the process dies. The panel can't reliably learn its own new version
|
||||
// number after this restart, so it just tells the user how to confirm it.
|
||||
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) {
|
||||
@@ -140,12 +140,10 @@ function setRunningEntry(entryId: string | null, actionId: string | null): void
|
||||
}
|
||||
|
||||
async function sendProjectsToPI(tokenOverride?: string): Promise<void> {
|
||||
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<void> {
|
||||
}),
|
||||
]);
|
||||
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<TimerSettings> {
|
||||
}
|
||||
}
|
||||
|
||||
async onPropertyInspectorDidAppear(ev: PropertyInspectorDidAppearEvent<TimerSettings>): Promise<void> {
|
||||
streamDeck.logger.info(`[diag] onPropertyInspectorDidAppear fired for ${ev.action.id}, version=${CURRENT_VERSION}`);
|
||||
async onPropertyInspectorDidAppear(_ev: PropertyInspectorDidAppearEvent<TimerSettings>): Promise<void> {
|
||||
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 || "");
|
||||
|
||||
Reference in New Issue
Block a user