feat(desktop): add Electron app and desktop builds #84
No files matched your search
@@ -0,0 +1,70 @@
|
||||
name: Desktop builds
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# Both targets build in electronuserland/builder:wine. Wine lets
|
||||
# electron-builder stamp the Windows executable; the Flatpak job adds
|
||||
# flatpak-builder and needs a privileged container for its sandbox.
|
||||
# See apps/desktop/README.md for the runner setup.
|
||||
name: Desktop ${{ matrix.target }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 90
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: windows
|
||||
options: ""
|
||||
- target: linux
|
||||
options: --privileged
|
||||
container:
|
||||
image: electronuserland/builder:wine
|
||||
options: ${{ matrix.options }}
|
||||
env:
|
||||
OTUNES_DESKTOP_REF: ${{ gitea.ref }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10.1.0
|
||||
run_install: false
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
- name: Install Flatpak tools
|
||||
if: matrix.target == 'linux'
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y flatpak flatpak-builder
|
||||
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
- name: Install desktop and web dependencies
|
||||
run: pnpm --filter @otunes/desktop --filter @otunes/web... install --frozen-lockfile
|
||||
|
||||
- name: Check desktop scripts
|
||||
run: pnpm --filter @otunes/desktop typecheck
|
||||
|
||||
- name: Build x64 and ARM64 installers
|
||||
run: pnpm --filter @otunes/desktop build:${{ matrix.target }}
|
||||
|
||||
# Gitea's artifact service uses the v3 protocol, not GitHub's v4 service.
|
||||
- name: Upload installers
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: otunes-desktop-${{ matrix.target }}
|
||||
path: |
|
||||
apps/desktop/dist/*.exe
|
||||
apps/desktop/dist/*.flatpak
|
||||
if-no-files-found: error
|
||||
@@ -47,3 +47,9 @@ docker-compose.yml
|
||||
**/credentials/
|
||||
**/*.ipa
|
||||
**/*.apk
|
||||
|
||||
# Electron desktop build artifacts
|
||||
apps/desktop/.package/
|
||||
apps/desktop/dist/
|
||||
apps/web/.next-desktop/
|
||||
apps/desktop/web/
|
||||
@@ -9,6 +9,7 @@ This project uses [pnpm workspaces](https://pnpm.io/workspaces):
|
||||
| Package | Path | Description |
|
||||
| --- | --- | --- |
|
||||
| `@otunes/web` | `apps/web` | Next.js web app |
|
||||
| `@otunes/desktop` | `apps/desktop` | Electron client for Windows and Linux |
|
||||
| `@otunes/mobile` | `apps/mobile` | Expo React Native mobile app |
|
||||
| `@otunes/convex` | `packages/convex` | Shared Convex backend and client types |
|
||||
|
||||
@@ -94,3 +95,7 @@ If Convex has to live somewhere else, set `PUBLIC_CONVEX_URL` on the container t
|
||||
## Downloads
|
||||
|
||||
Check the releases tab for the latest downloads for apps: [Releases](https://git.abunchofknowitalls.com/joshuafhiggins/otunes/releases)
|
||||
|
||||
## Desktop builds
|
||||
|
||||
See [the desktop build guide](apps/desktop/README.md) to package the web player for Windows or Linux. The UI is bundled locally, and users choose their oTunes server before signing in.
|
||||
@@ -0,0 +1,38 @@
|
||||
# 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
|
||||
|
||||
```sh
|
||||
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: true` in the runner's config.
|
||||
- An ARM64 binfmt handler. Register it once with `apt install qemu-user-static` on Debian/Ubuntu, which persists across reboots.
|
||||
@@ -0,0 +1,144 @@
|
||||
const { app, BrowserWindow, Menu, nativeTheme, session } = require("electron")
|
||||
const { createServer } = require("node:http")
|
||||
const { readFile } = require("node:fs/promises")
|
||||
const path = require("node:path")
|
||||
|
||||
// The UI is the web app's static export, served on a fixed loopback origin so
|
||||
// its localStorage (picked server, session) persists between launches. An
|
||||
// http://127.0.0.1 page is a secure context that can still reach http servers
|
||||
// on the local network.
|
||||
const host = "127.0.0.1:47836"
|
||||
const origin = `http://${host}`
|
||||
const webRoot = path.join(
|
||||
app.isPackaged ? process.resourcesPath : __dirname,
|
||||
"web"
|
||||
)
|
||||
const contentTypes = {
|
||||
".html": "text/html; charset=utf-8",
|
||||
".txt": "text/plain; charset=utf-8",
|
||||
".js": "text/javascript; charset=utf-8",
|
||||
".css": "text/css; charset=utf-8",
|
||||
".json": "application/json",
|
||||
".webmanifest": "application/manifest+json",
|
||||
".png": "image/png",
|
||||
".svg": "image/svg+xml",
|
||||
".ico": "image/x-icon",
|
||||
".woff2": "font/woff2",
|
||||
}
|
||||
let window, server
|
||||
|
||||
// Resolves paths the way static hosts serve a Next.js export: /album is
|
||||
// album.html, / is index.html, and anything missing is 404.html.
|
||||
async function serveStatic(request, response) {
|
||||
if (request.headers.host !== host) return response.writeHead(403).end()
|
||||
if (request.method !== "GET" && request.method !== "HEAD")
|
||||
return response.writeHead(405).end()
|
||||
let pathname
|
||||
try {
|
||||
pathname = decodeURIComponent(new URL(request.url, origin).pathname)
|
||||
} catch {
|
||||
return response.writeHead(400).end()
|
||||
}
|
||||
const relative = pathname.replace(/^\/+|\/+$/g, "")
|
||||
const candidates = relative
|
||||
? [relative, `${relative}.html`, `${relative}/index.html`]
|
||||
: ["index.html"]
|
||||
for (const candidate of [...candidates, "404.html"]) {
|
||||
const file = path.resolve(webRoot, candidate)
|
||||
if (!file.startsWith(webRoot + path.sep)) continue
|
||||
try {
|
||||
const body = await readFile(file)
|
||||
response.writeHead(candidate === "404.html" ? 404 : 200, {
|
||||
"Content-Type":
|
||||
contentTypes[path.extname(file)] ?? "application/octet-stream",
|
||||
"Cache-Control": file.includes(`${path.sep}_next${path.sep}static`)
|
||||
? "public, max-age=31536000, immutable"
|
||||
: "no-cache",
|
||||
})
|
||||
return response.end(request.method === "HEAD" ? undefined : body)
|
||||
} catch {
|
||||
// Try the next candidate.
|
||||
}
|
||||
}
|
||||
response.writeHead(404).end()
|
||||
}
|
||||
|
||||
function openWindow() {
|
||||
window = new BrowserWindow({
|
||||
title: "oTunes",
|
||||
width: 1280,
|
||||
height: 850,
|
||||
backgroundColor: nativeTheme.shouldUseDarkColors ? "#000000" : "#ffffff",
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
contextIsolation: true,
|
||||
sandbox: true,
|
||||
webSecurity: true,
|
||||
},
|
||||
})
|
||||
window.webContents.setWindowOpenHandler(() => ({ action: "deny" }))
|
||||
const restrictNavigation = (event, target) => {
|
||||
if (new URL(target).origin !== origin) event.preventDefault()
|
||||
}
|
||||
window.webContents.on("will-navigate", restrictNavigation)
|
||||
window.webContents.on("will-redirect", restrictNavigation)
|
||||
session.defaultSession.setPermissionRequestHandler(
|
||||
(_contents, _permission, callback) => callback(false)
|
||||
)
|
||||
session.defaultSession.setPermissionCheckHandler(() => false)
|
||||
window.loadURL(`${origin}/`).catch(console.error)
|
||||
window.on("closed", () => {
|
||||
window = undefined
|
||||
})
|
||||
}
|
||||
|
||||
if (!app.requestSingleInstanceLock()) app.quit()
|
||||
else {
|
||||
app.on("second-instance", () => {
|
||||
window?.show()
|
||||
window?.focus()
|
||||
})
|
||||
app
|
||||
.whenReady()
|
||||
.then(async () => {
|
||||
server = createServer((request, response) => {
|
||||
serveStatic(request, response).catch(() => {
|
||||
if (!response.headersSent) response.writeHead(500)
|
||||
response.end()
|
||||
})
|
||||
})
|
||||
await new Promise((resolve, reject) => {
|
||||
server.once("error", reject)
|
||||
server.listen(47836, "127.0.0.1", resolve)
|
||||
})
|
||||
Menu.setApplicationMenu(
|
||||
Menu.buildFromTemplate([
|
||||
...(process.platform === "darwin" ? [{ role: "appMenu" }] : []),
|
||||
{
|
||||
label: "Server",
|
||||
submenu: [
|
||||
{
|
||||
label: "Change server…",
|
||||
click: () => window?.loadURL(`${origin}/server`),
|
||||
},
|
||||
],
|
||||
},
|
||||
{ role: "editMenu" },
|
||||
{ role: "viewMenu" },
|
||||
{ role: "windowMenu" },
|
||||
])
|
||||
)
|
||||
openWindow()
|
||||
app.on("activate", () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) openWindow()
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
app.quit()
|
||||
})
|
||||
}
|
||||
app.on("before-quit", () => server?.close())
|
||||
app.on("window-all-closed", () => {
|
||||
if (process.platform !== "darwin") app.quit()
|
||||
})
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@otunes/desktop",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"description": "oTunes desktop client for Windows and Linux",
|
||||
"author": "oTunes contributors",
|
||||
"main": "main.cjs",
|
||||
"scripts": {
|
||||
"start": "pnpm build:web && electron .",
|
||||
"build": "pnpm build:web && node scripts/package.mjs",
|
||||
"build:windows": "pnpm build:web && node scripts/package.mjs windows",
|
||||
"build:linux": "pnpm build:web && node scripts/package.mjs linux",
|
||||
"build:web": "node scripts/build-web.mjs",
|
||||
"typecheck": "node --check main.cjs && node --check scripts/build-web.mjs && node --check scripts/package.mjs"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "45.3.4",
|
||||
"electron-builder": "26.18.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { execFileSync } from "node:child_process"
|
||||
import { createRequire } from "node:module"
|
||||
import { cp, rm } from "node:fs/promises"
|
||||
import path from "node:path"
|
||||
import { fileURLToPath } from "node:url"
|
||||
|
||||
// Builds the web app's static export and copies it to apps/desktop/web,
|
||||
// which main.cjs serves and package.mjs ships.
|
||||
const desktopRoot = fileURLToPath(new URL("../", import.meta.url))
|
||||
const web = path.resolve(desktopRoot, "../web")
|
||||
const webRequire = createRequire(path.join(web, "package.json"))
|
||||
execFileSync(
|
||||
process.execPath,
|
||||
[webRequire.resolve("next/dist/bin/next"), "build"],
|
||||
{
|
||||
cwd: web,
|
||||
stdio: "inherit",
|
||||
env: { ...process.env, OTUNES_STATIC_EXPORT: "1" },
|
||||
}
|
||||
)
|
||||
|
||||
const destination = path.join(desktopRoot, "web")
|
||||
await rm(destination, { recursive: true, force: true })
|
||||
await cp(path.join(web, "out"), destination, { recursive: true })
|
||||
@@ -0,0 +1,77 @@
|
||||
import { build, Platform, Arch } from "electron-builder"
|
||||
import { mkdir, copyFile, writeFile, rm, readFile } from "node:fs/promises"
|
||||
import { createRequire } from "node:module"
|
||||
import path from "node:path"
|
||||
import { fileURLToPath } from "node:url"
|
||||
|
||||
// Packages stock Electron with the bundled UI from build-web.mjs.
|
||||
// Usage: node scripts/package.mjs [windows|linux] [x64|arm64]
|
||||
// Defaults to the host OS and both architectures. Linux hosts can build both
|
||||
// targets: Windows needs Wine, ARM64 Flatpaks need qemu-user binfmt.
|
||||
const desktopRoot = fileURLToPath(new URL("../", import.meta.url))
|
||||
const hostTarget = { win32: "windows", linux: "linux" }[process.platform]
|
||||
const [target = hostTarget, onlyArch] = process.argv.slice(2)
|
||||
const platform = { windows: Platform.WINDOWS, linux: Platform.LINUX }[target]
|
||||
if (!platform) throw new Error("Targets are windows or linux")
|
||||
const architectures = onlyArch ? [onlyArch] : ["x64", "arm64"]
|
||||
if (!architectures.every((arch) => arch === "x64" || arch === "arm64"))
|
||||
throw new Error("Architectures are x64 or arm64")
|
||||
|
||||
const staging = path.join(desktopRoot, ".package")
|
||||
await rm(staging, { recursive: true, force: true })
|
||||
await mkdir(staging, { recursive: true })
|
||||
await copyFile(
|
||||
path.join(desktopRoot, "main.cjs"),
|
||||
path.join(staging, "main.cjs")
|
||||
)
|
||||
const pkg = JSON.parse(
|
||||
await readFile(path.join(desktopRoot, "package.json"), "utf8")
|
||||
)
|
||||
const ref = process.env.OTUNES_DESKTOP_REF ?? ""
|
||||
if (ref.startsWith("refs/tags/"))
|
||||
pkg.version = ref.slice("refs/tags/".length).replace(/^v/, "")
|
||||
delete pkg.devDependencies
|
||||
delete pkg.scripts
|
||||
await writeFile(
|
||||
path.join(staging, "package.json"),
|
||||
JSON.stringify(pkg, null, 2)
|
||||
)
|
||||
|
||||
const { version: electronVersion } = createRequire(import.meta.url)(
|
||||
"electron/package.json"
|
||||
)
|
||||
// One build per architecture: a multi-arch NSIS build merges both into one installer.
|
||||
for (const arch of architectures) {
|
||||
await build({
|
||||
targets: platform.createTarget(undefined, Arch[arch]),
|
||||
config: {
|
||||
appId: "com.otunes.desktop",
|
||||
productName: "oTunes",
|
||||
electronVersion,
|
||||
artifactName: "oTunes-${version}-${os}-${arch}.${ext}",
|
||||
icon: path.resolve(desktopRoot, "../web/public/logo.png"),
|
||||
directories: { app: staging, output: path.join(desktopRoot, "dist") },
|
||||
files: ["main.cjs", "package.json"],
|
||||
extraResources: [
|
||||
{ from: path.join(desktopRoot, "web"), to: "web", filter: ["**/*"] },
|
||||
],
|
||||
npmRebuild: false,
|
||||
win: { target: ["nsis"] },
|
||||
linux: { category: "AudioVideo", target: ["flatpak"] },
|
||||
flatpak: {
|
||||
runtimeVersion: "25.08",
|
||||
baseVersion: "25.08",
|
||||
finishArgs: [
|
||||
"--socket=wayland",
|
||||
"--socket=fallback-x11",
|
||||
"--share=ipc",
|
||||
"--device=dri",
|
||||
"--socket=pulseaudio",
|
||||
"--share=network",
|
||||
],
|
||||
},
|
||||
publish: null,
|
||||
},
|
||||
publish: "never",
|
||||
})
|
||||
}
|
||||
@@ -1,44 +1,13 @@
|
||||
import { buildConvexUrl, isLocalHost } from "@otunes/convex/server-url"
|
||||
import type { ServerConfig } from "@otunes/convex/server-url"
|
||||
|
||||
export type ServerConfig = {
|
||||
/** Raw hostname the user entered, e.g. `music.example.com` or `192.168.86.25:3000` */
|
||||
hostname: string
|
||||
/** Base URL for the Next.js server, e.g. `https://music.example.com` */
|
||||
serverUrl: string
|
||||
/** Convex deployment URL, e.g. `https://convex.music.example.com` */
|
||||
convexUrl: string
|
||||
}
|
||||
export {
|
||||
parseServerHostname,
|
||||
type ServerConfig,
|
||||
} from "@otunes/convex/server-url"
|
||||
|
||||
const SERVER_CONFIG_KEY = "otunes.server-config"
|
||||
const LEGACY_SERVER_CONFIG_KEY = "otunes:server-config"
|
||||
|
||||
function normalizeHostnameInput(input: string): string {
|
||||
return input
|
||||
.trim()
|
||||
.replace(/^https?:\/\//i, "")
|
||||
.replace(/\/+$/, "")
|
||||
}
|
||||
|
||||
function buildServerUrl(hostname: string): string {
|
||||
const protocol = isLocalHost(hostname) ? "http" : "https"
|
||||
return `${protocol}://${hostname}`
|
||||
}
|
||||
|
||||
export function parseServerHostname(input: string): ServerConfig | null {
|
||||
const hostname = normalizeHostnameInput(input)
|
||||
if (!hostname) return null
|
||||
|
||||
try {
|
||||
const serverUrl = buildServerUrl(hostname)
|
||||
const convexUrl = buildConvexUrl(hostname)
|
||||
new URL(serverUrl)
|
||||
new URL(convexUrl)
|
||||
return { hostname, serverUrl, convexUrl }
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export async function loadServerConfig(
|
||||
getItem: (key: string) => Promise<string | null>
|
||||
): Promise<ServerConfig | null> {
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ export default function Page() {
|
||||
</p>
|
||||
<div className="mt-6 flex flex-wrap justify-center gap-2">
|
||||
<Button asChild>
|
||||
<Link href="/public">
|
||||
<Link href="/">
|
||||
<Home />
|
||||
Home
|
||||
</Link>
|
||||
@@ -1,3 +1,5 @@
|
||||
// Share links (/album/<id>) land here on the server build, which adds
|
||||
// link-preview metadata. The app itself links to /album?id=<id>.
|
||||
import { AlbumPage } from "@/components/album-page"
|
||||
import { api } from "@otunes/convex/_generated/api"
|
||||
import { fetchQuery } from "convex/nextjs"
|
||||
File renamed without changes.
@@ -0,0 +1,19 @@
|
||||
"use client"
|
||||
|
||||
import { useSearchParams } from "next/navigation"
|
||||
|
||||
import { AlbumPage } from "@/components/album-page"
|
||||
import { PageMessage } from "@/components/page-message"
|
||||
import type { Id } from "@otunes/convex/_generated/dataModel"
|
||||
|
||||
export default function Page() {
|
||||
const searchParams = useSearchParams()
|
||||
const id = searchParams.get("id")
|
||||
if (!id) return <PageMessage>Album not found.</PageMessage>
|
||||
return (
|
||||
<AlbumPage
|
||||
albumId={id as Id<"albums">}
|
||||
highlightedSongId={searchParams.get("s") ?? undefined}
|
||||
/>
|
||||
)
|
||||
}
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// Share links (/artist/<id>) land here on the server build, which adds
|
||||
// link-preview metadata. The app itself links to /artist?id=<id>.
|
||||
import { fetchQuery } from "convex/nextjs"
|
||||
import { convexServerOptions } from "@/lib/convex-server"
|
||||
import { ArtistPage } from "@/components/artist-page"
|
||||
File renamed without changes.
@@ -0,0 +1,13 @@
|
||||
"use client"
|
||||
|
||||
import { useSearchParams } from "next/navigation"
|
||||
|
||||
import { ArtistPage } from "@/components/artist-page"
|
||||
import { PageMessage } from "@/components/page-message"
|
||||
import type { Id } from "@otunes/convex/_generated/dataModel"
|
||||
|
||||
export default function Page() {
|
||||
const id = useSearchParams().get("id")
|
||||
if (!id) return <PageMessage>Artist not found.</PageMessage>
|
||||
return <ArtistPage artistId={id as Id<"artists">} />
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { AuthRedirect } from "@/components/auth-redirect"
|
||||
import { AddToPlaylistProvider } from "@/components/add-to-playlist-provider"
|
||||
import { DownloadsProvider } from "@/components/downloads-provider"
|
||||
import { FavoritesProvider } from "@/components/favorites-provider"
|
||||
@@ -21,6 +22,9 @@ export default function AppLayout({
|
||||
<AddToPlaylistProvider>
|
||||
<DownloadsProvider>
|
||||
<FavoritesProvider>
|
||||
{process.env.OTUNES_STATIC_EXPORT === "1" && (
|
||||
<AuthRedirect area="app" />
|
||||
)}
|
||||
<AppSidebar />
|
||||
<div className="flex min-h-svh min-w-0 flex-1">
|
||||
<SidebarInset className="min-w-0 flex-1">
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
import { fetchQuery } from "convex/nextjs"
|
||||
import { convexServerOptions } from "@/lib/convex-server"
|
||||
import { api } from "@otunes/convex/_generated/api"
|
||||
import type { Id } from "@otunes/convex/_generated/dataModel"
|
||||
import { Metadata } from "next"
|
||||
|
||||
interface PageProps {
|
||||
params: Promise<{ id: string }>
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: PageProps): Promise<Metadata> {
|
||||
const { id } = await params
|
||||
const detail = await fetchQuery(
|
||||
api.library.browseArtistDetail,
|
||||
{ id: id as Id<"artists"> },
|
||||
convexServerOptions()
|
||||
).catch(() => null)
|
||||
const selectedArtist = detail?.artist
|
||||
|
||||
return {
|
||||
title: `${selectedArtist ? `${selectedArtist.name}` : "oTunes"}`,
|
||||
openGraph: {
|
||||
title: `${selectedArtist ? `${selectedArtist.name}` : "oTunes"}`,
|
||||
description: "oTunes",
|
||||
images: selectedArtist
|
||||
? {
|
||||
url: `/api/artist/${selectedArtist.id}/cover`,
|
||||
width: 512,
|
||||
height: 512,
|
||||
}
|
||||
: [],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default function Page() {
|
||||
return null
|
||||
}
|
||||
+2
@@ -1,3 +1,5 @@
|
||||
// Share links (/playlist/<id>) land here on the server build, which adds
|
||||
// link-preview metadata. The app itself links to /playlist?id=<id>.
|
||||
import { PlaylistPage } from "@/components/playlist-page"
|
||||
import { api } from "@otunes/convex/_generated/api"
|
||||
import { convexAuthNextjsToken } from "@convex-dev/auth/nextjs/server"
|
||||
File renamed without changes.
@@ -0,0 +1,13 @@
|
||||
"use client"
|
||||
|
||||
import { useSearchParams } from "next/navigation"
|
||||
|
||||
import { PageMessage } from "@/components/page-message"
|
||||
import { PlaylistPage } from "@/components/playlist-page"
|
||||
import type { Id } from "@otunes/convex/_generated/dataModel"
|
||||
|
||||
export default function Page() {
|
||||
const id = useSearchParams().get("id")
|
||||
if (!id) return <PageMessage>Playlist not found.</PageMessage>
|
||||
return <PlaylistPage playlistId={id as Id<"playlists">} />
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { AuthRedirect } from "@/components/auth-redirect"
|
||||
export default function AuthLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
@@ -5,6 +6,7 @@ export default function AuthLayout({
|
||||
}>) {
|
||||
return (
|
||||
<div className="flex min-h-svh flex-col items-center justify-center bg-muted/30 p-6">
|
||||
{process.env.OTUNES_STATIC_EXPORT === "1" && <AuthRedirect area="auth" />}
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -1,18 +1,5 @@
|
||||
import { fetchQuery } from "convex/nextjs"
|
||||
import { connection } from "next/server"
|
||||
import { AuthForm } from "@/components/auth-form"
|
||||
import { convexServerOptions } from "@/lib/convex-server"
|
||||
import { api } from "@otunes/convex/_generated/api"
|
||||
|
||||
export default async function SignInPage() {
|
||||
await connection()
|
||||
const { disableAccountCreation } = await fetchQuery(
|
||||
api.users.getAppSettings,
|
||||
{},
|
||||
convexServerOptions()
|
||||
)
|
||||
|
||||
return (
|
||||
<AuthForm flow="signIn" accountCreationDisabled={disableAccountCreation} />
|
||||
)
|
||||
export default function SignInPage() {
|
||||
return <AuthForm flow="signIn" />
|
||||
}
|
||||
@@ -1,18 +1,30 @@
|
||||
import { fetchQuery } from "convex/nextjs"
|
||||
import { connection } from "next/server"
|
||||
"use client"
|
||||
|
||||
import { useQuery } from "convex/react"
|
||||
import Link from "next/link"
|
||||
|
||||
import { AuthForm } from "@/components/auth-form"
|
||||
import { convexServerOptions } from "@/lib/convex-server"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
||||
import { api } from "@otunes/convex/_generated/api"
|
||||
|
||||
export default async function SignUpPage() {
|
||||
await connection()
|
||||
const { disableAccountCreation } = await fetchQuery(
|
||||
api.users.getAppSettings,
|
||||
{},
|
||||
convexServerOptions()
|
||||
)
|
||||
|
||||
export default function SignUpPage() {
|
||||
const settings = useQuery(api.users.getAppSettings)
|
||||
// Render nothing until the setting loads so the form never flashes.
|
||||
if (settings === undefined) return null
|
||||
if (!settings.disableAccountCreation) return <AuthForm flow="signUp" />
|
||||
return (
|
||||
<AuthForm flow="signUp" accountCreationDisabled={disableAccountCreation} />
|
||||
<Card className="w-full max-w-sm">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg">
|
||||
This server has disabled new signups :(
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Button asChild className="w-full">
|
||||
<Link href="/signin">Back</Link>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -37,7 +37,7 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
let songs: Awaited<ReturnType<typeof getSongSources>>
|
||||
try {
|
||||
songs = await getSongSources(songIds)
|
||||
songs = await getSongSources(songIds, request)
|
||||
} catch {
|
||||
return new Response("Not found", { status: 404 })
|
||||
}
|
||||
File renamed without changes.
+5
-9
@@ -53,9 +53,10 @@ async function transcodeResponse(
|
||||
songId: string,
|
||||
source: string,
|
||||
kbps: number,
|
||||
signal: AbortSignal
|
||||
request: NextRequest
|
||||
) {
|
||||
const lyrics = await getSongLyrics(songId)
|
||||
const { signal } = request
|
||||
const lyrics = await getSongLyrics(songId, request)
|
||||
const lyricsArgs =
|
||||
lyrics && Buffer.byteLength(lyrics) <= MAX_LYRICS_ARGUMENT_BYTES
|
||||
? ["-metadata", `lyrics=${lyrics}`]
|
||||
@@ -115,7 +116,7 @@ export async function GET(
|
||||
|
||||
let song: Awaited<ReturnType<typeof getSongSource>>
|
||||
try {
|
||||
song = await getSongSource(id)
|
||||
song = await getSongSource(id, request)
|
||||
} catch {
|
||||
return new Response("Not found", { status: 404 })
|
||||
}
|
||||
@@ -128,12 +129,7 @@ export async function GET(
|
||||
|
||||
try {
|
||||
if (plan.kbps > 0) {
|
||||
return await transcodeResponse(
|
||||
song._id,
|
||||
sourceFile,
|
||||
plan.kbps,
|
||||
request.signal
|
||||
)
|
||||
return await transcodeResponse(song._id, sourceFile, plan.kbps, request)
|
||||
}
|
||||
|
||||
if (plan.source === "lossless") {
|
||||
+1
-1
@@ -15,7 +15,7 @@ export async function GET(
|
||||
const { id } = await params
|
||||
|
||||
try {
|
||||
const song = await getSongSource(id)
|
||||
const song = await getSongSource(id, request)
|
||||
|
||||
const quality = request.nextUrl.searchParams.get("quality")
|
||||
const preferAtmos =
|
||||
+1
-1
@@ -35,7 +35,7 @@ export async function GET(
|
||||
const preferAtmos =
|
||||
request.nextUrl.searchParams.get("preferAtmos") === "true"
|
||||
// Resolve the source even when a job is cached so every segment is authorized.
|
||||
const song = await getSongSource(id)
|
||||
const song = await getSongSource(id, request)
|
||||
const job =
|
||||
getExistingHlsJob(id, quality, preferAtmos) ??
|
||||
(await ensureHlsJob(song, quality, preferAtmos))
|
||||
+1
-1
@@ -120,7 +120,7 @@ export async function GET(
|
||||
const { browser } = userAgent(request)
|
||||
|
||||
try {
|
||||
const song = await getSongSource(id)
|
||||
const song = await getSongSource(id, request)
|
||||
|
||||
const {
|
||||
source: originalCodec,
|
||||
File renamed without changes.
+18
-9
@@ -37,8 +37,11 @@ async function hostedUrl() {
|
||||
}
|
||||
}
|
||||
|
||||
const staticExport = process.env.OTUNES_STATIC_EXPORT === "1"
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const url = await hostedUrl()
|
||||
// Static exports have no request to read the host from.
|
||||
const url = staticExport ? undefined : await hostedUrl()
|
||||
|
||||
return {
|
||||
title: "oTunes",
|
||||
@@ -70,6 +73,13 @@ export default function RootLayout({
|
||||
}: Readonly<{
|
||||
children: React.ReactNode
|
||||
}>) {
|
||||
const content = (
|
||||
<ThemeProvider defaultTheme="system">
|
||||
{children}
|
||||
<Toaster />
|
||||
</ThemeProvider>
|
||||
)
|
||||
|
||||
return (
|
||||
<html
|
||||
lang="en"
|
||||
@@ -82,14 +92,13 @@ export default function RootLayout({
|
||||
)}
|
||||
>
|
||||
<body className={"overflow-x-hidden"}>
|
||||
<ConvexAuthNextjsServerProvider storageNamespace="otunes">
|
||||
<ConvexClientProvider convexUrl={process.env.PUBLIC_CONVEX_URL}>
|
||||
<ThemeProvider>
|
||||
{children}
|
||||
<Toaster />
|
||||
</ThemeProvider>
|
||||
</ConvexClientProvider>
|
||||
</ConvexAuthNextjsServerProvider>
|
||||
{staticExport ? (
|
||||
<ConvexClientProvider>{content}</ConvexClientProvider>
|
||||
) : (
|
||||
<ConvexAuthNextjsServerProvider storageNamespace="otunes">
|
||||
<ConvexClientProvider>{content}</ConvexClientProvider>
|
||||
</ConvexAuthNextjsServerProvider>
|
||||
)}
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { MetadataRoute } from "next"
|
||||
|
||||
export const dynamic = "force-static"
|
||||
|
||||
export default function manifest(): MetadataRoute.Manifest {
|
||||
return {
|
||||
name: "oTunes",
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import { ServerForm } from "@/components/server-form"
|
||||
|
||||
export default function ServerPage() {
|
||||
// The server build is the server; only desktop apps pick one.
|
||||
if (process.env.OTUNES_STATIC_EXPORT !== "1") notFound()
|
||||
return <ServerForm />
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { playlistPath } from "@/lib/routes"
|
||||
|
||||
import * as React from "react"
|
||||
import { useConvex, useMutation, useQuery } from "convex/react"
|
||||
import { useRouter } from "next/navigation"
|
||||
@@ -256,7 +258,7 @@ export function AddToPlaylistProvider({
|
||||
setNewPlaylistName("")
|
||||
setPendingSongIds([])
|
||||
if (count === 0) {
|
||||
router.push(`/playlist/${playlistId}`)
|
||||
router.push(playlistPath(playlistId))
|
||||
}
|
||||
} catch (error) {
|
||||
toast.error(
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { albumPath, artistPath } from "@/lib/routes"
|
||||
|
||||
import * as React from "react"
|
||||
import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
@@ -123,7 +125,7 @@ export function AlbumCard({ album }: { album: BrowseAlbum }) {
|
||||
onMouseEnter={() => setHovered(true)}
|
||||
onMouseLeave={() => setHovered(false)}
|
||||
>
|
||||
<Link className="absolute inset-0" href={"/album/" + album.id}>
|
||||
<Link className="absolute inset-0" href={albumPath(album.id)}>
|
||||
<Image
|
||||
src={albumCoverUrl(album.id)}
|
||||
alt={album.title}
|
||||
@@ -186,11 +188,11 @@ export function AlbumCard({ album }: { album: BrowseAlbum }) {
|
||||
</div>
|
||||
|
||||
<div className="min-w-0">
|
||||
<Link href={"/album/" + album.id} className="hover:underline">
|
||||
<Link href={albumPath(album.id)} className="hover:underline">
|
||||
<p className="truncate text-sm font-medium">{album.title}</p>
|
||||
</Link>
|
||||
<Link
|
||||
href={"/artist/" + album.artist.id}
|
||||
href={artistPath(album.artist.id)}
|
||||
className="text-muted-foreground decoration-muted-foreground hover:underline"
|
||||
>
|
||||
<p className="truncate text-xs">{album.artist.name}</p>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { artistPath } from "@/lib/routes"
|
||||
|
||||
import { PageHeader } from "@/components/library-skeletons"
|
||||
import * as React from "react"
|
||||
import Image from "next/image"
|
||||
@@ -287,7 +289,7 @@ export function AlbumView({
|
||||
{album.title}
|
||||
</h1>
|
||||
<Link
|
||||
href={"/artist/" + album.artist.id}
|
||||
href={artistPath(album.artist.id)}
|
||||
className="inline-block text-lg font-semibold text-primary hover:underline"
|
||||
>
|
||||
{album.artist.name}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
"use client"
|
||||
|
||||
import { playlistPath } from "@/lib/routes"
|
||||
import { serverUrl, staticExport } from "@/lib/server"
|
||||
|
||||
import {
|
||||
ArrowDownToLine,
|
||||
Disc3,
|
||||
@@ -10,11 +13,12 @@ import {
|
||||
Mic,
|
||||
Music2,
|
||||
Search,
|
||||
Server,
|
||||
Settings,
|
||||
Star,
|
||||
} from "lucide-react"
|
||||
|
||||
import { usePathname, useRouter } from "next/navigation"
|
||||
import { usePathname, useRouter, useSearchParams } from "next/navigation"
|
||||
import dynamic from "next/dynamic"
|
||||
import { useAuthActions } from "@convex-dev/auth/react"
|
||||
|
||||
@@ -43,6 +47,7 @@ import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
import { useTheme } from "next-themes"
|
||||
import * as React from "react"
|
||||
import { Suspense } from "react"
|
||||
import { api } from "@otunes/convex/_generated/api"
|
||||
import { playlistCoverUrl } from "@/lib/cover-urls"
|
||||
import { useCachedQuery } from "@/hooks/use-cached-query"
|
||||
@@ -109,7 +114,7 @@ export function AppSidebar() {
|
||||
...(sidebarPlaylists?.subscribed ?? []),
|
||||
].map((playlist) => ({
|
||||
title: playlist.title,
|
||||
path: `/playlist/${playlist.id}`,
|
||||
path: playlistPath(playlist.id),
|
||||
icon: playlist.cover ? (
|
||||
// eslint-disable-next-line @next/next/no-img-element -- versioned cover, already sized by the route
|
||||
<img
|
||||
@@ -196,18 +201,20 @@ export function AppSidebar() {
|
||||
<SidebarGroup>
|
||||
<SidebarGroupLabel>Playlists</SidebarGroupLabel>
|
||||
<SidebarGroupContent>
|
||||
<SidebarMenu>
|
||||
{playlistNav.map((item) => (
|
||||
<SidebarMenuItem key={item.path}>
|
||||
<SidebarMenuButton isActive={pathname === item.path} asChild>
|
||||
<Link href={item.path} onClick={() => setOpenMobile(false)}>
|
||||
{item.icon}
|
||||
<span>{item.title}</span>
|
||||
</Link>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
))}
|
||||
</SidebarMenu>
|
||||
<Suspense
|
||||
fallback={
|
||||
<PlaylistMenu
|
||||
items={playlistNav}
|
||||
route={pathname}
|
||||
onNavigate={() => setOpenMobile(false)}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<CurrentPlaylistMenu
|
||||
items={playlistNav}
|
||||
onNavigate={() => setOpenMobile(false)}
|
||||
/>
|
||||
</Suspense>
|
||||
</SidebarGroupContent>
|
||||
</SidebarGroup>
|
||||
</SidebarContent>
|
||||
@@ -220,7 +227,10 @@ export function AppSidebar() {
|
||||
<SidebarMenuButton size="lg" className="min-w-0 flex-1">
|
||||
<Avatar size="sm" key={user?.image ?? "fallback"}>
|
||||
{user?.image ? (
|
||||
<AvatarImage src={user.image} alt={user.name} />
|
||||
<AvatarImage
|
||||
src={serverUrl(user.image)}
|
||||
alt={user.name}
|
||||
/>
|
||||
) : null}
|
||||
<AvatarFallback>{fallbackLetters}</AvatarFallback>
|
||||
</Avatar>
|
||||
@@ -243,6 +253,15 @@ export function AppSidebar() {
|
||||
Options
|
||||
<Settings />
|
||||
</DropdownMenuItem>
|
||||
{staticExport ? (
|
||||
<DropdownMenuItem
|
||||
className="justify-between"
|
||||
onClick={() => router.push("/server")}
|
||||
>
|
||||
Change Server
|
||||
<Server />
|
||||
</DropdownMenuItem>
|
||||
) : null}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
{optionsOpen ? (
|
||||
@@ -255,3 +274,46 @@ export function AppSidebar() {
|
||||
</Sidebar>
|
||||
)
|
||||
}
|
||||
|
||||
type NavItem = { title: string; path: string; icon: React.ReactNode }
|
||||
|
||||
// Playlist routes differ only by `?id=`. Reading the query needs a Suspense
|
||||
// boundary in static exports, so the fallback matches on the path alone.
|
||||
function CurrentPlaylistMenu(props: {
|
||||
items: NavItem[]
|
||||
onNavigate: () => void
|
||||
}) {
|
||||
const pathname = usePathname()
|
||||
const query = useSearchParams().toString()
|
||||
return (
|
||||
<PlaylistMenu
|
||||
{...props}
|
||||
route={query ? `${pathname}?${query}` : pathname}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function PlaylistMenu({
|
||||
items,
|
||||
route,
|
||||
onNavigate,
|
||||
}: {
|
||||
items: NavItem[]
|
||||
route: string
|
||||
onNavigate: () => void
|
||||
}) {
|
||||
return (
|
||||
<SidebarMenu>
|
||||
{items.map((item) => (
|
||||
<SidebarMenuItem key={item.path}>
|
||||
<SidebarMenuButton isActive={route === item.path} asChild>
|
||||
<Link href={item.path} onClick={onNavigate}>
|
||||
{item.icon}
|
||||
<span>{item.title}</span>
|
||||
</Link>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
))}
|
||||
</SidebarMenu>
|
||||
)
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { artistPath } from "@/lib/routes"
|
||||
|
||||
import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
|
||||
@@ -11,7 +13,7 @@ export function ArtistCard({ artist }: { artist: BrowseArtist }) {
|
||||
<div className="group flex flex-col items-center gap-2">
|
||||
<Link
|
||||
className="relative flex aspect-square w-full items-center justify-center overflow-hidden rounded-full ring-1 ring-foreground/10"
|
||||
href={"/artist/" + artist.id}
|
||||
href={artistPath(artist.id)}
|
||||
>
|
||||
<Image
|
||||
src={artistCoverUrl(artist.id)}
|
||||
@@ -22,7 +24,7 @@ export function ArtistCard({ artist }: { artist: BrowseArtist }) {
|
||||
/>
|
||||
</Link>
|
||||
<div className="min-w-0">
|
||||
<Link href={"/artist/" + artist.id} className="hover:underline">
|
||||
<Link href={artistPath(artist.id)} className="hover:underline">
|
||||
<p className="truncate text-center text-sm font-medium">
|
||||
{artist.name}
|
||||
</p>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { usePathname } from "next/navigation"
|
||||
import { useSearchParams } from "next/navigation"
|
||||
import { useCallback } from "react"
|
||||
|
||||
import { ArtistsView } from "@/components/artists-view"
|
||||
@@ -8,20 +8,17 @@ import { ArtistsSkeleton, PageHeader } from "@/components/library-skeletons"
|
||||
import { useCachedQuery } from "@/hooks/use-cached-query"
|
||||
import { api } from "@otunes/convex/_generated/api"
|
||||
|
||||
const ARTISTS_PATH = "/library/artists"
|
||||
|
||||
function artistIdFromPathname(pathname: string) {
|
||||
const [, id] = pathname.slice(ARTISTS_PATH.length).split("/")
|
||||
return id ? decodeURIComponent(id) : undefined
|
||||
}
|
||||
|
||||
export function ArtistsPage() {
|
||||
const pathname = usePathname()
|
||||
const artistId = useSearchParams().get("id") ?? undefined
|
||||
const artists = useCachedQuery(api.library.browseArtists)
|
||||
const albums = useCachedQuery(api.library.browseAlbums)
|
||||
|
||||
const selectArtist = useCallback((artistId: string) => {
|
||||
window.history.pushState(null, "", `${ARTISTS_PATH}/${artistId}`)
|
||||
window.history.pushState(
|
||||
null,
|
||||
"",
|
||||
`/library/artists?${new URLSearchParams({ id: artistId })}`
|
||||
)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
@@ -34,7 +31,7 @@ export function ArtistsPage() {
|
||||
<ArtistsView
|
||||
artists={artists.flat()}
|
||||
albums={albums.flat()}
|
||||
artistId={artistIdFromPathname(pathname)}
|
||||
artistId={artistId}
|
||||
onSelectArtist={selectArtist}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { artistPath } from "@/lib/routes"
|
||||
|
||||
import * as React from "react"
|
||||
import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
@@ -155,7 +157,7 @@ export function ArtistsView({
|
||||
<div className="pb-28">
|
||||
<div className="flex min-w-0 items-center justify-between gap-4 border-b px-6 py-4">
|
||||
<Link
|
||||
href={`/artist/${selectedArtist.id}`}
|
||||
href={artistPath(selectedArtist.id)}
|
||||
className="group inline-flex min-w-0 flex-1 items-center gap-1 text-xl font-bold tracking-tight hover:underline"
|
||||
>
|
||||
<span className="min-w-0 truncate">{selectedArtist.name}</span>
|
||||
|
||||
@@ -53,27 +53,16 @@ const copy: Record<
|
||||
},
|
||||
}
|
||||
|
||||
export function AuthForm({
|
||||
flow,
|
||||
accountCreationDisabled,
|
||||
}: {
|
||||
flow: AuthFlow
|
||||
accountCreationDisabled: boolean
|
||||
}) {
|
||||
export function AuthForm({ flow }: { flow: AuthFlow }) {
|
||||
const { signIn } = useAuthActions()
|
||||
const router = useRouter()
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
|
||||
const text = copy[flow]
|
||||
const signupsDisabled = flow === "signUp" && accountCreationDisabled
|
||||
const hideSignUpLink = flow === "signIn" && accountCreationDisabled
|
||||
|
||||
async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
|
||||
event.preventDefault()
|
||||
if (signupsDisabled) {
|
||||
return
|
||||
}
|
||||
setError(null)
|
||||
setSubmitting(true)
|
||||
|
||||
@@ -100,71 +89,62 @@ export function AuthForm({
|
||||
<CardDescription>{text.description}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{signupsDisabled ? (
|
||||
<p className="text-sm text-muted-foreground">
|
||||
New account registration is currently disabled. Contact an
|
||||
administrator if you need access.
|
||||
</p>
|
||||
) : (
|
||||
<form onSubmit={handleSubmit}>
|
||||
<FieldGroup>
|
||||
{flow === "signUp" && (
|
||||
<Field>
|
||||
<FieldLabel htmlFor="name">Name</FieldLabel>
|
||||
<Input
|
||||
id="name"
|
||||
name="name"
|
||||
type="text"
|
||||
autoComplete="name"
|
||||
placeholder="Ada Lovelace"
|
||||
required
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
<form onSubmit={handleSubmit}>
|
||||
<FieldGroup>
|
||||
{flow === "signUp" && (
|
||||
<Field>
|
||||
<FieldLabel htmlFor="email">Email</FieldLabel>
|
||||
<FieldLabel htmlFor="name">Name</FieldLabel>
|
||||
<Input
|
||||
id="email"
|
||||
name="email"
|
||||
type="email"
|
||||
autoComplete="email"
|
||||
placeholder="you@example.com"
|
||||
id="name"
|
||||
name="name"
|
||||
type="text"
|
||||
autoComplete="name"
|
||||
placeholder="Ada Lovelace"
|
||||
required
|
||||
/>
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel htmlFor="password">Password</FieldLabel>
|
||||
<Input
|
||||
id="password"
|
||||
name="password"
|
||||
type="password"
|
||||
autoComplete={
|
||||
flow === "signIn" ? "current-password" : "new-password"
|
||||
}
|
||||
required
|
||||
/>
|
||||
</Field>
|
||||
{error && <FieldError>{error}</FieldError>}
|
||||
<Field>
|
||||
<Button type="submit" disabled={submitting}>
|
||||
{submitting && <Spinner />}
|
||||
{text.submit}
|
||||
</Button>
|
||||
</Field>
|
||||
{!hideSignUpLink ? (
|
||||
<p className="text-center text-sm text-muted-foreground">
|
||||
{text.switchPrompt}{" "}
|
||||
<Link
|
||||
href={text.switchHref}
|
||||
className="text-primary underline-offset-4 hover:underline"
|
||||
>
|
||||
{text.switchLabel}
|
||||
</Link>
|
||||
</p>
|
||||
) : null}
|
||||
</FieldGroup>
|
||||
</form>
|
||||
)}
|
||||
)}
|
||||
<Field>
|
||||
<FieldLabel htmlFor="email">Email</FieldLabel>
|
||||
<Input
|
||||
id="email"
|
||||
name="email"
|
||||
type="email"
|
||||
autoComplete="email"
|
||||
placeholder="you@example.com"
|
||||
required
|
||||
/>
|
||||
</Field>
|
||||
<Field>
|
||||
<FieldLabel htmlFor="password">Password</FieldLabel>
|
||||
<Input
|
||||
id="password"
|
||||
name="password"
|
||||
type="password"
|
||||
autoComplete={
|
||||
flow === "signIn" ? "current-password" : "new-password"
|
||||
}
|
||||
required
|
||||
/>
|
||||
</Field>
|
||||
{error && <FieldError>{error}</FieldError>}
|
||||
<Field>
|
||||
<Button type="submit" disabled={submitting}>
|
||||
{submitting && <Spinner />}
|
||||
{text.submit}
|
||||
</Button>
|
||||
</Field>
|
||||
<p className="text-center text-sm text-muted-foreground">
|
||||
{text.switchPrompt}{" "}
|
||||
<Link
|
||||
href={text.switchHref}
|
||||
className="text-primary underline-offset-4 hover:underline"
|
||||
>
|
||||
{text.switchLabel}
|
||||
</Link>
|
||||
</p>
|
||||
</FieldGroup>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
"use client"
|
||||
|
||||
import { useConvexAuth } from "convex/react"
|
||||
import { usePathname, useRouter } from "next/navigation"
|
||||
import { useEffect } from "react"
|
||||
|
||||
// Media pages that signed-out visitors can open from share links.
|
||||
const PUBLIC_PATHS = new Set(["/album", "/artist", "/playlist"])
|
||||
|
||||
/**
|
||||
* Static exports have no proxy, so this keeps signed-out users on the auth
|
||||
* pages and signed-in users off them. Server builds redirect in proxy.server.ts.
|
||||
*/
|
||||
export function AuthRedirect({ area }: { area: "app" | "auth" }) {
|
||||
const { isAuthenticated, isLoading } = useConvexAuth()
|
||||
const pathname = usePathname()
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
if (isLoading) return
|
||||
if (area === "auth" && isAuthenticated) router.replace("/")
|
||||
if (area === "app" && !isAuthenticated && !PUBLIC_PATHS.has(pathname))
|
||||
router.replace("/signin")
|
||||
}, [area, isAuthenticated, isLoading, pathname, router])
|
||||
|
||||
return null
|
||||
}
|
||||
@@ -1,11 +1,19 @@
|
||||
"use client"
|
||||
|
||||
import { ConvexAuthNextjsProvider } from "@convex-dev/auth/nextjs"
|
||||
import { ConvexAuthProvider, useAuthToken } from "@convex-dev/auth/react"
|
||||
import { buildConvexUrl } from "@otunes/convex/server-url"
|
||||
import { ConvexReactClient } from "convex/react"
|
||||
import { ReactNode } from "react"
|
||||
import { usePathname, useRouter } from "next/navigation"
|
||||
import { ReactNode, useEffect } from "react"
|
||||
|
||||
import { PersistentCacheProvider } from "@/components/persistent-cache-provider"
|
||||
import {
|
||||
selectedServer,
|
||||
setMediaToken,
|
||||
staticExport,
|
||||
useSelectedServer,
|
||||
} from "@/lib/server"
|
||||
|
||||
// Server rendering never runs Convex queries, so this URL is never contacted.
|
||||
const SSR_CONVEX_URL = "http://127.0.0.1:3210"
|
||||
@@ -17,29 +25,50 @@ function browserConvexUrl() {
|
||||
return buildConvexUrl(host, protocol === "https:" ? "https" : "http")
|
||||
}
|
||||
|
||||
function getConvexClient(convexUrl: string | undefined) {
|
||||
if (!client) {
|
||||
client = new ConvexReactClient(
|
||||
typeof window === "undefined"
|
||||
? SSR_CONVEX_URL
|
||||
: (convexUrl ??
|
||||
process.env.NEXT_PUBLIC_CONVEX_URL ??
|
||||
browserConvexUrl())
|
||||
)
|
||||
}
|
||||
function getConvexClient(convexUrl: string) {
|
||||
client ??= new ConvexReactClient(convexUrl)
|
||||
return client
|
||||
}
|
||||
|
||||
export function ConvexClientProvider({
|
||||
convexUrl,
|
||||
children,
|
||||
}: {
|
||||
convexUrl?: string
|
||||
children: ReactNode
|
||||
}) {
|
||||
export function ConvexClientProvider({ children }: { children: ReactNode }) {
|
||||
if (staticExport) return <ExportProviders>{children}</ExportProviders>
|
||||
const url =
|
||||
typeof window === "undefined"
|
||||
? SSR_CONVEX_URL
|
||||
: (process.env.NEXT_PUBLIC_CONVEX_URL ?? browserConvexUrl())
|
||||
return (
|
||||
<ConvexAuthNextjsProvider client={getConvexClient(convexUrl)}>
|
||||
<PersistentCacheProvider>{children}</PersistentCacheProvider>{" "}
|
||||
<ConvexAuthNextjsProvider client={getConvexClient(url)}>
|
||||
<PersistentCacheProvider>{children}</PersistentCacheProvider>
|
||||
</ConvexAuthNextjsProvider>
|
||||
)
|
||||
}
|
||||
|
||||
// Static exports pick a server at /server first. With no Next.js server to
|
||||
// hold the session in cookies, tokens live in localStorage, keyed by the
|
||||
// Convex URL, as in the mobile app. Changing servers reloads the page.
|
||||
function ExportProviders({ children }: { children: ReactNode }) {
|
||||
const server = useSelectedServer()
|
||||
const pathname = usePathname()
|
||||
const router = useRouter()
|
||||
const onServerPage = pathname === "/server"
|
||||
|
||||
useEffect(() => {
|
||||
if (!onServerPage && !selectedServer()) router.replace("/server")
|
||||
}, [onServerPage, router])
|
||||
|
||||
if (onServerPage) return children
|
||||
if (!server) return null
|
||||
return (
|
||||
<ConvexAuthProvider client={getConvexClient(server.convexUrl)}>
|
||||
<MediaTokenSync />
|
||||
<PersistentCacheProvider>{children}</PersistentCacheProvider>
|
||||
</ConvexAuthProvider>
|
||||
)
|
||||
}
|
||||
|
||||
function MediaTokenSync() {
|
||||
const token = useAuthToken()
|
||||
// Set during render so players created in this commit see the new token.
|
||||
setMediaToken(token)
|
||||
return null
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import { Label } from "@/components/ui/label"
|
||||
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
|
||||
import { useCachedQuery } from "@/hooks/use-cached-query"
|
||||
import { useDownloadsVersion } from "@/hooks/use-downloads"
|
||||
import { authedUrl } from "@/lib/server"
|
||||
import {
|
||||
downloadQueue,
|
||||
readRememberedDownloadQuality,
|
||||
@@ -78,7 +79,7 @@ export function useDownloads() {
|
||||
}
|
||||
|
||||
async function fetchDownloadOptions(songIds: string[]) {
|
||||
const response = await fetch(DOWNLOAD_OPTIONS_PATH, {
|
||||
const response = await fetch(authedUrl(DOWNLOAD_OPTIONS_PATH), {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ songIds }),
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { albumPath, artistPath } from "@/lib/routes"
|
||||
|
||||
import * as React from "react"
|
||||
import Link from "next/link"
|
||||
import {
|
||||
@@ -165,7 +167,7 @@ export function MediaContextMenuItems({
|
||||
<MediaMenuSeparator />
|
||||
{artist ? (
|
||||
<MediaMenuItem asChild className="justify-between">
|
||||
<Link href={`/artist/${artist.id}`}>
|
||||
<Link href={artistPath(artist.id)}>
|
||||
Go to Artist
|
||||
<MicVocal />
|
||||
</Link>
|
||||
@@ -173,7 +175,7 @@ export function MediaContextMenuItems({
|
||||
) : null}
|
||||
{album ? (
|
||||
<MediaMenuItem asChild className="justify-between">
|
||||
<Link href={`/album/${album.id}`}>
|
||||
<Link href={albumPath(album.id)}>
|
||||
Go to Album
|
||||
<GalleryVerticalEnd />
|
||||
</Link>
|
||||
|
||||
@@ -2,10 +2,20 @@
|
||||
|
||||
import { ArrowUpRight } from "lucide-react"
|
||||
|
||||
import { serverOrigin } from "@/lib/server"
|
||||
|
||||
export function OpenAppButton() {
|
||||
function openApp() {
|
||||
const link = new URL("otunes://open")
|
||||
link.searchParams.set("url", window.location.href)
|
||||
// The app understands share links (/album/<id>), not in-app /album?id=<id>.
|
||||
const { pathname, search } = window.location
|
||||
const page = new URL(`${pathname}${search}`, serverOrigin())
|
||||
const id = page.searchParams.get("id")
|
||||
if (id && /^\/(album|artist|playlist)$/.test(page.pathname)) {
|
||||
page.pathname += `/${encodeURIComponent(id)}`
|
||||
page.searchParams.delete("id")
|
||||
}
|
||||
link.searchParams.set("url", page.href)
|
||||
window.location.assign(link.href)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { serverUrl } from "@/lib/server"
|
||||
|
||||
import { useAction, useMutation, useQuery } from "convex/react"
|
||||
import { MoreHorizontal, Trash2, Upload, UserPlus } from "lucide-react"
|
||||
import { useCallback, useEffect, useRef, useState } from "react"
|
||||
@@ -149,7 +151,9 @@ function UserAvatar({
|
||||
key={user.image ?? "fallback"}
|
||||
size={size === "sm" ? "sm" : "default"}
|
||||
>
|
||||
{user.image ? <AvatarImage src={user.image} alt={user.name} /> : null}
|
||||
{user.image ? (
|
||||
<AvatarImage src={serverUrl(user.image)} alt={user.name} />
|
||||
) : null}
|
||||
<AvatarFallback>{initials}</AvatarFallback>
|
||||
</Avatar>
|
||||
)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { authedUrl } from "@/lib/server"
|
||||
|
||||
import {
|
||||
useState,
|
||||
useEffect,
|
||||
@@ -354,15 +356,11 @@ function loadAudioSource(
|
||||
}
|
||||
|
||||
const { settings } = source
|
||||
const directUrl = songPlayPath(
|
||||
songId,
|
||||
settings.playbackQuality,
|
||||
settings.preferAtmos
|
||||
const directUrl = authedUrl(
|
||||
songPlayPath(songId, settings.playbackQuality, settings.preferAtmos)
|
||||
)
|
||||
const hlsUrl = songHlsPlaylistPath(
|
||||
songId,
|
||||
settings.playbackQuality,
|
||||
settings.preferAtmos
|
||||
const hlsUrl = authedUrl(
|
||||
songHlsPlaylistPath(songId, settings.playbackQuality, settings.preferAtmos)
|
||||
)
|
||||
|
||||
const loadDirectSource = () => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { albumPath, artistPath } from "@/lib/routes"
|
||||
import Link from "next/link"
|
||||
|
||||
import type { BrowseSong } from "@otunes/convex/types"
|
||||
@@ -24,7 +25,7 @@ export function PlaybackSongMeta({
|
||||
)}
|
||||
>
|
||||
<Link
|
||||
href={`/album/${song.album.id}`}
|
||||
href={albumPath(song.album.id)}
|
||||
className={cn(
|
||||
"block truncate text-sm font-medium hover:underline",
|
||||
inRange && "text-primary-foreground hover:text-primary-foreground/80",
|
||||
@@ -40,7 +41,7 @@ export function PlaybackSongMeta({
|
||||
)}
|
||||
>
|
||||
<Link
|
||||
href={`/artist/${song.artist.id}`}
|
||||
href={artistPath(song.artist.id)}
|
||||
className={cn(
|
||||
"hover:underline",
|
||||
inRange
|
||||
@@ -54,7 +55,7 @@ export function PlaybackSongMeta({
|
||||
<>
|
||||
<span aria-hidden="true"> — </span>
|
||||
<Link
|
||||
href={`/album/${song.album.id}`}
|
||||
href={albumPath(song.album.id)}
|
||||
className="hover:text-foreground hover:underline"
|
||||
>
|
||||
{song.album.title}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { albumPath, artistPath } from "@/lib/routes"
|
||||
|
||||
import * as React from "react"
|
||||
import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
@@ -184,21 +186,21 @@ export function PlayerBar() {
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<Link
|
||||
href={`/album/${currentSong.album.id}`}
|
||||
href={albumPath(currentSong.album.id)}
|
||||
className="block truncate text-sm font-semibold hover:underline md:text-[13px] md:leading-4"
|
||||
>
|
||||
{currentSong.title}
|
||||
</Link>
|
||||
<p className="truncate text-xs">
|
||||
<Link
|
||||
href={`/artist/${currentSong.artist.id}`}
|
||||
href={artistPath(currentSong.artist.id)}
|
||||
className="hover:underline"
|
||||
>
|
||||
{currentSong.artist.name}
|
||||
</Link>
|
||||
<span aria-hidden> · </span>
|
||||
<Link
|
||||
href={`/album/${currentSong.album.id}`}
|
||||
href={albumPath(currentSong.album.id)}
|
||||
className="hover:underline"
|
||||
>
|
||||
{currentSong.album.title}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { playlistPath } from "@/lib/routes"
|
||||
|
||||
import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
|
||||
@@ -79,7 +81,7 @@ export function PlaylistCard({ playlist }: { playlist: PlaylistSummary }) {
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="group relative aspect-square overflow-hidden rounded-lg ring-1 ring-foreground/10">
|
||||
<Link className="absolute inset-0" href={"/playlist/" + playlist.id}>
|
||||
<Link className="absolute inset-0" href={playlistPath(playlist.id)}>
|
||||
<Image
|
||||
src={playlistCoverUrl(playlist.id, playlist.cover, 384)}
|
||||
alt={playlist.title}
|
||||
@@ -130,7 +132,7 @@ export function PlaylistCard({ playlist }: { playlist: PlaylistSummary }) {
|
||||
</div>
|
||||
|
||||
<div className="min-w-0">
|
||||
<Link href={"/playlist/" + playlist.id} className="hover:underline">
|
||||
<Link href={playlistPath(playlist.id)} className="hover:underline">
|
||||
<p className="truncate text-sm font-medium">{playlist.title}</p>
|
||||
</Link>
|
||||
<p className="truncate text-xs text-muted-foreground decoration-muted-foreground">
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import { useDownloads } from "@/components/downloads-provider"
|
||||
import { useSongDownloadState } from "@/hooks/use-downloads"
|
||||
import { albumPath, artistPath } from "@/lib/routes"
|
||||
|
||||
import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
import { useAddToPlaylist } from "@/components/add-to-playlist-provider"
|
||||
@@ -81,7 +83,7 @@ export function SearchSongItem({ song }: { song: SearchSong }) {
|
||||
<MediaContextMenuArea menu={menu}>
|
||||
<div className="group flex items-center gap-3 rounded-lg px-1 py-1.5 transition-colors hover:bg-muted/50">
|
||||
<Link
|
||||
href={`/album/${song.album.id}`}
|
||||
href={albumPath(song.album.id)}
|
||||
className="relative size-11 shrink-0 overflow-hidden rounded ring-1 ring-foreground/10"
|
||||
>
|
||||
<Image
|
||||
@@ -94,11 +96,11 @@ export function SearchSongItem({ song }: { song: SearchSong }) {
|
||||
</Link>
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<Link href={`/album/${song.album.id}`} className="hover:underline">
|
||||
<Link href={albumPath(song.album.id)} className="hover:underline">
|
||||
<p className="truncate text-sm font-medium">{song.title}</p>
|
||||
</Link>
|
||||
<Link
|
||||
href={`/artist/${song.artist.id}`}
|
||||
href={artistPath(song.artist.id)}
|
||||
className="text-muted-foreground hover:text-foreground hover:underline"
|
||||
>
|
||||
<p className="truncate text-sm">{song.artist.name}</p>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { albumPath, artistPath } from "@/lib/routes"
|
||||
|
||||
import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
|
||||
@@ -12,11 +14,11 @@ export type TopResult = SearchTopResultItem
|
||||
function resultHref(result: TopResult) {
|
||||
switch (result.kind) {
|
||||
case "song":
|
||||
return `/album/${result.item.album.id}`
|
||||
return albumPath(result.item.album.id)
|
||||
case "album":
|
||||
return `/album/${result.item.id}`
|
||||
return albumPath(result.item.id)
|
||||
case "artist":
|
||||
return `/artist/${result.item.id}`
|
||||
return artistPath(result.item.id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
"use client"
|
||||
|
||||
import { useState, type FormEvent } from "react"
|
||||
import Image from "next/image"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Input } from "@/components/ui/input"
|
||||
import {
|
||||
Field,
|
||||
FieldError,
|
||||
FieldGroup,
|
||||
FieldLabel,
|
||||
} from "@/components/ui/field"
|
||||
import { clearPersistentCache } from "@/lib/persistent-cache"
|
||||
import { saveServer, selectedServer } from "@/lib/server"
|
||||
import { parseServerHostname } from "@otunes/convex/server-url"
|
||||
|
||||
// Picks the oTunes server for static exports (desktop apps). Saving reloads
|
||||
// the app so Convex connects to the new server.
|
||||
export function ServerForm() {
|
||||
const [address, setAddress] = useState(() => selectedServer()?.hostname ?? "")
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
|
||||
async function connect(event: FormEvent<HTMLFormElement>) {
|
||||
event.preventDefault()
|
||||
const server = parseServerHostname(address)
|
||||
if (!server) {
|
||||
setError("Enter a hostname, like music.example.com.")
|
||||
return
|
||||
}
|
||||
setError(null)
|
||||
setSubmitting(true)
|
||||
try {
|
||||
// Opaque, but it fails when the Convex server cannot be reached.
|
||||
await fetch(`${server.convexUrl}/version`, {
|
||||
mode: "no-cors",
|
||||
signal: AbortSignal.timeout(10000),
|
||||
})
|
||||
} catch {
|
||||
setError("Could not reach the server. Check the address and try again.")
|
||||
setSubmitting(false)
|
||||
return
|
||||
}
|
||||
if (server.convexUrl !== selectedServer()?.convexUrl)
|
||||
await clearPersistentCache()
|
||||
saveServer(server)
|
||||
window.location.replace("/signin")
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="grid min-h-svh bg-background text-foreground md:grid-cols-2">
|
||||
<aside className="flex flex-col justify-between gap-12 border-b border-border bg-muted/30 p-8 md:border-r md:border-b-0 md:p-12">
|
||||
<div className="flex items-center gap-3">
|
||||
<Image
|
||||
src="/logo.png"
|
||||
alt=""
|
||||
width={48}
|
||||
height={48}
|
||||
unoptimized
|
||||
className="dark:hidden"
|
||||
/>
|
||||
<Image
|
||||
src="/logo-dark.png"
|
||||
alt=""
|
||||
width={48}
|
||||
height={48}
|
||||
unoptimized
|
||||
className="hidden dark:block"
|
||||
/>
|
||||
<span className="text-xl font-semibold">oTunes</span>
|
||||
</div>
|
||||
<h1 className="text-4xl font-semibold tracking-tight lg:text-5xl">
|
||||
Your server.
|
||||
<br />
|
||||
Your music.
|
||||
</h1>
|
||||
</aside>
|
||||
<section className="flex items-center justify-center p-8 md:p-12">
|
||||
<form onSubmit={connect} className="w-full max-w-sm">
|
||||
<h2 className="mb-8 text-2xl font-semibold tracking-tight">
|
||||
Connect to a server
|
||||
</h2>
|
||||
<FieldGroup>
|
||||
<Field>
|
||||
<FieldLabel htmlFor="server-address">Server address</FieldLabel>
|
||||
<Input
|
||||
id="server-address"
|
||||
name="hostname"
|
||||
value={address}
|
||||
onChange={(event) => setAddress(event.target.value)}
|
||||
placeholder="music.example.com"
|
||||
autoCapitalize="none"
|
||||
autoCorrect="off"
|
||||
spellCheck={false}
|
||||
autoComplete="url"
|
||||
required
|
||||
disabled={submitting}
|
||||
aria-invalid={!!error}
|
||||
aria-describedby={error ? "server-error" : undefined}
|
||||
/>
|
||||
{error && (
|
||||
<FieldError id="server-error" role="alert">
|
||||
{error}
|
||||
</FieldError>
|
||||
)}
|
||||
</Field>
|
||||
<Button type="submit" disabled={submitting}>
|
||||
{submitting ? "Connecting…" : "Continue"}
|
||||
</Button>
|
||||
</FieldGroup>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { albumPath, artistPath } from "@/lib/routes"
|
||||
|
||||
import * as React from "react"
|
||||
import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
@@ -398,7 +400,7 @@ function TrackRowComponent({
|
||||
</div>
|
||||
<div className={LIBRARY_COLUMN}>
|
||||
<Link
|
||||
href={"/artist/" + song.artist.id}
|
||||
href={artistPath(song.artist.id)}
|
||||
className={linkClass}
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
>
|
||||
@@ -407,7 +409,7 @@ function TrackRowComponent({
|
||||
</div>
|
||||
<div className={LIBRARY_COLUMN}>
|
||||
<Link
|
||||
href={"/album/" + song.album.id}
|
||||
href={albumPath(song.album.id)}
|
||||
className={linkClass}
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { serverUrl } from "@/lib/server"
|
||||
|
||||
export type CoverImageSize = 64 | 128 | 192 | 256 | 384 | 512 | 768 | 1024
|
||||
|
||||
function withCoverImageSize(uri: string, size?: CoverImageSize) {
|
||||
return size ? `${uri}?size=${size}` : uri
|
||||
return serverUrl(size ? `${uri}?size=${size}` : uri)
|
||||
}
|
||||
|
||||
export function artistCoverUrl(artistId: string, size?: CoverImageSize) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const EC3_MIME = 'audio/x-m4a; codecs="ec-3"'
|
||||
const EC3_MIMES = ['audio/mp4; codecs="ec-3"', 'audio/x-m4a; codecs="ec-3"']
|
||||
const AC4_MIME = 'audio/x-m4a; codecs="ac-4"'
|
||||
|
||||
function canPlayMime(audio: HTMLAudioElement, mime: string): boolean {
|
||||
@@ -6,5 +6,8 @@ function canPlayMime(audio: HTMLAudioElement, mime: string): boolean {
|
||||
}
|
||||
|
||||
export function supportsDolbyAtmosPlayback(audio: HTMLAudioElement): boolean {
|
||||
return canPlayMime(audio, EC3_MIME) || canPlayMime(audio, AC4_MIME)
|
||||
return (
|
||||
EC3_MIMES.some((mime) => canPlayMime(audio, mime)) ||
|
||||
canPlayMime(audio, AC4_MIME)
|
||||
)
|
||||
}
|
||||
@@ -12,6 +12,8 @@ import {
|
||||
songDownloadPath,
|
||||
type DownloadQuality,
|
||||
} from "@otunes/convex/download-quality"
|
||||
import { albumPath, playlistPath } from "@/lib/routes"
|
||||
import { authedUrl, serverUrl, staticExport } from "@/lib/server"
|
||||
|
||||
// Like YouTube Music on the web, downloads live in this browser's IndexedDB
|
||||
// and only play inside the app. Clearing site data removes them.
|
||||
@@ -38,21 +40,22 @@ export const OTHER_DOWNLOADS_PATH = "/library/downloads/other"
|
||||
export const FROM_DOWNLOADS_PARAM = "from=downloads"
|
||||
|
||||
export function downloadedCollectionPath({ kind, id }: DownloadedCollection) {
|
||||
if (kind === "album") return `/album/${id}?${FROM_DOWNLOADS_PARAM}`
|
||||
if (id === FAVORITES_ID) return `/playlist/favorites?${FROM_DOWNLOADS_PARAM}`
|
||||
return `/playlist/${id}?${FROM_DOWNLOADS_PARAM}`
|
||||
const path = kind === "album" ? albumPath(id) : playlistPath(id)
|
||||
return `${path}&${FROM_DOWNLOADS_PARAM}`
|
||||
}
|
||||
|
||||
// Saved pages are specific to the signed-in user (public/downloads-sw.js).
|
||||
const OFFLINE_PAGE_CACHE = "otunes-offline-pages"
|
||||
|
||||
/**
|
||||
* Lets downloaded covers show offline. In production builds the worker also
|
||||
* keeps pages and app code so the app opens offline.
|
||||
* Lets downloaded covers show offline. In production server builds the worker
|
||||
* also keeps pages and app code so the app opens offline. Static exports are
|
||||
* served locally, so they always open.
|
||||
*/
|
||||
export function registerDownloadsServiceWorker() {
|
||||
const url =
|
||||
process.env.NODE_ENV === "production"
|
||||
process.env.NODE_ENV === "production" && !staticExport
|
||||
? "/downloads-sw.js?offline-app"
|
||||
: "/downloads-sw.js"
|
||||
void navigator.serviceWorker?.register(url, { scope: "/" }).catch(() => {})
|
||||
@@ -123,9 +126,12 @@ const storage: DownloadStorage = {
|
||||
)
|
||||
},
|
||||
async save({ songId, requested, quality, albumId }, signal) {
|
||||
const response = await fetch(songDownloadPath(songId, requested), {
|
||||
signal,
|
||||
})
|
||||
const response = await fetch(
|
||||
authedUrl(songDownloadPath(songId, requested)),
|
||||
{
|
||||
signal,
|
||||
}
|
||||
)
|
||||
if (!response.ok) {
|
||||
throw new Error(`Download failed with ${response.status}`)
|
||||
}
|
||||
@@ -142,7 +148,7 @@ const storage: DownloadStorage = {
|
||||
const cache = await caches.open(COVER_CACHE)
|
||||
const key = coverPath(cover)
|
||||
if (await cache.match(key)) return
|
||||
const response = await fetch(`${key}?size=${COVER_SIZE}`)
|
||||
const response = await fetch(serverUrl(`${key}?size=${COVER_SIZE}`))
|
||||
if (!response.ok) throw new Error(`Cover failed with ${response.status}`)
|
||||
await cache.put(key, response)
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { toast } from "sonner"
|
||||
import { serverOrigin } from "@/lib/server"
|
||||
import {
|
||||
mediaShareUrl,
|
||||
type MediaShareTarget,
|
||||
@@ -7,9 +8,7 @@ import {
|
||||
export type MediaShareContext = MediaShareTarget
|
||||
|
||||
export async function copyMediaShareLink(share: MediaShareContext) {
|
||||
await navigator.clipboard.writeText(
|
||||
mediaShareUrl(window.location.origin, share)
|
||||
)
|
||||
await navigator.clipboard.writeText(mediaShareUrl(serverOrigin(), share))
|
||||
toast.success("Link Copied")
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// In-app routes pass ids as query parameters so the UI can be a static export.
|
||||
// Share links keep the `/album/<id>` form (see mediaShareUrl), which only the
|
||||
// server build serves, with link-preview metadata.
|
||||
|
||||
export function albumPath(albumId: string, songId?: string) {
|
||||
const query = new URLSearchParams({ id: albumId })
|
||||
if (songId) query.set("s", songId)
|
||||
return `/album?${query}`
|
||||
}
|
||||
|
||||
export function artistPath(artistId: string) {
|
||||
return `/artist?${new URLSearchParams({ id: artistId })}`
|
||||
}
|
||||
|
||||
export function playlistPath(playlistId: string) {
|
||||
return `/playlist?${new URLSearchParams({ id: playlistId })}`
|
||||
}
|
||||
@@ -2,15 +2,29 @@ import { convexAuthNextjsToken } from "@convex-dev/auth/nextjs/server"
|
||||
import { api } from "@otunes/convex/_generated/api"
|
||||
import type { Doc, Id } from "@otunes/convex/_generated/dataModel"
|
||||
import { fetchQuery } from "convex/nextjs"
|
||||
import type { NextRequest } from "next/server"
|
||||
import { convexServerOptions } from "@/lib/convex-server"
|
||||
import type { SongSource } from "@/lib/server-hls"
|
||||
|
||||
/**
|
||||
* Loads a song's file paths as the requesting listener, so Convex enforces auth
|
||||
* even if the proxy is bypassed. Throws when signed out or the song is missing.
|
||||
* The listener's session, from the cookie or from a `token` query parameter
|
||||
* (static exports on another origin).
|
||||
*/
|
||||
export async function getSongSource(id: string): Promise<SongSource> {
|
||||
const token = await convexAuthNextjsToken()
|
||||
async function sessionToken(request: NextRequest) {
|
||||
return (
|
||||
request.nextUrl.searchParams.get("token") ?? (await convexAuthNextjsToken())
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a song's file paths as the requesting listener, so Convex enforces
|
||||
* auth. Throws when signed out or missing.
|
||||
*/
|
||||
export async function getSongSource(
|
||||
id: string,
|
||||
request: NextRequest
|
||||
): Promise<SongSource> {
|
||||
const token = await sessionToken(request)
|
||||
const song = await fetchQuery(
|
||||
api.library.getSongSource,
|
||||
{ id: id as Id<"songs"> },
|
||||
@@ -23,8 +37,11 @@ export async function getSongSource(id: string): Promise<SongSource> {
|
||||
}
|
||||
|
||||
/** The song's stored lyrics tag, or null without lyrics. */
|
||||
export async function getSongLyrics(id: string): Promise<string | null> {
|
||||
const token = await convexAuthNextjsToken()
|
||||
export async function getSongLyrics(
|
||||
id: string,
|
||||
request: NextRequest
|
||||
): Promise<string | null> {
|
||||
const token = await sessionToken(request)
|
||||
return await fetchQuery(
|
||||
api.lyrics.forSong,
|
||||
{ id: id as Id<"songs"> },
|
||||
@@ -36,9 +53,10 @@ const SOURCE_BATCH_SIZE = 200
|
||||
|
||||
/** `getSongSource` for many songs, in batches. Missing songs are left out. */
|
||||
export async function getSongSources(
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
request: NextRequest
|
||||
): Promise<(SongSource & Pick<Doc<"songs">, "album">)[]> {
|
||||
const token = await convexAuthNextjsToken()
|
||||
const token = await sessionToken(request)
|
||||
const batches: string[][] = []
|
||||
for (let start = 0; start < ids.length; start += SOURCE_BATCH_SIZE) {
|
||||
batches.push(ids.slice(start, start + SOURCE_BATCH_SIZE))
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import type { ServerConfig } from "@otunes/convex/server-url"
|
||||
import { useSyncExternalStore } from "react"
|
||||
|
||||
// The server build is served by the oTunes server, so media paths stay
|
||||
// relative and the session cookie authenticates them. Static exports (desktop
|
||||
// apps) are served locally and talk to a server the user picks at runtime.
|
||||
export const staticExport = process.env.OTUNES_STATIC_EXPORT === "1"
|
||||
|
||||
const SERVER_KEY = "otunes.server"
|
||||
|
||||
function readServer(): ServerConfig | null {
|
||||
if (!staticExport || typeof window === "undefined") return null
|
||||
try {
|
||||
return JSON.parse(localStorage.getItem(SERVER_KEY) ?? "null")
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
let server = readServer()
|
||||
|
||||
export function selectedServer() {
|
||||
return server
|
||||
}
|
||||
|
||||
export function saveServer(config: ServerConfig) {
|
||||
localStorage.setItem(SERVER_KEY, JSON.stringify(config))
|
||||
server = config
|
||||
}
|
||||
|
||||
const noop = () => () => {}
|
||||
|
||||
/** The picked server in static exports. `null` while prerendering. */
|
||||
export function useSelectedServer() {
|
||||
return useSyncExternalStore(noop, selectedServer, () => null)
|
||||
}
|
||||
|
||||
/** Origin of the oTunes server, for share links. */
|
||||
export function serverOrigin() {
|
||||
return server?.serverUrl ?? window.location.origin
|
||||
}
|
||||
|
||||
/** Resolves an `/api/...` path against the oTunes server. */
|
||||
export function serverUrl(path: string) {
|
||||
return server ? `${server.serverUrl}${path}` : path
|
||||
}
|
||||
|
||||
let mediaToken: string | null = null
|
||||
|
||||
/** Kept current by the auth provider in static exports. */
|
||||
export function setMediaToken(token: string | null) {
|
||||
mediaToken = token
|
||||
}
|
||||
|
||||
/**
|
||||
* URL for a route that needs a session (songs, downloads). `<audio>` and
|
||||
* native HLS cannot send headers, and exports have no cookie on the server's
|
||||
* origin, so they pass the session token in the query. HLS segment URLs
|
||||
* inherit it from the playlist URL.
|
||||
*/
|
||||
export function authedUrl(path: string) {
|
||||
const url = serverUrl(path)
|
||||
if (!server || !mediaToken) return url
|
||||
return `${url}${url.includes("?") ? "&" : "?"}token=${encodeURIComponent(mediaToken)}`
|
||||
}
|
||||
+26
-1
@@ -1,9 +1,33 @@
|
||||
import path from "node:path"
|
||||
import type { NextConfig } from "next"
|
||||
|
||||
// `pnpm build:export` writes the UI as static files to `out`, for the desktop
|
||||
// apps. It leaves out server-only files (`*.server.ts[x]`): route handlers, the
|
||||
// proxy and share-link metadata pages.
|
||||
const staticExport = process.env.OTUNES_STATIC_EXPORT === "1"
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
output: "standalone",
|
||||
output: staticExport ? "export" : "standalone",
|
||||
distDir: staticExport ? "out" : ".next",
|
||||
pageExtensions: staticExport
|
||||
? ["tsx", "ts"]
|
||||
: ["server.tsx", "server.ts", "tsx", "ts"],
|
||||
env: { OTUNES_STATIC_EXPORT: staticExport ? "1" : "" },
|
||||
outputFileTracingRoot: path.join(__dirname, "../../"),
|
||||
// Desktop apps load media from their own origin. Session routes take a
|
||||
// `token` parameter rather than cookies, so allowing any origin is safe.
|
||||
headers: staticExport
|
||||
? undefined
|
||||
: async () => [
|
||||
{
|
||||
source: "/api/:path*",
|
||||
headers: [
|
||||
{ key: "Access-Control-Allow-Origin", value: "*" },
|
||||
// For the JSON body of POST /api/download/options.
|
||||
{ key: "Access-Control-Allow-Headers", value: "Content-Type" },
|
||||
],
|
||||
},
|
||||
],
|
||||
experimental: {
|
||||
// Failed navigations wait for the connection instead of reloading the
|
||||
// page, which would show the browser's offline page and stop playback.
|
||||
@@ -15,6 +39,7 @@ const nextConfig: NextConfig = {
|
||||
},
|
||||
},
|
||||
images: {
|
||||
unoptimized: staticExport,
|
||||
minimumCacheTTL: 60,
|
||||
dangerouslyAllowSVG: true,
|
||||
contentDispositionType: "attachment",
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"build:export": "OTUNES_STATIC_EXPORT=1 next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint .",
|
||||
"typecheck": "tsc --noEmit"
|
||||
|
||||
@@ -7,18 +7,24 @@ import { getConvexServerUrl } from "@/lib/convex-server"
|
||||
|
||||
const isAuthPage = createRouteMatcher(["/signin", "/signup"])
|
||||
const isPublic = createRouteMatcher([
|
||||
// Song routes check the session themselves, from the cookie or a `token`
|
||||
// query parameter (static exports on another origin).
|
||||
"/api/song/(.*)",
|
||||
"/api/download/options",
|
||||
"/api/album/:id/cover",
|
||||
"/api/artist/:id/cover",
|
||||
"/api/playlist/:id/cover",
|
||||
// Mobile clients load avatars without the web auth cookie.
|
||||
"/api/user/:id/avatar",
|
||||
"/album",
|
||||
"/album/:id",
|
||||
"/artist",
|
||||
"/artist/:id",
|
||||
"/library/artists/:id",
|
||||
"/playlist",
|
||||
"/playlist/:id",
|
||||
])
|
||||
|
||||
export default convexAuthNextjsMiddleware(
|
||||
const authMiddleware = convexAuthNextjsMiddleware(
|
||||
async (request, { convexAuth }) => {
|
||||
if (isPublic(request)) {
|
||||
return
|
||||
@@ -37,6 +43,8 @@ export default convexAuthNextjsMiddleware(
|
||||
{ convexUrl: getConvexServerUrl() }
|
||||
)
|
||||
|
||||
export default authMiddleware
|
||||
|
||||
export const config = {
|
||||
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
|
||||
}
|
||||
@@ -7,7 +7,8 @@
|
||||
// unused for a month is deleted, so old deploys don't pile up.
|
||||
// - Covers of downloaded music, saved by lib/downloads.ts, served only when
|
||||
// the network fails. Any other cover falls back to the placeholder the
|
||||
// server would send for a missing cover.
|
||||
// server would send for a missing cover. Static exports load covers from
|
||||
// the picked server's origin, so covers match on the path alone.
|
||||
// Pages and app code are only handled in production builds (`?offline-app`),
|
||||
// where app code is content-hashed.
|
||||
const COVER_CACHE = "otunes-download-covers"
|
||||
@@ -71,8 +72,7 @@ async function pruneStatic() {
|
||||
|
||||
/** The saved cover's key for a cover request, also through `/_next/image`. */
|
||||
function coverKey(url) {
|
||||
if (url.origin !== self.location.origin) return null
|
||||
if (url.pathname === "/_next/image") {
|
||||
if (url.origin === self.location.origin && url.pathname === "/_next/image") {
|
||||
const inner = url.searchParams.get("url")
|
||||
return inner ? coverKey(new URL(inner, self.location.origin)) : null
|
||||
}
|
||||
@@ -170,7 +170,10 @@ async function savedCover(key) {
|
||||
async function handleCover(request, key) {
|
||||
try {
|
||||
const response = await fetch(request)
|
||||
return response.ok ? response : ((await savedCover(key)) ?? response)
|
||||
// Covers from another origin load as opaque responses, with no status.
|
||||
return response.ok || response.type === "opaque"
|
||||
? response
|
||||
: ((await savedCover(key)) ?? response)
|
||||
} catch (error) {
|
||||
const cover = await savedCover(key)
|
||||
if (cover) return cover
|
||||
@@ -195,6 +198,11 @@ self.addEventListener("fetch", (event) => {
|
||||
const { request } = event
|
||||
if (request.method !== "GET") return
|
||||
const url = new URL(request.url)
|
||||
const cover = coverKey(url)
|
||||
if (cover) {
|
||||
event.respondWith(handleCover(request, cover))
|
||||
return
|
||||
}
|
||||
if (url.origin !== self.location.origin) return
|
||||
|
||||
if (OFFLINE_APP && request.mode === "navigate") {
|
||||
@@ -205,11 +213,6 @@ self.addEventListener("fetch", (event) => {
|
||||
event.respondWith(handleStatic(request, url))
|
||||
return
|
||||
}
|
||||
const cover = coverKey(url)
|
||||
if (cover) {
|
||||
event.respondWith(handleCover(request, cover))
|
||||
return
|
||||
}
|
||||
if (OFFLINE_APP && PUBLIC_FILE.test(url.pathname)) {
|
||||
event.respondWith(handlePublicFile(request, url.pathname))
|
||||
}
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
"**/*.tsx",
|
||||
"**/*.mts",
|
||||
".next/types/**/*.ts",
|
||||
".next/dev/types/**/*.ts"
|
||||
".next/dev/types/**/*.ts",
|
||||
".next-desktop/types/**/*.ts",
|
||||
".next-desktop/dev/types/**/*.ts"
|
||||
],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
+3
-1
@@ -12,7 +12,9 @@
|
||||
"start": "pnpm --filter @otunes/web start",
|
||||
"lint": "pnpm -r lint",
|
||||
"format": "prettier --write \"**/*.{ts,tsx}\"",
|
||||
"typecheck": "pnpm -r typecheck"
|
||||
"typecheck": "pnpm -r typecheck",
|
||||
"dev:desktop": "pnpm --filter @otunes/desktop start",
|
||||
"build:desktop": "pnpm --filter @otunes/desktop build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^3.8.3",
|
||||
|
||||
@@ -45,3 +45,32 @@ export function buildConvexUrl(
|
||||
? `${protocol}://${convexHost}:${port}`
|
||||
: `${protocol}://${convexHost}`
|
||||
}
|
||||
|
||||
export type ServerConfig = {
|
||||
/** Raw hostname the user entered, e.g. `music.example.com` or `192.168.86.25:3000` */
|
||||
hostname: string
|
||||
/** Base URL for the Next.js server, e.g. `https://music.example.com` */
|
||||
serverUrl: string
|
||||
/** Convex deployment URL, e.g. `https://convex.music.example.com` */
|
||||
convexUrl: string
|
||||
}
|
||||
|
||||
/** Parses a user-entered server address. Local hosts use http, others https. */
|
||||
export function parseServerHostname(input: string): ServerConfig | null {
|
||||
const hostname = input
|
||||
.trim()
|
||||
.replace(/^https?:\/\//i, "")
|
||||
.replace(/\/+$/, "")
|
||||
if (!hostname) return null
|
||||
|
||||
try {
|
||||
const protocol = isLocalHost(hostname) ? "http" : "https"
|
||||
const serverUrl = `${protocol}://${hostname}`
|
||||
const convexUrl = buildConvexUrl(hostname)
|
||||
new URL(serverUrl)
|
||||
new URL(convexUrl)
|
||||
return { hostname, serverUrl, convexUrl }
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
Generated
+1446
File diff suppressed because it is too large.
Load diff
@@ -10,6 +10,9 @@ patchedDependencies:
|
||||
'@react-native-community/slider@5.2.1': patches/@react-native-community__slider@5.2.1.patch
|
||||
'expo-router@58.0.25': patches/expo-router@58.0.25.patch
|
||||
allowBuilds:
|
||||
electron: true
|
||||
# Squirrel installer support; the Windows build uses NSIS.
|
||||
electron-winstaller: false
|
||||
esbuild: true
|
||||
unrs-resolver: true
|
||||
overrides:
|
||||
|
||||
Reference in new issue
Block a user