Port Kaleido Desktop to macOS

macOS (Apple silicon) now plays, browses and updates like Windows:

- Video: libmpv's render API draws into a CAOpenGLLayer beneath the
  WKWebView, with the miniplayer rectangle, HDR passthrough through
  extended dynamic range (PQ/BT.2020) and display-sleep prevention.
- Window: native traffic lights on the top bar's centre line, hidden
  with the player's controls; the page's caption buttons are Windows-only.
- Interface: macOS shortcut labels (⌘K, ⌘[, ⌃⌘F), Plex identifies the
  player as a Mac, and header values are kept ASCII (Mac computer names
  usually contain a curly apostrophe).
- The window appears without waiting for an animation frame, which
  WKWebView doesn't run in a hidden window.
- Credentials: release builds use the Keychain and are signed with a
  lasting self-signed certificate so access survives updates; debug
  builds keep tokens in a private file to avoid prompts on every rebuild.
- Bundling: scripts/fetch-libmpv.sh makes Homebrew's libmpv and its
  libraries self-contained; scripts/build.sh builds the .app, .dmg and
  signed update archive.

Releases now carry both platforms: publish-release.mjs uploads each
machine's build into one release, and update-manifest.mjs writes the
feed from that release's assets, refusing while a platform is missing.

The updater uses a new signing key (public key in tauri.conf.json), so
existing installs must be reinstalled once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah Kuntz 2026-11-02 15:14:40 -07:00
parent a3c05e9062
commit 7d0803481b
39 changed files with 1191 additions and 230 deletions

View file

@ -0,0 +1,49 @@
// Shared by the release scripts: the Forgejo API (FORGEJO_TOKEN from the environment or
// the ignored .env, never printed), release notes and the bundle folder.
import fs from 'node:fs';
import path from 'node:path';
export const API = 'https://git.elijahkuntz.com/api/v1/repos/Elijah/Kaleido-Desktop';
export const root = path.resolve(import.meta.dirname, '..');
export const bundleDir = path.join(root, 'src-tauri/target/release/bundle');
/** FORGEJO_TOKEN; reads of a public repository work without it, uploads don't. */
export function token(required = false) {
let t = process.env.FORGEJO_TOKEN;
if (!t && fs.existsSync(path.join(root, '.env'))) {
t = fs.readFileSync(path.join(root, '.env'), 'utf8').match(/^FORGEJO_TOKEN=(.*)$/m)?.[1]?.trim().replace(/^"|"$/g, '');
}
if (!t && required) {
console.error('FORGEJO_TOKEN is not set.');
process.exit(1);
}
return t;
}
const auth = () => (token() ? { Authorization: `token ${token()}` } : {});
export async function api(method, url, body) {
const headers = { ...auth(), Accept: 'application/json' };
const r = await fetch(url.startsWith('http') ? url : API + url, {
method,
headers: body instanceof FormData ? headers : { ...headers, 'Content-Type': 'application/json' },
body: body === undefined ? undefined : body instanceof FormData ? body : JSON.stringify(body),
});
const text = await r.text();
if (!r.ok) throw new Error(`${method} ${url} → ${r.status} ${text.slice(0, 300)}`);
return text ? JSON.parse(text) : null;
}
/** Downloads a release asset's text (an updater signature). */
export async function download(url) {
const r = await fetch(url, { headers: auth() });
if (!r.ok) throw new Error(`GET ${url} → ${r.status}`);
return r.text();
}
/** The version's section of CHANGELOG.md. */
export function releaseNotes(version) {
const changelog = fs.readFileSync(path.join(root, 'CHANGELOG.md'), 'utf8');
const section = changelog.split(/^## /m).find((s) => s.startsWith(version));
return section ? section.slice(version.length).trim() : '';
}