The static export now works away from the oTunes server. It picks a server at /server (saved in localStorage), connects Convex to it, and loads covers, avatars and streams from it. Streams and avatars pass the session token as a `token` query parameter, which the song and avatar routes accept alongside the cookie. The server allows any origin on /api. Electron serves that export from 127.0.0.1:47836 and drops the bundled Next.js server, the media gateway, symlink materializing and Sharp pruning. The same export can ship in a Tauri app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3.2 KiB
oTunes desktop
The Windows and Linux desktop app. It runs stock Electron and serves the web app's static export (pnpm --filter @otunes/web build:export) from http://127.0.0.1:47836. There is no bundled Node.js server: the UI talks to the selected oTunes server and its Convex backend directly. On first launch, enter the oTunes server domain, then sign in. The address and session are saved in the app's local storage, not compiled into the package.
For music.example.com, Convex connects to https://convex.music.example.com. Local hosts follow the mobile convention and use port 3210. The selected server streams audio and serves cover art and avatars. Streams and avatars pass the session token as a token query parameter, since the app is on another origin and has no cookie there. The desktop app does not bundle Convex, FFmpeg or a music library.
Use Server > Change server or Change Server in the account menu to select another server. Sessions are kept per server; switching clears the cached library data.
Stock Chromium cannot decode EAC-3, so the player's codec check reports no Dolby Atmos support and the server streams the regular track instead.
Run and package
pnpm install
pnpm dev:desktop
# Or create installers for this OS, x64 and ARM64:
pnpm build:desktop
# Or a specific target from a Linux host:
pnpm --filter @otunes/desktop build:windows
pnpm --filter @otunes/desktop build:linux
All of these first build the static export and copy it to apps/desktop/web. pnpm --filter @otunes/desktop build:web does that step alone. A single instance owns port 47836, so the app's local storage keeps the same origin between launches.
Packaging writes to apps/desktop/dist: an NSIS installer per architecture for Windows, a Flatpak per architecture for Linux. To pick one architecture, pass it after the target: node scripts/package.mjs linux x64. Building Windows installers on Linux needs Wine. Flatpaks need flatpak-builder with Flathub added, and ARM64 Flatpaks on an x64 host need qemu-user-static registered with binfmt. Installers are unsigned unless you configure electron-builder's signing environment.
Flatpaks pin org.freedesktop.Platform, its SDK and org.electronjs.Electron2.BaseApp to 25.08. Network, audio, graphics and display access are enabled. Home-directory access is not needed.
Gitea builds
.gitea/workflows/desktop-build.yml runs manually and on v* tags, matching the Docker workflow. Both jobs run on the ubuntu-latest Docker runner and upload installers with actions/upload-artifact@v3. Tags set the installer version, so use semantic version tags such as v1.2.3. Manual runs use the desktop package version. Nothing is published.
Both jobs use the electronuserland/builder:wine container: windows builds x64 and ARM64 NSIS installers, and linux installs flatpak-builder from apt and builds x64 and ARM64 Flatpaks.
The Linux job needs two things from the runner host:
- Privileged job containers, since flatpak-builder sandboxes its build. Set
container.privileged: truein the runner's config. - An ARM64 binfmt handler. Register it once with
apt install qemu-user-staticon Debian/Ubuntu, which persists across reboots.