Fix now-playing scraper, quit hang, tray icon, and tray race (v1.0.1)

- Read the track from the Media Session API, falling back to the legacy
  ytmusic-player-bar scrape. Current YT Music layouts render no player bar,
  so the API and tray stayed empty while music played. Artist is also clean
  now (no "• views • likes" suffix).
- Terminate connected WebSocket clients before closing the server. ws's
  close() waits for every client to disconnect, so quitting with an overlay
  open hung forever, leaving the window playing and the port bound.
- Replace the tray icon with a valid PNG (the old one had a bad IDAT CRC and
  decoded to an empty image) and test that its chunks are well formed.
- Create the tray before the window so early state updates are not dropped.
- Bump version to 1.0.1.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-04 11:37:38 -07:00
co-authored by Claude Sonnet 5.5
parent f73ea93dde
commit e49078ee03
11 changed files with 192 additions and 54 deletions
+25
View File
@@ -0,0 +1,25 @@
const { test } = require('node:test');
const assert = require('node:assert');
const zlib = require('node:zlib');
const { TRAY_ICON_BASE64 } = require('../tray-icon');
test('tray icon is a structurally valid PNG (every chunk CRC checks out)', () => {
const prefix = 'data:image/png;base64,';
assert.ok(TRAY_ICON_BASE64.startsWith(prefix));
const png = Buffer.from(TRAY_ICON_BASE64.slice(prefix.length), 'base64');
assert.strictEqual(png.subarray(0, 8).toString('hex'), '89504e470d0a1a0a');
const types = [];
let off = 8;
while (off < png.length) {
const len = png.readUInt32BE(off);
const type = png.subarray(off + 4, off + 8);
const body = png.subarray(off + 8, off + 8 + len);
const crc = png.readUInt32BE(off + 8 + len);
assert.strictEqual(zlib.crc32(Buffer.concat([type, body])), crc, `bad CRC in ${type}`);
types.push(type.toString());
off += 12 + len;
}
assert.strictEqual(off, png.length, 'trailing bytes after last chunk');
assert.deepStrictEqual([types[0], types.at(-1)], ['IHDR', 'IEND']);
});