From 835cdad98b68a056bb69623f964433417e4fa4e3 Mon Sep 17 00:00:00 2001 From: Elijah Date: Fri, 30 Oct 2026 16:39:12 -0700 Subject: [PATCH 01/57] Publish the 0.1.0-beta.1 update feed and release script Co-Authored-By: Claude Opus 5.5 --- docs/development.md | 6 ++-- scripts/publish-release.mjs | 60 +++++++++++++++++++++++++++++++++++++ updates/latest.json | 11 +++++++ 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 scripts/publish-release.mjs create mode 100644 updates/latest.json diff --git a/docs/development.md b/docs/development.md index d2b497d..93381a8 100644 --- a/docs/development.md +++ b/docs/development.md @@ -38,8 +38,10 @@ for that file. 2. `.\scripts\build.ps1` builds the NSIS installer and its signed updater artifact. The updater key is read from `.tools/updater.key` (ignored; keep it safe — replacing it breaks in-app updates for existing installs) or from `TAURI_SIGNING_PRIVATE_KEY`. -3. Create the release (tag `vX.Y.Z`) and upload the files from - `src-tauri/target/release/bundle/nsis/`. +3. Commit, tag `vX.Y.Z` and push, then + `node scripts/publish-release.mjs X.Y.Z [--prerelease]` creates the Forgejo release + with the installer and its `.sig` (notes come from `CHANGELOG.md`). It reads + `FORGEJO_TOKEN` (repository read/write) from the environment or the ignored `.env`. 4. `node scripts/update-manifest.mjs X.Y.Z https://git.elijahkuntz.com/Elijah/Kaleido-Desktop/releases/download/vX.Y.Z notes.md` and commit `updates/latest.json`. Installed copies offer the update on their next start. diff --git a/scripts/publish-release.mjs b/scripts/publish-release.mjs new file mode 100644 index 0000000..111b094 --- /dev/null +++ b/scripts/publish-release.mjs @@ -0,0 +1,60 @@ +// 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. +// Usage: node scripts/publish-release.mjs [--prerelease] +import fs from 'node:fs'; +import path from 'node:path'; + +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) { + console.error('usage: node scripts/publish-release.mjs [--prerelease]'); + 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, ''); +} +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; +} + +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 }); + 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.`); + const existing = release.assets?.find((a) => a.name === name); + if (existing) await api('DELETE', `/releases/${release.id}/assets/${existing.id}`); + const form = new FormData(); + form.append('attachment', new Blob([fs.readFileSync(file)]), name); + const asset = await api('POST', `/releases/${release.id}/assets?name=${encodeURIComponent(name)}`, form); + console.log(`Uploaded ${asset.name} (${asset.size} bytes): ${asset.browser_download_url}`); +} +console.log(release.html_url); diff --git a/updates/latest.json b/updates/latest.json new file mode 100644 index 0000000..1dad909 --- /dev/null +++ b/updates/latest.json @@ -0,0 +1,11 @@ +{ + "platforms": { + "windows-x86_64": { + "signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVURlZleWFKRzhRNUVha1JHaDZ2N1AvaFNheDNDejJKcGZUNjh3bWw5dEorRnJsN1drM0RRTkhMb24ybE9YaldGZUd3RzdYdi9qeExSaEJmRk9td1VNbm9wOGEwL3UzclFRPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzkzNDAzMTY4CWZpbGU6S2FsZWlkb18wLjEuMC1iZXRhLjFfeDY0LXNldHVwLmV4ZQl2ZXJzaW9uOjAuMS4wLWJldGEuMQo0em1GZllUakp3QVpVbVRXZllmYW1HeGtMdXhwWElreFo2dTIxMng2cC9icDNXdWtwMTlkQTNTekU2NFZEazdwZHVtUlozcmVkY0NoQ3Z4bHZDN2VCdz09Cg==", + "url": "https://git.elijahkuntz.com/Elijah/Kaleido-Desktop/releases/download/v0.1.0-beta.1/Kaleido_0.1.0-beta.1_x64-setup.exe" + } + }, + "version": "0.1.0-beta.1", + "notes": "First beta of Kaleido for Windows.\n\n- Sign in with Plex (browser or plex.tv/link) or connect to a server manually; choose a server and switch Plex Home profiles.\n- Home, Movies and TV Shows with Discover, Library and Collections; search; people; rotating featured titles with artwork colour wash.\n- Title pages with clear-logo art, Rotten Tomatoes and IMDb scores, format badges, cast and crew, extras, related titles, seasons and episodes.\n- Direct playback through mpv with hardware decoding and HDR passthrough, Plex conversion qualities, audio and subtitle selection, preview thumbnails, Skip Intro/Credits and next-episode countdown. Progress syncs with Plex.\n- Mouse and keyboard: hover previews, right-click title actions, arrow-key navigation and player shortcuts.\n- Title management: watched state, ratings, collections, playlists, metadata editing with locks, artwork, refresh, analyze, fix match, unmatch, split and delete.\n- Resumable offline downloads of movies, episodes and seasons.\n- App settings and Plex server administration: dashboard, activity, server settings, remote access, libraries, scheduled tasks, devices, troubleshooting and console.\n- Signed in-app updates.", + "pub_date": "2026-10-30T23:39:03.821Z" +} From 4478d2206d6e68cacd7fd306b680c216b3e5cb4c Mon Sep 17 00:00:00 2001 From: Elijah Date: Fri, 30 Oct 2026 17:24:43 -0700 Subject: [PATCH 02/57] Run installer builds only on demand so CI never waits for a missing runner Co-Authored-By: Claude Opus 5.5 --- .forgejo/workflows/build-installers.yml | 44 +++++++++++++++++++++++++ .forgejo/workflows/release.yml | 43 +----------------------- docs/development.md | 5 +-- 3 files changed, 48 insertions(+), 44 deletions(-) create mode 100644 .forgejo/workflows/build-installers.yml diff --git a/.forgejo/workflows/build-installers.yml b/.forgejo/workflows/build-installers.yml new file mode 100644 index 0000000..2c8d973 --- /dev/null +++ b/.forgejo/workflows/build-installers.yml @@ -0,0 +1,44 @@ +name: Build Kaleido Desktop installers +# Started by hand (Actions, then this workflow, then Run). Each platform needs a runner +# with its label; without one the job would wait indefinitely, so this never runs on +# push. Releases can instead be built with scripts/build.ps1 and published with +# scripts/publish-release.mjs. +on: + workflow_dispatch: + +jobs: + build: + strategy: + fail-fast: false + matrix: + include: + - os: windows + runner: windows-latest + # - os: macos + # runner: macos-latest + # - os: linux + # runner: ubuntu-latest + runs-on: ${{ matrix.runner }} + timeout-minutes: 90 + steps: + - uses: https://data.forgejo.org/actions/checkout@v4.4.0 + - name: Build (Windows) + if: matrix.os == 'windows' + shell: pwsh + env: + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} + run: ./scripts/build.ps1 + - name: Build (macOS / Linux) + if: matrix.os != 'windows' + env: + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} + run: | + sh scripts/fetch-libmpv.sh + npm ci + npx tauri build + - uses: https://data.forgejo.org/actions/upload-artifact@v4 + with: + name: kaleido-${{ matrix.os }} + path: src-tauri/target/release/bundle/ diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 68b3941..845ed49 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -1,4 +1,4 @@ -name: Validate and publish Kaleido Desktop +name: Validate Kaleido Desktop on: push: branches: [main] @@ -28,44 +28,3 @@ jobs: curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal . "$HOME/.cargo/env" mkdir -p dist && cargo check --manifest-path src-tauri/Cargo.toml - - # Signed installers per platform for version tags. Each OS needs a runner with - # its label; set the repository variable DESKTOP_RUNNERS=true once they exist. - # Until then, build with scripts/build.ps1 and attach the files to the release. - build: - if: startsWith(github.ref, 'refs/tags/v') && vars.DESKTOP_RUNNERS == 'true' - needs: validate - strategy: - fail-fast: false - matrix: - include: - - os: windows - runner: windows-latest - # - os: macos - # runner: macos-latest - # - os: linux - # runner: ubuntu-latest - runs-on: ${{ matrix.runner }} - timeout-minutes: 90 - steps: - - uses: https://data.forgejo.org/actions/checkout@v4.4.0 - - name: Build (Windows) - if: matrix.os == 'windows' - shell: pwsh - env: - TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} - TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} - run: ./scripts/build.ps1 - - name: Build (macOS / Linux) - if: matrix.os != 'windows' - env: - TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} - TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} - run: | - sh scripts/fetch-libmpv.sh - npm ci - npx tauri build - - uses: https://data.forgejo.org/actions/upload-artifact@v4 - with: - name: kaleido-${{ matrix.os }} - path: src-tauri/target/release/bundle/ diff --git a/docs/development.md b/docs/development.md index 93381a8..dc3d3aa 100644 --- a/docs/development.md +++ b/docs/development.md @@ -48,5 +48,6 @@ for that file. For macOS and Linux, build on those systems (`scripts/fetch-libmpv.sh`, then `npx tauri build`) and merge their bundles into the same feed with `KALEIDO_BUNDLES`. -CI (`.forgejo/workflows/release.yml`) validates every push and builds installers for -tags on runners for each enabled platform. +CI (`.forgejo/workflows/release.yml`) validates every push and tag. Installers are +built locally; `.forgejo/workflows/build-installers.yml` can build them in CI once +runners exist for each platform, and only runs when started by hand. From be865fa992040392ce5616d0f81919f1edd44e67 Mon Sep 17 00:00:00 2001 From: Elijah Date: Fri, 30 Oct 2026 17:28:04 -0700 Subject: [PATCH 03/57] Document the release and push flow for future sessions Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 10 +++++++ CLAUDE.md | 1 + docs/development.md | 52 ++++++++++++++++++++++++++----------- scripts/update-manifest.mjs | 8 +++++- 4 files changed, 55 insertions(+), 16 deletions(-) create mode 100644 CLAUDE.md diff --git a/AGENTS.md b/AGENTS.md index 7c51d00..0ebe3a8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,4 +24,14 @@ - Mute before playback tests (`__kaleido.useSettings.getState().set('volume', 0)`). Playback changes real Plex progress and track selections; restore them. +## Releases + +Built and published locally (CI only validates). In short: bump the version in +`package.json`, `src-tauri/Cargo.toml`, `src-tauri/tauri.conf.json` (+ lockfile), add a +`CHANGELOG.md` section, `.\scripts\build.ps1`, commit + tag `vX.Y.Z` + push, +`node scripts/publish-release.mjs X.Y.Z [--prerelease]`, then +`node scripts/update-manifest.mjs X.Y.Z ` and commit/push +`updates/latest.json`. Full checklist: `docs/development.md` → Releases. Only push or +publish when the user asks. `FORGEJO_TOKEN` lives in the ignored `.env`. + See `docs/architecture.md` and `docs/development.md`. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/docs/development.md b/docs/development.md index dc3d3aa..ad10db4 100644 --- a/docs/development.md +++ b/docs/development.md @@ -33,21 +33,43 @@ for that file. ## Releases -1. Bump the version in `package.json`, `src-tauri/Cargo.toml` and - `src-tauri/tauri.conf.json`. -2. `.\scripts\build.ps1` builds the NSIS installer and its signed updater artifact. The - updater key is read from `.tools/updater.key` (ignored; keep it safe — replacing it - breaks in-app updates for existing installs) or from `TAURI_SIGNING_PRIVATE_KEY`. -3. Commit, tag `vX.Y.Z` and push, then - `node scripts/publish-release.mjs X.Y.Z [--prerelease]` creates the Forgejo release - with the installer and its `.sig` (notes come from `CHANGELOG.md`). It reads - `FORGEJO_TOKEN` (repository read/write) from the environment or the ignored `.env`. -4. `node scripts/update-manifest.mjs X.Y.Z https://git.elijahkuntz.com/Elijah/Kaleido-Desktop/releases/download/vX.Y.Z notes.md` - and commit `updates/latest.json`. Installed copies offer the update on their next - start. +Releases are built and published from this Windows machine. CI only validates; it never +builds installers on push (there are no Windows/macOS runners). Versions follow SemVer; +betas use a prerelease suffix (`0.1.0-beta.1`) and are published as pre-releases. + +Checklist for version `X.Y.Z` (run from the repository root): + +1. **Version**: set `X.Y.Z` in `package.json`, `src-tauri/Cargo.toml` and + `src-tauri/tauri.conf.json`, then `npm install --package-lock-only` to update + `package-lock.json`. +2. **Changelog**: add a `## X.Y.Z` section at the top of `CHANGELOG.md`. It becomes the + release notes and the in-app update notes. +3. **Check**: `npm run typecheck`, `npm test`, `cargo check --manifest-path src-tauri/Cargo.toml`. +4. **Build**: `.\scripts\build.ps1` → `src-tauri/target/release/bundle/nsis/Kaleido_X.Y.Z_x64-setup.exe` + and its `.sig`. The updater key is read from `.tools/updater.key` (ignored; keep it + safe — replacing it breaks in-app updates for existing installs) or from + `TAURI_SIGNING_PRIVATE_KEY`. +5. **Commit and tag**: commit as `Release Kaleido Desktop X.Y.Z`, then + `git tag -a vX.Y.Z -m "Kaleido Desktop X.Y.Z"` and `git push origin main vX.Y.Z` + (SSH remote `origin`, already configured). +6. **Publish**: `node scripts/publish-release.mjs X.Y.Z` (add `--prerelease` for betas) + creates the Forgejo release with the notes from `CHANGELOG.md` and uploads the + installer and `.sig`. It reads `FORGEJO_TOKEN` (repository read/write) from the + environment or the ignored `.env`, and never prints it. Re-running it replaces the + assets. +7. **Update feed**: `node scripts/update-manifest.mjs X.Y.Z https://git.elijahkuntz.com/Elijah/Kaleido-Desktop/releases/download/vX.Y.Z` + rewrites `updates/latest.json`; commit it (`Publish the X.Y.Z update feed`) and push. + Installed copies offer the update on their next start. Publish the feed only after + the release assets exist, or clients would be sent to a missing file. +8. **Verify**: download the installer from the release URL and compare its SHA-256 with + the local file; `https://git.elijahkuntz.com/Elijah/Kaleido-Desktop/raw/branch/main/updates/latest.json` + should show the new version; CI on Actions should finish green. + +The installer is per user (`%LOCALAPPDATA%\Kaleido`, no admin) and is not code-signed, +so SmartScreen warns on first run. In-app updates run it in passive mode and relaunch. For macOS and Linux, build on those systems (`scripts/fetch-libmpv.sh`, then `npx tauri build`) and merge their bundles into the same feed with `KALEIDO_BUNDLES`. -CI (`.forgejo/workflows/release.yml`) validates every push and tag. Installers are -built locally; `.forgejo/workflows/build-installers.yml` can build them in CI once -runners exist for each platform, and only runs when started by hand. +`.forgejo/workflows/release.yml` validates every push and tag; +`.forgejo/workflows/build-installers.yml` can build installers in CI once runners exist +for each platform, and only runs when started by hand. diff --git a/scripts/update-manifest.mjs b/scripts/update-manifest.mjs index 11d2711..8e7f20c 100644 --- a/scripts/update-manifest.mjs +++ b/scripts/update-manifest.mjs @@ -1,5 +1,6 @@ // Writes updates/latest.json, the feed Kaleido's updater reads, from built bundles. // Usage: node scripts/update-manifest.mjs [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. import fs from 'node:fs'; @@ -24,7 +25,12 @@ const PLATFORMS = [ 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 ?? ''; +// 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 ??= {}; From 43c168da95abd37612fe95a07216f7128fd85d1b Mon Sep 17 00:00:00 2001 From: Elijah Date: Fri, 30 Oct 2026 18:06:54 -0700 Subject: [PATCH 04/57] Address the first beta's bugs and requested changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Startup now uses the Android iris animation, and playback can continue in a corner miniplayer while browsing (the video is drawn into a corner rectangle beneath a matching hole in the page). The player keeps the window controls, hides its chrome when the pointer leaves, and gains audio/subtitle tracks, audio sync, source bitrate and playback details in its options. Subtitles can be styled in Settings with a live preview. Categories replace Collections, the A–Z rail magnifies, descriptions expand in place, downloads can be removed in bulk, and search keeps its results while typing. Fixes scroll jank from per-card and scrolling backdrop blurs, the hidden colour wash, the cubic volume curve, loud theme music, the search focus ring, a stray nav indicator, Continue Watching previews and the TV Shows header overlap. Removes the star rating, the duplicate Settings menu entry and the server settings' Show advanced switch. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 17 ++ docs/architecture.md | 11 +- src-tauri/src/lib.rs | 1 + src-tauri/src/platform/linux.rs | 1 + src-tauri/src/platform/macos.rs | 1 + src-tauri/src/platform/mod.rs | 2 +- src-tauri/src/platform/windows.rs | 21 +- src-tauri/src/player.rs | 22 ++ src/app/App.tsx | 11 +- src/app/TopBar.tsx | 9 +- src/app/router.ts | 4 +- src/app/settings.ts | 41 ++- src/main.tsx | 3 +- src/player/PlayerOverlay.tsx | 308 ++++++++++++++++--- src/player/engine.ts | 2 + src/player/store.ts | 118 +++++++- src/player/theme.ts | 16 +- src/plex/api.ts | 8 +- src/screens/Downloads.tsx | 42 ++- src/screens/Item.tsx | 53 +--- src/screens/LibraryBrowser.tsx | 28 +- src/screens/Search.tsx | 5 +- src/screens/Section.tsx | 75 +++-- src/screens/Splash.tsx | 427 +++++++++++++++++++++++++-- src/screens/categories.ts | 78 +++++ src/screens/settings/AppSettings.tsx | 104 ++++++- src/screens/settings/ServerPrefs.tsx | 19 +- src/styles/app.css | 121 ++++---- src/styles/base.css | 17 ++ src/styles/player.css | 193 ++++++++++++ src/styles/screens.css | 278 ++++++++++++++--- src/ui/Backdrop.tsx | 28 +- src/ui/Hero.tsx | 22 +- src/ui/HoverPreview.tsx | 5 +- src/ui/media.tsx | 7 +- 35 files changed, 1771 insertions(+), 327 deletions(-) create mode 100644 src/screens/categories.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f573d1..1ccfa93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## Unreleased + +- New startup animation: the iris opens and the view flies through the aperture, as on Kaleido for TV. +- Miniplayer: the player's back arrow (or Esc) keeps the video playing in the corner while you browse. +- Window controls stay available in the player, and its controls also hide when the pointer leaves the window. +- Playback options now include audio and subtitle tracks, audio sync, the source bitrate for Original quality, subtitle size and background, and playback details. +- Subtitle styling in Settings (size, colour, edge, background, bold, position) with a live preview. +- Categories replace Collections in Movies and TV Shows: genre tiles with artwork that open a filtered library. +- Smoother scrolling: per-card and scrolling backdrop blurs were re-rendering every frame. +- The artwork colour wash is visible again and carries down the page. +- The volume slider follows loudness (halfway is about half as loud), and theme music is much quieter and follows the player volume. +- Search keeps results on screen while you type; the A–Z rail is easier to see and magnifies under the pointer; long descriptions expand when clicked. +- Featured titles rotate faster and preload their artwork; hovering Continue Watching shows a preview. +- Downloads: Remove all (everything, a show, or all movies) and a simpler page. +- Removed: the five-star rating, the duplicate Settings entry in the profile menu and the server settings' Show advanced switch (everything is shown). +- Fixed: double focus ring in search, a stray dot under the navigation, and overlapping text on the TV Shows header. + ## 0.1.0-beta.1 First beta of Kaleido for Windows. diff --git a/docs/architecture.md b/docs/architecture.md index 5af3343..740d222 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -13,7 +13,7 @@ src/ Shared interface (all platforms) plex/ Plex client: account (plex.tv), library API, admin, playback, parsing player/ Playback controller (store.ts), mpv bridge, player overlay downloads/ Download catalog and actions - screens/ Home, Movies/TV (Discover/Library/Collections), title pages, + screens/ Home, Movies/TV (Discover/Library/Categories), title pages, search, people, downloads, settings, dialogs ui/ Design system: primitives, menus/dialogs/toasts, cards, hero styles/ Tokens and styles (base, ui, app, screens, player) @@ -37,14 +37,14 @@ Each exposes the same items: | Item | Windows implementation | | --- | --- | -| `VideoSurface` | mpv renders with `d3d11-output-mode=composition`; its swapchain (`display-swapchain`) is set as the content of a DirectComposition visual targeted at the window with `topmost = false`, i.e. behind the web view's child windows. | +| `VideoSurface` | mpv renders with `d3d11-output-mode=composition`; its swapchain (`display-swapchain`) is set as the content of a DirectComposition visual targeted at the window with `topmost = false`, i.e. behind the web view's child windows. For the miniplayer the visual is offset and mpv's composition size shrunk to a corner rectangle (`player_rect`). | | `MPV_LIBRARIES` | `libmpv-2.dll` | | `hold_awake` | `SetThreadExecutionState` while video plays | macOS and Linux currently provide stubs for `VideoSurface` (browsing, downloads, settings and updates work; playback reports that it is unavailable). To add playback there, render through mpv's render API into a layer beneath the web view and implement -the same five methods. Per-OS bundling (libmpv, targets, dependencies) lives in +the same methods (`set_rect` places the video in part of the window for the miniplayer). Per-OS bundling (libmpv, targets, dependencies) lives in `tauri.macos.conf.json` and `tauri.linux.conf.json`. Credentials use the platform's keychain through the `keyring` crate with per-OS features in `Cargo.toml`. @@ -67,6 +67,9 @@ transparent only while video is visible (`html.video-active`), so browsing is op timestamps kept absolute. If direct play fails, playback retries through Plex once. Plex streams are matched to mpv tracks by stream index; external subtitles are added on demand. Timeline reports every 10 seconds make the session appear in Plex, and the - title is marked watched at the configured percentage. + title is marked watched at the configured percentage. The player's back arrow (or Esc) + shrinks playback into a miniplayer: the video is drawn in a corner rectangle and the + interface stays visible around it, with a matching hole masked out of the page + (`html.player-mini`). - **Updates**: `app/updater.ts` checks the signed feed on start; installs need the user's confirmation and then relaunch. diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 3fad8f2..dba919c 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -40,6 +40,7 @@ pub fn run() { .invoke_handler(tauri::generate_handler![ player::player_init, player::player_show, + player::player_rect, player::player_command, player::player_set, player::player_get, diff --git a/src-tauri/src/platform/linux.rs b/src-tauri/src/platform/linux.rs index d287122..5609089 100644 --- a/src-tauri/src/platform/linux.rs +++ b/src-tauri/src/platform/linux.rs @@ -23,6 +23,7 @@ impl VideoSurface { pub fn on_property(&mut self, _: &str, _: &serde_json::Value) {} pub fn show(&mut self, _: bool) {} pub fn fit(&mut self, _: &WebviewWindow, _: Option<&Mpv>) {} + pub fn set_rect(&mut self, _: &WebviewWindow, _: Option<&Mpv>, _: Option<(i32, i32, i32, i32)>) {} } pub fn hold_awake(rx: std::sync::mpsc::Receiver<()>) { diff --git a/src-tauri/src/platform/macos.rs b/src-tauri/src/platform/macos.rs index 44a51bc..638cee2 100644 --- a/src-tauri/src/platform/macos.rs +++ b/src-tauri/src/platform/macos.rs @@ -23,6 +23,7 @@ impl VideoSurface { pub fn on_property(&mut self, _: &str, _: &serde_json::Value) {} pub fn show(&mut self, _: bool) {} pub fn fit(&mut self, _: &WebviewWindow, _: Option<&Mpv>) {} + pub fn set_rect(&mut self, _: &WebviewWindow, _: Option<&Mpv>, _: Option<(i32, i32, i32, i32)>) {} } pub fn hold_awake(rx: std::sync::mpsc::Receiver<()>) { diff --git a/src-tauri/src/platform/mod.rs b/src-tauri/src/platform/mod.rs index 2478be7..4d5f5e0 100644 --- a/src-tauri/src/platform/mod.rs +++ b/src-tauri/src/platform/mod.rs @@ -2,7 +2,7 @@ //! Each platform file exposes the same items: //! //! - `VideoSurface`: composes mpv's output beneath the web view -//! (`create`, `mpv_options`, `on_property`, `show`, `fit`). +//! (`create`, `mpv_options`, `on_property`, `show`, `fit`, `set_rect`). //! - `SURFACE_PROPERTIES`: mpv properties the surface observes. //! - `MPV_LIBRARIES`: libmpv file names to look for. //! - `hold_awake`: prevents display sleep until the receiver closes. diff --git a/src-tauri/src/platform/windows.rs b/src-tauri/src/platform/windows.rs index 9ec0543..9eb1777 100644 --- a/src-tauri/src/platform/windows.rs +++ b/src-tauri/src/platform/windows.rs @@ -15,6 +15,8 @@ pub struct VideoSurface { _target: IDCompositionTarget, root: IDCompositionVisual, visible: bool, + /// Where the video is drawn, in client pixels; `None` fills the window. + rect: Option<(i32, i32, i32, i32)>, pub width: i32, pub height: i32, } @@ -49,6 +51,7 @@ impl VideoSurface { _target: target, root, visible: false, + rect: None, width, height, }) @@ -102,9 +105,20 @@ impl VideoSurface { } } + /// Matches mpv's composition size and the visual's position to the + /// window's client area, or to the miniplayer rectangle when one is set. pub fn fit(&mut self, window: &WebviewWindow, mpv: Option<&Mpv>) { let Ok(h) = window.hwnd() else { return }; - let (w, h) = client_size(HWND(h.0 as _)); + let (cw, ch) = client_size(HWND(h.0 as _)); + let (x, y, w, h) = match self.rect { + Some((x, y, w, h)) => (x, y, w.max(16), h.max(16)), + None => (0, 0, cw, ch), + }; + unsafe { + let _ = self.root.SetOffsetX2(x as f32); + let _ = self.root.SetOffsetY2(y as f32); + let _ = self.device.Commit(); + } if (w, h) == (self.width, self.height) { return; } @@ -114,6 +128,11 @@ impl VideoSurface { let _ = mpv.set_property("d3d11-composition-size", &serde_json::Value::String(format!("{w}x{h}"))); } } + + pub fn set_rect(&mut self, window: &WebviewWindow, mpv: Option<&Mpv>, rect: Option<(i32, i32, i32, i32)>) { + self.rect = rect; + self.fit(window, mpv); + } } /// mpv properties the surface needs to observe. diff --git a/src-tauri/src/player.rs b/src-tauri/src/player.rs index 43f2d3e..0e8cb5f 100644 --- a/src-tauri/src/player.rs +++ b/src-tauri/src/player.rs @@ -180,6 +180,28 @@ pub async fn player_show(app: AppHandle, window: WebviewWindow Ok(()) } +#[derive(Deserialize)] +pub struct VideoRect { + x: f64, + y: f64, + width: f64, + height: f64, +} + +/// Draws the video in a rectangle of the window (physical pixels), for the +/// miniplayer; `None` fills the window again. +#[tauri::command] +pub async fn player_rect(app: AppHandle, window: WebviewWindow, rect: Option) -> Result<(), String> { + let state = app.state::(); + let mpv = state.mpv.lock().clone(); + let mut surface = state.surface.lock(); + if let Some(surface) = surface.as_mut() { + let rect = rect.map(|r| (r.x.round() as i32, r.y.round() as i32, r.width.round() as i32, r.height.round() as i32)); + surface.set_rect(&window, mpv.as_deref(), rect); + } + Ok(()) +} + #[tauri::command] pub async fn player_command(app: AppHandle, args: Vec) -> Result<(), String> { player(&app)?.command(&args) diff --git a/src/app/App.tsx b/src/app/App.tsx index 77cf583..7c98113 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -33,7 +33,7 @@ function Screen({ route }: { route: Route }) { case 'home': return ; case 'section': - return ; + return ; case 'item': return ; case 'person': @@ -94,8 +94,9 @@ function Page({ onScrolled }: { onScrolled: (top: number) => void }) { function useGlobalShortcuts() { useEffect(() => { const isTyping = (t: EventTarget | null) => t instanceof HTMLElement && (t.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(t.tagName)); + const playerFull = () => usePlayer.getState().open && !usePlayer.getState().mini; const onKey = (e: KeyboardEvent) => { - if (usePlayer.getState().open) return; + if (playerFull()) return; if ((e.ctrlKey || e.metaKey) && (e.key === 'k' || e.key === 'f')) { e.preventDefault(); navigate({ name: 'search' }); @@ -118,7 +119,7 @@ function useGlobalShortcuts() { }; // Mouse back/forward buttons. const onMouse = (e: MouseEvent) => { - if (usePlayer.getState().open) return; + if (playerFull()) return; if (e.button === 3) { e.preventDefault(); useRouter.getState().back(); @@ -144,7 +145,7 @@ function useLibrarySync() { let last = ''; let stopped = false; const tick = async () => { - if (stopped || document.hidden || usePlayer.getState().open) return; + if (stopped || document.hidden || (usePlayer.getState().open && !usePlayer.getState().mini)) return; try { const rev = await libraryRevision(server); if (last && rev !== last) invalidateLibrary(); @@ -167,7 +168,7 @@ function useLibrarySync() { function Shell() { const [scrolled, setScrolled] = useState(false); - const playerOpen = usePlayer((s) => s.open); + const playerOpen = usePlayer((s) => s.open && !s.mini); const startPage = useSettings.getState().startPage; useGlobalShortcuts(); useLibrarySync(); diff --git a/src/app/TopBar.tsx b/src/app/TopBar.tsx index 0e05da2..33e7b80 100644 --- a/src/app/TopBar.tsx +++ b/src/app/TopBar.tsx @@ -16,7 +16,7 @@ const NAV = [ { id: 'downloads', label: 'Downloads', route: { name: 'downloads' } as const }, ]; -function WindowControls() { +export function WindowControls() { const [maximized, setMaximized] = useState(false); useEffect(() => { if (!isNative) return; @@ -67,11 +67,8 @@ function Avatar() { submenu: home.users.map((u) => ({ label: u.title, checked: u.uuid === user?.uuid, onSelect: () => home.switchTo(u) })), }); } - items.push( - { divider: true }, - { label: 'Settings', icon: 'settings', onSelect: () => navigate({ name: 'settings', mode: 'app', tab: 'general' }) }, - ); - if (server?.owned) items.push({ label: 'Server dashboard', icon: 'activity', onSelect: () => navigate({ name: 'settings', mode: 'server', tab: 'dashboard' }) }); + // Settings has its own button in the bar; the menu keeps account actions. + if (server?.owned) items.push({ divider: true }, { label: 'Server dashboard', icon: 'activity', onSelect: () => navigate({ name: 'settings', mode: 'server', tab: 'dashboard' }) }); items.push({ divider: true }, { label: 'Sign out', icon: 'logout', onSelect: signOut }); openMenu(items, el, { align: 'end', minWidth: 250 }); }; diff --git a/src/app/router.ts b/src/app/router.ts index 943b176..14a5c6f 100644 --- a/src/app/router.ts +++ b/src/app/router.ts @@ -1,11 +1,11 @@ import { create } from 'zustand'; export type SectionKind = 'movie' | 'show'; -export type SectionTab = 'discover' | 'library' | 'collections'; +export type SectionTab = 'discover' | 'library' | 'categories'; export type Route = | { name: 'home' } - | { name: 'section'; kind: SectionKind; tab: SectionTab } + | { name: 'section'; kind: SectionKind; tab: SectionTab; genre?: string; genreTitle?: string } | { name: 'item'; id: string; title?: string } | { name: 'person'; id: string; title: string; thumb?: string } | { name: 'hub'; key: string; title: string } diff --git a/src/app/settings.ts b/src/app/settings.ts index 314a7cd..b921e3a 100644 --- a/src/app/settings.ts +++ b/src/app/settings.ts @@ -4,6 +4,9 @@ import { persist } from 'zustand/middleware'; export type Quality = 'original' | '2160' | '1080' | '720' | '480'; export type SkipMode = 'off' | 'button' | 'auto'; export type SubtitleMode = 'auto' | 'always' | 'forced' | 'off'; +export type SubtitleEdge = 'outline' | 'shadow' | 'raised' | 'none'; +export type SubtitleBox = 'none' | 'translucent' | 'solid'; +export type SubtitlePosition = 'low' | 'normal' | 'high'; export interface Preferences { // Playback @@ -20,7 +23,11 @@ export interface Preferences { subtitleMode: SubtitleMode; subtitleLanguage: string; subtitleScale: number; - subtitleBackground: boolean; + subtitleColor: string; + subtitleEdge: SubtitleEdge; + subtitleBox: SubtitleBox; + subtitleBold: boolean; + subtitlePosition: SubtitlePosition; volume: number; seekStep: number; // Interface @@ -54,7 +61,11 @@ export const defaults: Preferences = { subtitleMode: 'auto', subtitleLanguage: '', subtitleScale: 1, - subtitleBackground: false, + subtitleColor: '#FFFFFF', + subtitleEdge: 'outline', + subtitleBox: 'none', + subtitleBold: false, + subtitlePosition: 'normal', volume: 100, seekStep: 10, startPage: 'home', @@ -82,7 +93,19 @@ export const useSettings = create()( set: (key, value) => set({ [key]: value } as Partial), reset: () => set({ ...defaults }), }), - { name: 'kaleido.settings', version: 1 }, + { + name: 'kaleido.settings', + version: 2, + migrate: (persisted, version) => { + const p = (persisted ?? {}) as Record; + // 1 → 2: the subtitle background switch became a box style. + if (version < 2 && 'subtitleBackground' in p) { + p.subtitleBox = p.subtitleBackground ? 'translucent' : 'none'; + delete p.subtitleBackground; + } + return p as unknown as SettingsState; + }, + }, ), ); @@ -100,3 +123,15 @@ export const QUALITY_PROFILE: Record, { kbps: numbe '720': { kbps: 4000, width: 1280, height: 720 }, '480': { kbps: 1500, width: 854, height: 480 }, }; + +export const SUBTITLE_COLORS: { value: string; label: string }[] = [ + { value: '#FFFFFF', label: 'White' }, + { value: '#FFE14D', label: 'Yellow' }, + { value: '#7FE3F0', label: 'Cyan' }, + { value: '#9BE58A', label: 'Green' }, + { value: '#F4A6D7', label: 'Pink' }, + { value: '#BFC5CA', label: 'Grey' }, +]; + +/** Bottom margin in mpv's scaled pixels (720 = window height). */ +export const SUBTITLE_MARGIN: Record = { low: 14, normal: 34, high: 80 }; diff --git a/src/main.tsx b/src/main.tsx index ccf9b98..b0fc91d 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -12,8 +12,9 @@ import { useSession } from './app/session'; import { useRouter } from './app/router'; import { usePlayer } from './player/store'; import { useSettings } from './app/settings'; +import { useDownloads } from './downloads/store'; -if (import.meta.env.DEV) (window as any).__kaleido = { useSession, useRouter, usePlayer, useSettings }; +if (import.meta.env.DEV) (window as any).__kaleido = { useSession, useRouter, usePlayer, useSettings, useDownloads }; // No browser context menu or text-selection chrome outside inputs: this is an app. window.addEventListener('contextmenu', (e) => { diff --git a/src/player/PlayerOverlay.tsx b/src/player/PlayerOverlay.tsx index 9a026c9..3ee8dab 100644 --- a/src/player/PlayerOverlay.tsx +++ b/src/player/PlayerOverlay.tsx @@ -1,30 +1,51 @@ import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react'; import { usePlayer } from './store'; import { useSession } from '../app/session'; -import { useSettings, QUALITY_LABEL, type Quality } from '../app/settings'; -import { clock, episodeLabel } from '../app/format'; +import { useSettings, QUALITY_LABEL, type Quality, type SubtitleBox } from '../app/settings'; +import { bitrate, channelLabel, clock, episodeLabel, resolutionLabel } from '../app/format'; import { Icon } from '../ui/Icon'; import { Facts, TitleArt } from '../ui/media'; import { Button, Spinner } from '../ui/primitives'; import { win, isNative } from '../platform/native'; +import { WindowControls } from '../app/TopBar'; +import { mpv } from './engine'; import type { Item } from '../plex/types'; const HIDE_AFTER = 3000; +/** + * Controls show on pointer movement and hide after a few seconds of stillness, + * or straight away when the pointer leaves the window. They stay while paused + * (until the pointer leaves) and while a panel is open or the timeline is held. + */ function useAutoHide(paused: boolean, pinned: boolean) { const [visible, setVisible] = useState(true); const timer = useRef | null>(null); + const state = useRef({ paused, pinned }); + state.current = { paused, pinned }; const poke = useCallback(() => { setVisible(true); if (timer.current) clearTimeout(timer.current); - timer.current = setTimeout(() => setVisible(false), HIDE_AFTER); + timer.current = null; + if (!state.current.paused && !state.current.pinned) timer.current = setTimeout(() => setVisible(false), HIDE_AFTER); }, []); useEffect(() => { - if (paused || pinned) { - if (timer.current) clearTimeout(timer.current); - setVisible(true); - } else poke(); + poke(); }, [paused, pinned, poke]); + useEffect(() => { + const leave = () => { + if (state.current.pinned) return; + if (timer.current) clearTimeout(timer.current); + timer.current = null; + setVisible(false); + }; + const root = document.documentElement; + root.addEventListener('mouseleave', leave); + return () => { + root.removeEventListener('mouseleave', leave); + if (timer.current) clearTimeout(timer.current); + }; + }, []); return { visible, poke }; } @@ -123,20 +144,27 @@ function Timeline({ onScrub }: { onScrub: (active: boolean) => void }) { ); } -function Panel({ title, onClose, children, className = '' }: { title: string; onClose: () => void; children: ReactNode; className?: string }) { +function Panel({ title, onClose, onBack, children, className = '' }: { title: string; onClose: () => void; onBack?: () => void; children: ReactNode; className?: string }) { useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') { e.stopPropagation(); - onClose(); + (onBack ?? onClose)(); } }; window.addEventListener('keydown', onKey, true); return () => window.removeEventListener('keydown', onKey, true); - }, [onClose]); + }, [onClose, onBack]); return (
e.stopPropagation()} onDoubleClick={(e) => e.stopPropagation()}> -
{title}
+
+ {onBack && ( + + )} + {title} +
{children}
); @@ -172,58 +200,145 @@ function TracksPanel({ onClose }: { onClose: () => void }) { {st.subTracks.map((t) => (