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>
This commit is contained in:
commit
00d72e70f4
121 changed files with 25315 additions and 0 deletions
64
src/app/updater.ts
Normal file
64
src/app/updater.ts
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* Application updates through Tauri's signed updater. The feed
|
||||
* (`updates/latest.json`) lists a build per platform, so the same flow serves
|
||||
* Windows, macOS and Linux.
|
||||
*/
|
||||
import { create } from 'zustand';
|
||||
import { isNative } from '../platform/native';
|
||||
import { toast } from '../ui/overlays';
|
||||
|
||||
interface UpdaterState {
|
||||
checking: boolean;
|
||||
installing: boolean;
|
||||
progress: number;
|
||||
checkedAt: number;
|
||||
error: string;
|
||||
available: { version: string; notes: string } | null;
|
||||
}
|
||||
|
||||
export const useUpdater = create<UpdaterState>(() => ({
|
||||
checking: false,
|
||||
installing: false,
|
||||
progress: 0,
|
||||
checkedAt: 0,
|
||||
error: '',
|
||||
available: null,
|
||||
}));
|
||||
|
||||
let pending: import('@tauri-apps/plugin-updater').Update | null = null;
|
||||
|
||||
export async function checkForUpdate(manual = false) {
|
||||
if (!isNative || useUpdater.getState().checking) return;
|
||||
useUpdater.setState({ checking: true, error: '' });
|
||||
try {
|
||||
const { check } = await import('@tauri-apps/plugin-updater');
|
||||
const update = await check({ timeout: 15000 });
|
||||
pending = update;
|
||||
useUpdater.setState({ available: update ? { version: update.version, notes: update.body ?? '' } : null, checkedAt: Date.now() });
|
||||
if (update && !manual) toast(`Kaleido ${update.version} is available`, 'info', { label: 'Install', onClick: installUpdate });
|
||||
} catch (e: any) {
|
||||
if (manual) useUpdater.setState({ error: `Couldn’t check for updates: ${e?.message ?? e}` });
|
||||
} finally {
|
||||
useUpdater.setState({ checking: false });
|
||||
}
|
||||
}
|
||||
|
||||
export async function installUpdate() {
|
||||
if (!pending) return;
|
||||
useUpdater.setState({ installing: true, progress: 0 });
|
||||
try {
|
||||
let total = 0;
|
||||
let received = 0;
|
||||
await pending.downloadAndInstall((event) => {
|
||||
if (event.event === 'Started') total = event.data.contentLength ?? 0;
|
||||
else if (event.event === 'Progress') {
|
||||
received += event.data.chunkLength;
|
||||
if (total) useUpdater.setState({ progress: received / total });
|
||||
}
|
||||
});
|
||||
const { relaunch } = await import('@tauri-apps/plugin-process');
|
||||
await relaunch();
|
||||
} catch (e: any) {
|
||||
useUpdater.setState({ installing: false, error: `The update couldn’t be installed: ${e?.message ?? e}` });
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue