Add MC brand icon to Token Tray tray and Windows installer.

Previous builds used an empty placeholder and the default Electron icon.
This commit is contained in:
Jos Vooges | STH 2026-09-23 00:42:48 +02:00
parent 36d02cab10
commit 15757d98b5
6 changed files with 45 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View file

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="Media Cluster">
<defs>
<linearGradient id="g" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#0b1019"/>
<stop offset="100%" stop-color="#04060a"/>
</linearGradient>
</defs>
<rect width="512" height="512" rx="96" fill="url(#g)"/>
<rect x="36" y="36" width="440" height="440" rx="80" fill="none" stroke="#22d3ee" stroke-opacity="0.35" stroke-width="8"/>
<text x="256" y="292" text-anchor="middle" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="168" font-weight="700" fill="#22d3ee">MC</text>
<circle cx="400" cy="128" r="18" fill="#34d399"/>
</svg>

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -1,6 +1,6 @@
{
"name": "@media-cluster/token-tray",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"description": "Windows system tray helper to refresh Viaplay/F1TV session tokens",
"author": "Vonas Media Cluster",
@ -32,12 +32,14 @@
},
"files": [
"dist/**/*",
"assets/**/*",
"package.json"
],
"extraMetadata": {
"main": "dist/main.js"
},
"win": {
"icon": "assets/icon.png",
"target": [
{
"target": "nsis",

View file

@ -7,6 +7,8 @@ import {
nativeImage,
shell,
} from "electron";
import fs from "fs";
import path from "path";
import { configPath, loadConfig, saveConfig, type TrayConfig } from "./config";
import { pingAgent } from "./viaplay";
import { refreshAllSilent, refreshDueSilent } from "./jobs";
@ -22,6 +24,32 @@ let lastDueCount = 0;
const POLL_MS = 10 * 60 * 1000; // elke 10 min: vraag server wie bijna verloopt
const WITHIN_MINUTES = 90; // vernieuw als token < 90 min geldig is
function resolveAsset(...parts: string[]): string {
const candidates = [
path.join(__dirname, "..", "assets", ...parts),
path.join(app.getAppPath(), "assets", ...parts),
path.join(process.resourcesPath, "assets", ...parts),
];
for (const p of candidates) {
if (fs.existsSync(p)) return p;
}
return candidates[0];
}
function loadTrayImage(): Electron.NativeImage {
for (const name of ["tray-icon-32.png", "tray-icon-16.png", "icon.png"] as const) {
const p = resolveAsset(name);
if (!fs.existsSync(p)) continue;
let img = nativeImage.createFromPath(p);
if (img.isEmpty()) continue;
const { width } = img.getSize();
// Windows systeemvak: 16–32 px; groter schalen ziet er wazig/onzichtbaar uit
if (width > 32) img = img.resize({ width: 16, height: 16 });
return img;
}
return nativeImage.createEmpty();
}
function statusTooltip(): string {
const parts = ["Media Cluster Token Tray (auto)"];
if (busy) parts.push("Bezig met stille refresh…");
@ -237,10 +265,8 @@ async function testConnection() {
}
function createTray() {
const png = nativeImage.createFromDataURL(
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAALElEQVQ4T2NkYGD4z0ABYBzVMKoBQw0YNYPRDWBgYGBgZGBg+M8w6gYGBgYGABv0AQX1mVYpAAAAAElFTkSuQmCC"
);
tray = new Tray(png.isEmpty() ? nativeImage.createEmpty() : png);
const img = loadTrayImage();
tray = new Tray(img);
tray.setToolTip("Media Cluster Token Tray");
rebuildMenu();
tray.on("double-click", () => void runAuto(true));