In-app links move to /album?id=, /artist?id= and /playlist?id= so every page can prerender. Server-only files use a .server.ts(x) suffix that `pnpm build:export` leaves out: route handlers, the proxy, the desktop server picker, and the /album/<id> share pages with link-preview metadata. Exports use client-only Convex Auth and redirect in the browser. Sign-up now checks the setting in the browser. The sign-in link always shows, and a disabled server replaces the sign-up form with a notice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import path from "node:path"
|
|
import type { NextConfig } from "next"
|
|
|
|
const desktop = process.env.OTUNES_DESKTOP_BUILD === "1"
|
|
// `pnpm build:export` writes the UI as static files to `out`. It leaves out
|
|
// server-only files (`*.server.ts[x]`): route handlers, the proxy, share-link
|
|
// metadata pages and the desktop server picker.
|
|
const staticExport = process.env.OTUNES_STATIC_EXPORT === "1"
|
|
|
|
const nextConfig: NextConfig = {
|
|
output: staticExport ? "export" : "standalone",
|
|
distDir: staticExport ? "out" : desktop ? ".next-desktop" : ".next",
|
|
pageExtensions: staticExport
|
|
? ["tsx", "ts"]
|
|
: ["server.tsx", "server.ts", "tsx", "ts"],
|
|
env: { OTUNES_STATIC_EXPORT: staticExport ? "1" : "" },
|
|
outputFileTracingRoot: path.join(__dirname, "../../"),
|
|
experimental: {
|
|
// Failed navigations wait for the connection instead of reloading the
|
|
// page, which would show the browser's offline page and stop playback.
|
|
useOffline: true,
|
|
// App pages render their data from the client cache, so reusing a visited
|
|
// page's server payload is safe and skips a round trip on revisits.
|
|
staleTimes: {
|
|
dynamic: 300,
|
|
},
|
|
},
|
|
images: {
|
|
unoptimized: desktop || staticExport,
|
|
minimumCacheTTL: 60,
|
|
dangerouslyAllowSVG: true,
|
|
contentDispositionType: "attachment",
|
|
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
|
|
},
|
|
}
|
|
|
|
export default nextConfig
|