v1.0.20: fix button icons and surface user-fetch errors

- Remove stale idle.svg/running.svg from zip (were shadowing the PNG
  icons added in v1.0.15, causing old grey icons to show instead of
  the Aurora timer images)
- Fix package script to always delete and recreate zip so removed files
  don't persist across builds
- Show a clear error in the name dropdown when fetchUsers fails (e.g.
  Notion integration missing "Read user information" capability)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
pdmarf
2026-04-23 20:39:51 +01:00
parent 3632300d08
commit 3df4468605
7 changed files with 28 additions and 13 deletions

View File

@@ -6438,7 +6438,7 @@ async function stopTimer(token, entryId) {
}
// src/plugin.ts
var CURRENT_VERSION = "1.0.19";
var CURRENT_VERSION = "1.0.20";
var GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/master";
var SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
@@ -6573,14 +6573,18 @@ var TimerToggle = class extends SingletonAction {
await plugin_default.ui.sendToPropertyInspector({ event: "projects", data: [], error: "Enter your Notion API token above.", version: CURRENT_VERSION });
return;
}
const [projects, usersResult] = await Promise.all([
let usersResult = [];
let usersError;
const [projects] = await Promise.all([
fetchProjects(global.notionToken, global.projectsDbId),
fetchUsers(global.notionToken).catch((err) => {
fetchUsers(global.notionToken).then((u) => {
usersResult = u;
}).catch((err) => {
plugin_default.logger.error("Failed to fetch users:", err);
return [];
usersError = err instanceof Error ? err.message : String(err);
})
]);
await plugin_default.ui.sendToPropertyInspector({ event: "projects", data: projects, users: usersResult, version: CURRENT_VERSION });
await plugin_default.ui.sendToPropertyInspector({ event: "projects", data: projects, users: usersResult, usersError, 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 });

View File

@@ -127,6 +127,7 @@
<option value="">— Select your name —</option>
</select>
</div>
<p id="userError" class="hint" style="color:#e57373;padding-left:0;"></p>
<p class="hint">Shared across all buttons. Select once per device.</p>
<p id="credStatus"></p>
<hr class="divider">
@@ -304,9 +305,17 @@
if (payload.version) {
document.getElementById("versionText").textContent = "v" + payload.version;
}
if (payload.users) {
if (payload.users !== undefined) {
var savedUserId = document.getElementById("userId").value;
populateUsers(payload.users, savedUserId);
var userErr = document.getElementById("userError");
if (payload.usersError) {
userErr.textContent = "Could not load names: " + payload.usersError;
} else if (payload.users.length === 0) {
userErr.textContent = "No users found — check the integration has \u201cRead user information\u201d enabled.";
} else {
userErr.textContent = "";
}
}
if (payload.error) {
setStatus(payload.error, "error");

Binary file not shown.

View File

@@ -4,7 +4,7 @@
"description": "Notion time tracking toggle for Stream Deck",
"scripts": {
"build": "esbuild src/plugin.ts --bundle --platform=node --target=node20 --outfile=com.pdma.notion-timer.sdPlugin/bin/plugin.js --external:electron && node scripts/sign.js",
"package": "npm run build && zip -r notion-timer.streamDeckPlugin com.pdma.notion-timer.sdPlugin && echo 'Packaged: notion-timer.streamDeckPlugin'",
"package": "npm run build && rm -f notion-timer.streamDeckPlugin && zip -r notion-timer.streamDeckPlugin com.pdma.notion-timer.sdPlugin && echo 'Packaged: notion-timer.streamDeckPlugin'",
"dev": "esbuild src/plugin.ts --bundle --platform=node --target=node20 --outfile=com.pdma.notion-timer.sdPlugin/bin/plugin.js --external:electron --watch",
"sign": "node scripts/sign.js",
"link": "ln -sf \"$(pwd)/com.pdma.notion-timer.sdPlugin\" \"$HOME/Library/Application Support/com.elgato.StreamDeck/Plugins/com.pdma.notion-timer.sdPlugin\"",

View File

@@ -1,4 +1,4 @@
const CURRENT_VERSION = "1.0.19";
const CURRENT_VERSION = "1.0.20";
const GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/master";
const SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
@@ -176,14 +176,16 @@ class TimerToggle extends SingletonAction<TimerSettings> {
await streamDeck.ui.sendToPropertyInspector({ event: "projects", data: [], error: "Enter your Notion API token above.", version: CURRENT_VERSION });
return;
}
const [projects, usersResult] = await Promise.all([
let usersResult: Awaited<ReturnType<typeof fetchUsers>> = [];
let usersError: string | undefined;
const [projects] = await Promise.all([
fetchProjects(global.notionToken, global.projectsDbId),
fetchUsers(global.notionToken).catch((err) => {
fetchUsers(global.notionToken).then((u) => { usersResult = u; }).catch((err) => {
streamDeck.logger.error("Failed to fetch users:", err);
return [];
usersError = err instanceof Error ? err.message : String(err);
}),
]);
await streamDeck.ui.sendToPropertyInspector({ event: "projects", data: projects, users: usersResult, version: CURRENT_VERSION });
await streamDeck.ui.sendToPropertyInspector({ event: "projects", data: projects, users: usersResult, usersError, 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 });

View File

@@ -1 +1 @@
{ "version": "1.0.19" }
{ "version": "1.0.20" }