v1.0.19: auto-updater now replaces UI and image assets
Previously only plugin.js was replaced on auto-update, leaving property-inspector.html, idle.png, and running.png at the originally installed version. Staff would see the old button colours and missing UI elements (username dropdown, Update button) even after the code updated successfully. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6438,7 +6438,7 @@ async function stopTimer(token, entryId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// src/plugin.ts
|
// src/plugin.ts
|
||||||
var CURRENT_VERSION = "1.0.18";
|
var CURRENT_VERSION = "1.0.19";
|
||||||
var GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/master";
|
var GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/master";
|
||||||
var SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
var SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
||||||
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
|
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
|
||||||
@@ -6474,9 +6474,10 @@ async function checkForUpdates(sendStatus) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sendStatus?.(`Updating to v${version}\u2026`);
|
sendStatus?.(`Updating to v${version}\u2026`);
|
||||||
|
const PLUGIN_BASE = `${GITEA_BASE}/com.pdma.notion-timer.sdPlugin`;
|
||||||
const [pluginResp, sigResp] = await Promise.all([
|
const [pluginResp, sigResp] = await Promise.all([
|
||||||
fetchWithTimeout2(`${GITEA_BASE}/com.pdma.notion-timer.sdPlugin/bin/plugin.js`),
|
fetchWithTimeout2(`${PLUGIN_BASE}/bin/plugin.js`),
|
||||||
fetchWithTimeout2(`${GITEA_BASE}/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig`)
|
fetchWithTimeout2(`${PLUGIN_BASE}/bin/plugin.js.sig`)
|
||||||
]);
|
]);
|
||||||
if (!pluginResp.ok || !sigResp.ok) {
|
if (!pluginResp.ok || !sigResp.ok) {
|
||||||
sendStatus?.("Download failed");
|
sendStatus?.("Download failed");
|
||||||
@@ -6492,7 +6493,23 @@ 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 assetResps = await Promise.all(ASSETS.map((p) => fetchWithTimeout2(`${PLUGIN_BASE}/${p}`)));
|
||||||
fs3.writeFileSync(__filename, newCode);
|
fs3.writeFileSync(__filename, newCode);
|
||||||
|
for (let i = 0; i < ASSETS.length; i++) {
|
||||||
|
if (!assetResps[i].ok) {
|
||||||
|
plugin_default.logger.warn(`Asset download failed: ${ASSETS[i]}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
fs3.writeFileSync(path5.join(pluginRoot, ASSETS[i]), Buffer.from(await assetResps[i].arrayBuffer()));
|
||||||
|
}
|
||||||
plugin_default.logger.info(`Updated to ${version}, restarting\u2026`);
|
plugin_default.logger.info(`Updated to ${version}, restarting\u2026`);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
hГj5±йЫщ$r!ѕяЩc•яржd<D0B6>‚ЭТ‘]kэ“oЪlігцёШЇ<14>iЛБHГо©* ’ћ;»Џъ<D08F> Чc
|
<EFBFBD><14>_0<5F>@<40>c8<63>q
|
||||||
|
4K7<>@%]<5D><><EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>,d<>1<EFBFBD><31>.:0<><30>e<EFBFBD>
|
||||||
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
const CURRENT_VERSION = "1.0.18";
|
const CURRENT_VERSION = "1.0.19";
|
||||||
const GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/master";
|
const GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/master";
|
||||||
const SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
const SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
||||||
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
|
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
|
||||||
@@ -35,9 +35,10 @@ async function checkForUpdates(sendStatus?: (msg: string) => void): Promise<void
|
|||||||
}
|
}
|
||||||
|
|
||||||
sendStatus?.(`Updating to v${version}…`);
|
sendStatus?.(`Updating to v${version}…`);
|
||||||
|
const PLUGIN_BASE = `${GITEA_BASE}/com.pdma.notion-timer.sdPlugin`;
|
||||||
const [pluginResp, sigResp] = await Promise.all([
|
const [pluginResp, sigResp] = await Promise.all([
|
||||||
fetchWithTimeout(`${GITEA_BASE}/com.pdma.notion-timer.sdPlugin/bin/plugin.js`),
|
fetchWithTimeout(`${PLUGIN_BASE}/bin/plugin.js`),
|
||||||
fetchWithTimeout(`${GITEA_BASE}/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig`),
|
fetchWithTimeout(`${PLUGIN_BASE}/bin/plugin.js.sig`),
|
||||||
]);
|
]);
|
||||||
if (!pluginResp.ok || !sigResp.ok) { sendStatus?.("Download failed"); return; }
|
if (!pluginResp.ok || !sigResp.ok) { sendStatus?.("Download failed"); return; }
|
||||||
|
|
||||||
@@ -53,7 +54,25 @@ 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), "..");
|
||||||
|
|
||||||
|
// Also update UI and image assets. These are not separately signed — they run in a browser
|
||||||
|
// sandbox (not Node), and are fetched over HTTPS from the same trusted server.
|
||||||
|
const ASSETS = [
|
||||||
|
"ui/property-inspector.html",
|
||||||
|
"ui/global-property-inspector.html",
|
||||||
|
"imgs/idle.png",
|
||||||
|
"imgs/running.png",
|
||||||
|
];
|
||||||
|
const assetResps = await Promise.all(ASSETS.map(p => fetchWithTimeout(`${PLUGIN_BASE}/${p}`)));
|
||||||
|
|
||||||
fs.writeFileSync(__filename, newCode);
|
fs.writeFileSync(__filename, newCode);
|
||||||
|
for (let i = 0; i < ASSETS.length; i++) {
|
||||||
|
if (!assetResps[i].ok) { streamDeck.logger.warn(`Asset download failed: ${ASSETS[i]}`); continue; }
|
||||||
|
fs.writeFileSync(path.join(pluginRoot, ASSETS[i]), Buffer.from(await assetResps[i].arrayBuffer()));
|
||||||
|
}
|
||||||
|
|
||||||
streamDeck.logger.info(`Updated to ${version}, restarting…`);
|
streamDeck.logger.info(`Updated to ${version}, restarting…`);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{ "version": "1.0.18" }
|
{ "version": "1.0.19" }
|
||||||
|
|||||||
Reference in New Issue
Block a user