v1.0.30: auto-updater now updates HTML and images, not just plugin.js

Previous versions of checkForUpdates only wrote plugin.js, leaving
property-inspector.html stale on all machines that used Check for
Updates. PI fixes (name dropdown, refreshProjects) never reached them.
Now downloads and writes all UI and image assets before restarting.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
pdmarf
2026-04-24 08:56:37 +01:00
parent ccc6d90578
commit 036567bc7c
6 changed files with 51 additions and 5 deletions

View File

@@ -6438,7 +6438,7 @@ async function stopTimer(token, entryId) {
} }
// src/plugin.ts // src/plugin.ts
var CURRENT_VERSION = "1.0.29"; var CURRENT_VERSION = "1.0.30";
var GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild"; var GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild";
var SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY----- var SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4= MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
@@ -6488,6 +6488,28 @@ async function checkForUpdates(sendStatus) {
return; return;
} }
const fs3 = await import("fs"); const fs3 = await import("fs");
const path5 = await import("path");
const pluginRoot = path5.join(path5.dirname(__filename), "..");
const ASSETS = [
"ui/property-inspector.html",
"ui/global-property-inspector.html",
"imgs/idle.png",
"imgs/running.png"
];
const PLUGIN_BASE = `${GITEA_BASE}/com.pdma.notion-timer.sdPlugin`;
const assetResps = await Promise.all(ASSETS.map((p) => fetchWithTimeout2(`${PLUGIN_BASE}/${p}`)));
for (let i = 0; i < ASSETS.length; i++) {
if (assetResps[i].ok) {
fs3.writeFileSync(path5.join(pluginRoot, ASSETS[i]), Buffer.from(await assetResps[i].arrayBuffer()));
}
}
const LEGACY = ["imgs/idle.svg", "imgs/running.svg"];
for (const f of LEGACY) {
try {
fs3.unlinkSync(path5.join(pluginRoot, f));
} catch {
}
}
fs3.writeFileSync(__filename, newCode); fs3.writeFileSync(__filename, newCode);
plugin_default.logger.info(`Updated to ${version}, restarting\u2026`); plugin_default.logger.info(`Updated to ${version}, restarting\u2026`);
process.exit(0); process.exit(0);

View File

@@ -1 +1 @@
йщJОЁ▀⌠Ы╚▓яU(д┘Ж░░8ДОЬMJv ё√шHАXаJ┌╗∙И╧OУнаеC╔/эУ6╩ U [<EFBFBD>ź®/<2F>‰Ş.ťCÄł+l.߆g0h٬ţQ¨VšěX8Xú÷ cĹĘŻť­ÚxŮĐťž°K/(ßÚ|˘

View File

@@ -2,7 +2,7 @@
"Author": "Pete Marfleet", "Author": "Pete Marfleet",
"Description": "Toggle Notion time tracking for a project with a single button press.", "Description": "Toggle Notion time tracking for a project with a single button press.",
"Name": "Notion Timer", "Name": "Notion Timer",
"Version": "1.0.29", "Version": "1.0.30",
"SDKVersion": 2, "SDKVersion": 2,
"Software": { "MinimumVersion": "5.0" }, "Software": { "MinimumVersion": "5.0" },
"OS": [{ "Platform": "mac", "MinimumVersion": "10.11" }], "OS": [{ "Platform": "mac", "MinimumVersion": "10.11" }],

Binary file not shown.

View File

@@ -1,4 +1,4 @@
const CURRENT_VERSION = "1.0.29"; const CURRENT_VERSION = "1.0.30";
const GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild"; const GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild";
const SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY----- const SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4= MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
@@ -49,6 +49,30 @@ async function checkForUpdates(sendStatus?: (msg: string) => void): Promise<void
} }
const fs = await import("fs"); const fs = await import("fs");
const path = await import("path");
const pluginRoot = path.join(path.dirname(__filename), "..");
// Update UI and image assets
const ASSETS = [
"ui/property-inspector.html",
"ui/global-property-inspector.html",
"imgs/idle.png",
"imgs/running.png",
];
const PLUGIN_BASE = `${GITEA_BASE}/com.pdma.notion-timer.sdPlugin`;
const assetResps = await Promise.all(ASSETS.map(p => fetchWithTimeout(`${PLUGIN_BASE}/${p}`)));
for (let i = 0; i < ASSETS.length; i++) {
if (assetResps[i].ok) {
fs.writeFileSync(path.join(pluginRoot, ASSETS[i]), Buffer.from(await assetResps[i].arrayBuffer()));
}
}
// Remove legacy SVG icons that persist on disk after Stream Deck merge-installs
const LEGACY = ["imgs/idle.svg", "imgs/running.svg"];
for (const f of LEGACY) {
try { fs.unlinkSync(path.join(pluginRoot, f)); } catch { /* already gone */ }
}
fs.writeFileSync(__filename, newCode); fs.writeFileSync(__filename, newCode);
streamDeck.logger.info(`Updated to ${version}, restarting…`); streamDeck.logger.info(`Updated to ${version}, restarting…`);
process.exit(0); process.exit(0);

View File

@@ -1 +1 @@
{ "version": "1.0.29" } { "version": "1.0.30" }