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,11 +1,12 @@
|
|||
// Creates (or reuses) a Forgejo release for a tag and uploads the Windows installer and
|
||||
// its updater signature. Reads FORGEJO_TOKEN from the environment or the ignored .env.
|
||||
// Creates (or reuses) a Forgejo release for a tag and uploads this machine's build of it:
|
||||
// the Windows installer, or the macOS disk image and updater archive, each with its
|
||||
// updater signature. Run it on each OS after building; both land in the same release.
|
||||
// Reads FORGEJO_TOKEN from the environment or the ignored .env.
|
||||
// Usage: node scripts/publish-release.mjs <version> [--prerelease]
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { api, bundleDir, releaseNotes, token } from './release-common.mjs';
|
||||
|
||||
const API = 'https://git.elijahkuntz.com/api/v1/repos/Elijah/Kaleido-Desktop';
|
||||
const root = path.resolve(import.meta.dirname, '..');
|
||||
const version = process.argv[2];
|
||||
const prerelease = process.argv.includes('--prerelease');
|
||||
if (!version) {
|
||||
|
|
@ -13,43 +14,38 @@ if (!version) {
|
|||
process.exit(1);
|
||||
}
|
||||
|
||||
let token = process.env.FORGEJO_TOKEN;
|
||||
if (!token && fs.existsSync(path.join(root, '.env'))) {
|
||||
token = fs.readFileSync(path.join(root, '.env'), 'utf8').match(/^FORGEJO_TOKEN=(.*)$/m)?.[1]?.trim().replace(/^"|"$/g, '');
|
||||
/** This version's release files as built on this OS (scripts/build.ps1 or scripts/build.sh). */
|
||||
function builtFiles() {
|
||||
if (process.platform === 'win32') {
|
||||
const dir = path.join(bundleDir, 'nsis');
|
||||
return [`Kaleido_${version}_x64-setup.exe`, `Kaleido_${version}_x64-setup.exe.sig`].map((n) => path.join(dir, n));
|
||||
}
|
||||
if (process.platform === 'darwin') {
|
||||
const arch = process.arch === 'arm64' ? 'aarch64' : 'x64';
|
||||
return [
|
||||
path.join(bundleDir, 'dmg', `Kaleido_${version}_${arch}.dmg`),
|
||||
path.join(bundleDir, 'macos', `Kaleido_${version}_${arch}.app.tar.gz`),
|
||||
path.join(bundleDir, 'macos', `Kaleido_${version}_${arch}.app.tar.gz.sig`),
|
||||
];
|
||||
}
|
||||
throw new Error('Publish releases from Windows or macOS.');
|
||||
}
|
||||
if (!token) {
|
||||
console.error('FORGEJO_TOKEN is not set.');
|
||||
process.exit(1);
|
||||
}
|
||||
const headers = { Authorization: `token ${token}`, Accept: 'application/json' };
|
||||
|
||||
async function api(method, url, body) {
|
||||
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;
|
||||
token(true);
|
||||
const files = builtFiles();
|
||||
for (const file of files) {
|
||||
if (!fs.existsSync(file)) throw new Error(`Missing ${file}; build this version first.`);
|
||||
}
|
||||
|
||||
const tag = `v${version}`;
|
||||
const changelog = fs.readFileSync(path.join(root, 'CHANGELOG.md'), 'utf8');
|
||||
const section = changelog.split(/^## /m).find((s) => s.startsWith(version));
|
||||
const notes = section ? section.slice(version.length).trim() : '';
|
||||
|
||||
let release = await api('GET', `/releases/tags/${tag}`).catch(() => null);
|
||||
if (!release) {
|
||||
release = await api('POST', '/releases', { tag_name: tag, name: `Kaleido Desktop ${version}`, body: notes, prerelease, draft: false });
|
||||
release = await api('POST', '/releases', { tag_name: tag, name: `Kaleido Desktop ${version}`, body: releaseNotes(version), prerelease, draft: false });
|
||||
console.log(`Created release ${release.name}`);
|
||||
} else console.log(`Using existing release ${release.name}`);
|
||||
|
||||
const dir = path.join(root, 'src-tauri/target/release/bundle/nsis');
|
||||
const files = [`Kaleido_${version}_x64-setup.exe`, `Kaleido_${version}_x64-setup.exe.sig`];
|
||||
for (const name of files) {
|
||||
const file = path.join(dir, name);
|
||||
if (!fs.existsSync(file)) throw new Error(`Missing ${file}; run scripts/build.ps1 first.`);
|
||||
for (const file of files) {
|
||||
const name = path.basename(file);
|
||||
const existing = release.assets?.find((a) => a.name === name);
|
||||
if (existing) await api('DELETE', `/releases/${release.id}/assets/${existing.id}`);
|
||||
const form = new FormData();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue