Kaleido-Desktop/scripts/update-manifest.mjs
Elijah 00d72e70f4 Create Kaleido Desktop, a cinematic Plex client for Windows
Tauri 2 shell with a React/TypeScript interface and libmpv playback composed
beneath the web view (DirectComposition on Windows). Shared code with per-OS
platform modules and configs so macOS and Linux can follow.

- Plex sign-in (browser, plex.tv/link or manual), server selection, Plex Home
- Home, Movies and TV Shows (Discover, Library, Collections), search, people
- Title pages with logos, ratings, cast, extras, seasons and episodes
- Direct play with Plex conversion fallback, tracks, markers, autoplay
- Metadata editing, artwork, fix match, refresh, analyze and deletion
- Resumable offline downloads
- App settings and Plex server administration with a live dashboard
- Signed updater feed and Forgejo CI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 16:26:37 -07:00

47 lines
2.2 KiB
JavaScript

// Writes updates/latest.json, the feed Kaleido's updater reads, from built bundles.
// Usage: node scripts/update-manifest.mjs <version> <baseDownloadUrl> [notesFile]
// 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.
import fs from 'node:fs';
import path from 'node:path';
const [version, baseUrl, notesFile] = process.argv.slice(2);
if (!version || !baseUrl) {
console.error('usage: node scripts/update-manifest.mjs <version> <baseDownloadUrl> [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. */
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$/ },
];
const manifestPath = path.join(root, 'updates/latest.json');
const manifest = fs.existsSync(manifestPath) ? JSON.parse(fs.readFileSync(manifestPath, 'utf8')) : { platforms: {} };
manifest.version = version;
manifest.notes = notesFile ? fs.readFileSync(notesFile, 'utf8').trim() : manifest.notes ?? '';
manifest.pub_date = new Date().toISOString();
manifest.platforms ??= {};
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}`);
}
}
fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
console.log(`Wrote ${path.relative(root, manifestPath)}`);