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:
parent
a3c05e9062
commit
7d0803481b
39 changed files with 1191 additions and 230 deletions
|
|
@ -1,53 +1,56 @@
|
|||
// Writes updates/latest.json, the feed Kaleido's updater reads, from built bundles.
|
||||
// Usage: node scripts/update-manifest.mjs <version> <baseDownloadUrl> [notesFile]
|
||||
// Notes come from the version's CHANGELOG.md section unless a notes file is given.
|
||||
// Each platform's signed artifact (and its .sig) must be in src-tauri/target/release/bundle,
|
||||
// or pass several bundle folders via KALEIDO_BUNDLES (path;path) when collecting CI outputs.
|
||||
// Writes updates/latest.json, the feed Kaleido's updater reads, from a published release:
|
||||
// each platform's updater artifact and signature are taken from the release's assets, so
|
||||
// the feed only ever points at this version's files, whichever machine runs it.
|
||||
// Usage: node scripts/update-manifest.mjs <version> [--allow-missing] [notesFile]
|
||||
// Every platform in PLATFORMS must be in the release (publish from each OS first);
|
||||
// --allow-missing writes the feed anyway, leaving the missing platforms out of it, so
|
||||
// their installs simply see no update until the feed is regenerated.
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { api, download, releaseNotes, root } from './release-common.mjs';
|
||||
|
||||
const [version, baseUrl, notesFile] = process.argv.slice(2);
|
||||
if (!version || !baseUrl) {
|
||||
console.error('usage: node scripts/update-manifest.mjs <version> <baseDownloadUrl> [notesFile]');
|
||||
const args = process.argv.slice(2);
|
||||
const allowMissing = args.includes('--allow-missing');
|
||||
const [version, notesFile] = args.filter((a) => !a.startsWith('--'));
|
||||
if (!version) {
|
||||
console.error('usage: node scripts/update-manifest.mjs <version> [--allow-missing] [notesFile]');
|
||||
process.exit(1);
|
||||
}
|
||||
const root = path.resolve(import.meta.dirname, '..');
|
||||
const bundles = (process.env.KALEIDO_BUNDLES ?? path.join(root, 'src-tauri/target/release/bundle')).split(';');
|
||||
|
||||
/** Tauri updater platform keys and the artifact each one installs. */
|
||||
/** Tauri updater platform keys and the release asset each one installs. */
|
||||
const PLATFORMS = [
|
||||
{ key: 'windows-x86_64', dir: 'nsis', match: /-setup\.exe$/ },
|
||||
{ key: 'darwin-aarch64', dir: 'macos', match: /aarch64.*\.app\.tar\.gz$/ },
|
||||
{ key: 'darwin-x86_64', dir: 'macos', match: /x64.*\.app\.tar\.gz$/ },
|
||||
{ key: 'linux-x86_64', dir: 'appimage', match: /\.AppImage$/ },
|
||||
{ key: 'windows-x86_64', match: (f) => f === `Kaleido_${version}_x64-setup.exe` },
|
||||
{ key: 'darwin-aarch64', match: (f) => f === `Kaleido_${version}_aarch64.app.tar.gz` },
|
||||
];
|
||||
|
||||
const manifestPath = path.join(root, 'updates/latest.json');
|
||||
const manifest = fs.existsSync(manifestPath) ? JSON.parse(fs.readFileSync(manifestPath, 'utf8')) : { platforms: {} };
|
||||
manifest.version = version;
|
||||
// Notes default to this version's section of CHANGELOG.md.
|
||||
const changelogNotes = () => {
|
||||
const section = fs.readFileSync(path.join(root, 'CHANGELOG.md'), 'utf8').split(/^## /m).find((x) => x.startsWith(version));
|
||||
return section ? section.slice(version.length).trim() : '';
|
||||
};
|
||||
manifest.notes = notesFile ? fs.readFileSync(notesFile, 'utf8').trim() : changelogNotes();
|
||||
manifest.pub_date = new Date().toISOString();
|
||||
manifest.platforms ??= {};
|
||||
const release = await api('GET', `/releases/tags/v${version}`).catch(() => null);
|
||||
if (!release) throw new Error(`No release v${version}; publish it with scripts/publish-release.mjs first.`);
|
||||
const assets = release.assets ?? [];
|
||||
|
||||
for (const bundle of bundles) {
|
||||
for (const p of PLATFORMS) {
|
||||
const dir = path.join(bundle, p.dir);
|
||||
if (!fs.existsSync(dir)) continue;
|
||||
const file = fs.readdirSync(dir).find((f) => p.match.test(f) && f.includes(version));
|
||||
if (!file || !fs.existsSync(path.join(dir, `${file}.sig`))) continue;
|
||||
manifest.platforms[p.key] = {
|
||||
signature: fs.readFileSync(path.join(dir, `${file}.sig`), 'utf8').trim(),
|
||||
url: `${baseUrl.replace(/\/$/, '')}/${encodeURIComponent(file)}`,
|
||||
};
|
||||
console.log(`${p.key}: ${file}`);
|
||||
const platforms = {};
|
||||
const missing = [];
|
||||
for (const p of PLATFORMS) {
|
||||
const artifact = assets.find((a) => p.match(a.name));
|
||||
const sig = artifact && assets.find((a) => a.name === `${artifact.name}.sig`);
|
||||
if (!artifact || !sig) {
|
||||
missing.push(p.key);
|
||||
continue;
|
||||
}
|
||||
platforms[p.key] = { signature: (await download(sig.browser_download_url)).trim(), url: artifact.browser_download_url };
|
||||
console.log(`${p.key}: ${artifact.name}`);
|
||||
}
|
||||
if (missing.length && !allowMissing) {
|
||||
console.error(`v${version} has no build for ${missing.join(', ')}. Publish it from that OS, or pass --allow-missing.`);
|
||||
process.exit(1);
|
||||
}
|
||||
if (!Object.keys(platforms).length) throw new Error(`v${version} has no updater artifacts.`);
|
||||
|
||||
fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
|
||||
const manifest = {
|
||||
version,
|
||||
notes: notesFile ? fs.readFileSync(notesFile, 'utf8').trim() : releaseNotes(version),
|
||||
pub_date: new Date().toISOString(),
|
||||
platforms,
|
||||
};
|
||||
const manifestPath = path.join(root, 'updates/latest.json');
|
||||
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
|
||||
console.log(`Wrote ${path.relative(root, manifestPath)}`);
|
||||
console.log(`Wrote ${path.relative(root, manifestPath)}${missing.length ? ` (without ${missing.join(', ')})` : ''}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue