Fix client bundle pulling Redis/Prisma via habbo gamedata hotel.
Local Build and Deploy / deploy (push) Successful in 54s

Keep hotel list helpers client-safe; load CMS setting only from a server module.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-17 22:30:46 +02:00
1 parent d1baaf798a
commit 785c1b6976
6 files changed
+25 -13

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
import { withAdmin } from "@/lib/api-handler"; import { withAdmin } from "@/lib/api-handler";
import { apiOk } from "@/lib/api-response"; import { apiOk } from "@/lib/api-response";
import { getHabboGamedataHotel } from "@/lib/habbo-gamedata-hotel";
import { PERMS } from "@/lib/permissions"; import { PERMS } from "@/lib/permissions";
import { getHabboGamedataHotel } from "@/lib/services/habbo-gamedata-hotel";
import { batchLookupByClassnames } from "@/lib/services/habbofurni"; import { batchLookupByClassnames } from "@/lib/services/habbofurni";
export const GET = withAdmin( export const GET = withAdmin(
+5 -9
View File
@@ -1,3 +1,8 @@
/**
* Client-safe Habbo gamedata hotel helpers (no Node/DB imports).
* Server-only reader: `@/lib/services/habbo-gamedata-hotel`.
*/
/** Official Habbo hotel TLDs used for gamedata (furnidata / external texts). */ /** Official Habbo hotel TLDs used for gamedata (furnidata / external texts). */
export const HABBO_GAMEDATA_HOTELS = [ export const HABBO_GAMEDATA_HOTELS = [
{ value: "it", label: "Italy (habbo.it)" }, { value: "it", label: "Italy (habbo.it)" },
@@ -46,12 +51,3 @@ export function habboExternalTextsUrl(hotel: string): string {
const h = normalizeHabboGamedataHotel(hotel); const h = normalizeHabboGamedataHotel(hotel);
return `https://www.habbo.${h}/gamedata/external_flash_texts/1`; return `https://www.habbo.${h}/gamedata/external_flash_texts/1`;
} }
export async function getHabboGamedataHotel(): Promise<HabboGamedataHotel> {
const { siteSettings } = await import("@/lib/services/site-settings");
const raw = await siteSettings.get(
HABBO_GAMEDATA_HOTEL_SETTING_KEY,
DEFAULT_HABBO_GAMEDATA_HOTEL,
);
return normalizeHabboGamedataHotel(raw);
}
+1 -1
View File
@@ -1,8 +1,8 @@
import { promises as fs } from "node:fs"; import { promises as fs } from "node:fs";
import { Prisma } from "@/generated/prisma/client"; import { Prisma } from "@/generated/prisma/client";
import { getHabboGamedataHotel } from "@/lib/habbo-gamedata-hotel";
import { prisma } from "@/lib/prisma"; import { prisma } from "@/lib/prisma";
import { getFurnitureDataPath } from "@/lib/services/furni-data"; import { getFurnitureDataPath } from "@/lib/services/furni-data";
import { getHabboGamedataHotel } from "@/lib/services/habbo-gamedata-hotel";
// Cache FurnitureData.json in memory with TTL to avoid repeated disk I/O // Cache FurnitureData.json in memory with TTL to avoid repeated disk I/O
let furniDataCache: { let furniDataCache: {
+1 -1
View File
@@ -7,10 +7,10 @@ export type { HabboItFurniEntry } from "@/types/furni";
import type { HabboItFurniEntry } from "@/types/furni"; import type { HabboItFurniEntry } from "@/types/furni";
import { import {
getHabboGamedataHotel,
habboFurnidataUrl, habboFurnidataUrl,
type HabboGamedataHotel, type HabboGamedataHotel,
} from "@/lib/habbo-gamedata-hotel"; } from "@/lib/habbo-gamedata-hotel";
import { getHabboGamedataHotel } from "@/lib/services/habbo-gamedata-hotel";
const CACHE_TTL = 30 * 60 * 1000; // 30 minutes const CACHE_TTL = 30 * 60 * 1000; // 30 minutes
+16
View File
@@ -0,0 +1,16 @@
import {
DEFAULT_HABBO_GAMEDATA_HOTEL,
HABBO_GAMEDATA_HOTEL_SETTING_KEY,
type HabboGamedataHotel,
normalizeHabboGamedataHotel,
} from "@/lib/habbo-gamedata-hotel";
import { siteSettings } from "@/lib/services/site-settings";
/** Read configured Habbo hotel TLD from CMS settings (server-only). */
export async function getHabboGamedataHotel(): Promise<HabboGamedataHotel> {
const raw = await siteSettings.get(
HABBO_GAMEDATA_HOTEL_SETTING_KEY,
DEFAULT_HABBO_GAMEDATA_HOTEL,
);
return normalizeHabboGamedataHotel(raw);
}
+1 -1
View File
@@ -9,10 +9,10 @@ export type { HabboAssetBadge } from "@/types/furni";
import type { HabboAssetBadge } from "@/types/furni"; import type { HabboAssetBadge } from "@/types/furni";
import { import {
getHabboGamedataHotel,
habboExternalTextsUrl, habboExternalTextsUrl,
type HabboGamedataHotel, type HabboGamedataHotel,
} from "@/lib/habbo-gamedata-hotel"; } from "@/lib/habbo-gamedata-hotel";
import { getHabboGamedataHotel } from "@/lib/services/habbo-gamedata-hotel";
const BADGE_IMAGE_BASE = "https://images.habbo.com/c_images/album1584"; const BADGE_IMAGE_BASE = "https://images.habbo.com/c_images/album1584";
const CACHE_TTL = 30 * 60 * 1000; // 30 minutes const CACHE_TTL = 30 * 60 * 1000; // 30 minutes