CI / ci (push) Canceled after 0s
1. Root cause of the database error The Manager proxy was bypassing installation checks, but / still resolved to src/app/page.tsx, which statically imported: - @/auth - Prisma - business branding - business permissions - primary business data The root route now redirects to /manager inside the proxy before the business homepage is evaluated. 2. Root cause of the Auth.js error The global business SessionProvider was mounted around Manager pages. It automatically requested: The business homepage is not evaluated first. 5. Provider and authentication separation Manager mode: - Uses ManagerProviders - Uses the signed Manager cookie session - Does not mount SessionProvider - Does not call /api/auth/session - Does not import business Auth.js or Prisma Business mode: - Dynamically loads the existing business Providers - Continues using Auth.js and SessionProvider - Preserves installation, /owner, and /staff behavior 6. Database independence Manager mode now avoids database initialization for: - Proxy requests - Root metadata and viewport - Root routing - Manager pages - Manager APIs - Manifest requests - Health requests - Business Auth.js requests - Business cron requests No fake DATABASE_* variables were added. 7. Tests Added coverage for: - Manager / routing - Manager /manager access - No installation-state check in Manager mode - Prisma import protection - Business installation checks - /owner protection - Business Auth.js 404 boundary - Manager health route without Prisma - Manager manifest without business branding 8. Validation
82 lines
3.0 KiB
TypeScript
82 lines
3.0 KiB
TypeScript
import type { MetadataRoute } from "next";
|
|
|
|
/**
|
|
* Next.js's manifest file convention — auto-served at /manifest.webmanifest
|
|
* with the <link rel="manifest"> tag injected automatically. Dynamic as of
|
|
* Phase 8: name/description/colors reflect the installed business (see
|
|
* src/lib/business/branding.ts) rather than the internal product name.
|
|
*
|
|
* `force-dynamic` is required, not optional — without it, Next has no
|
|
* signal that this route depends on request-time data (a plain DB read
|
|
* doesn't count as one of Next's dynamic-usage triggers) and statically
|
|
* renders it once at build time. Since the Docker image is built before
|
|
* the installation wizard ever runs, that bakes in the pre-install
|
|
* neutral fallback ("Book an Appointment"/"Booking") permanently — the
|
|
* real business name/icons would never appear no matter how the Business
|
|
* row changes afterward.
|
|
*
|
|
* Each of the four manifest icons falls back independently to the app's
|
|
* own pre-generated, correctly-sized/maskable PWA icon when a business
|
|
* hasn't uploaded its own — a business can set some without all four (see
|
|
* the "App Icon & Home Screen" super-admin settings screen). This is
|
|
* fallback rule #2 ("business name + a neutral generated icon") applied
|
|
* per-field, rather than risking a broken/non-square install icon.
|
|
*/
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export default async function manifest(): Promise<MetadataRoute.Manifest> {
|
|
if (process.env.MANAGER_MODE === "true") {
|
|
return {
|
|
name: "NextChair Manager",
|
|
short_name: "Manager",
|
|
description: "Manage NextChair business deployments.",
|
|
start_url: "/manager",
|
|
scope: "/",
|
|
display: "standalone",
|
|
background_color: "#f4f6f4",
|
|
theme_color: "#111b15",
|
|
orientation: "portrait-primary",
|
|
icons: [{ src: "/icons/icon-192.png", sizes: "192x192", type: "image/png" }],
|
|
};
|
|
}
|
|
const { getBranding } = await import("@/lib/business/branding");
|
|
const branding = await getBranding();
|
|
return {
|
|
name: branding.name,
|
|
short_name: branding.shortName,
|
|
description: branding.description || "Book your next appointment in seconds.",
|
|
start_url: "/home",
|
|
scope: "/",
|
|
display: "standalone",
|
|
background_color: branding.backgroundColor,
|
|
theme_color: branding.themeColor,
|
|
orientation: "portrait-primary",
|
|
icons: [
|
|
{
|
|
src: branding.icon192Url || "/icons/icon-192.png",
|
|
sizes: "192x192",
|
|
type: "image/png",
|
|
purpose: "any",
|
|
},
|
|
{
|
|
src: branding.icon512Url || "/icons/icon-512.png",
|
|
sizes: "512x512",
|
|
type: "image/png",
|
|
purpose: "any",
|
|
},
|
|
{
|
|
src: branding.maskableIcon192Url || "/icons/icon-maskable-192.png",
|
|
sizes: "192x192",
|
|
type: "image/png",
|
|
purpose: "maskable",
|
|
},
|
|
{
|
|
src: branding.maskableIcon512Url || "/icons/icon-maskable-512.png",
|
|
sizes: "512x512",
|
|
type: "image/png",
|
|
purpose: "maskable",
|
|
},
|
|
],
|
|
};
|
|
}
|