refactor: centralize hotel name fallback via FALLBACK_HOTEL_NAME
Route all user-facing Atom hotel defaults through resolveHotelName (settings then HOTEL_NAME env then brand constant). Exclude Playwright e2e from tsconfig until deps are installed. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
6b2819aa20
commit
e00e9ca2dc
31 files changed
+113
-56
No files matched your search
@@ -4,6 +4,7 @@ import { auth } from "@/lib/auth";
|
||||
import { issueSsoTicket } from "@/lib/auth/sso-ticket";
|
||||
import { cached } from "@/lib/cache";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { resolveHotelName } from "@/lib/hotel-name";
|
||||
import { siteSettings } from "@/lib/services/site-settings";
|
||||
import { ClientView } from "./client-view";
|
||||
|
||||
@@ -16,12 +17,12 @@ export default async function ClientPage() {
|
||||
const userId = Number(session.user.id);
|
||||
|
||||
const [hotelName, clientUrl] = await Promise.all([
|
||||
siteSettings.get("hotel_name", "Atom"),
|
||||
resolveHotelName(),
|
||||
siteSettings.get("nitro_client_url", ""),
|
||||
]);
|
||||
|
||||
const ip = (await headers()).get("x-real-client-ip") ?? "0.0.0.0";
|
||||
const ticket = await issueSsoTicket(prisma, userId, hotelName ?? "Atom", ip);
|
||||
const ticket = await issueSsoTicket(prisma, userId, hotelName, ip);
|
||||
|
||||
const onlineCount = await cached("online_count", 10_000, () =>
|
||||
prisma.user.count({ where: { online: "1" } }),
|
||||
@@ -31,7 +32,7 @@ export default async function ClientPage() {
|
||||
<ClientView
|
||||
ticket={ticket}
|
||||
clientUrl={clientUrl || "/nitro-client/"}
|
||||
hotelName={hotelName ?? "Atom"}
|
||||
hotelName={hotelName}
|
||||
initialOnline={onlineCount}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user