fix: use JSON FurnitureData from gamedata
This commit is contained in:
1 parent
c78f8812ad
commit
ab43f5d63c
2 files changed
+23
-8
No files matched your search
@@ -9,20 +9,25 @@ import { siteSettings } from "@/lib/services/site-settings";
|
||||
import type { FurniMetadata } from "@/lib/services/swf-to-nitro";
|
||||
|
||||
const LOCK_STALE_MS = 60_000;
|
||||
const DEFAULT_FURNI_DATA_URL = "/gamedata/config/FurnitureData.json";
|
||||
|
||||
/**
|
||||
* Resolve the FurnitureData file path from the admin setting
|
||||
* `furni_data_url` (e.g. `/nitro-assets/config/FurnitureData.json5`) mapped
|
||||
* under the public/ directory. Falls back to the json5 path if the setting
|
||||
* is unset.
|
||||
* `furni_data_url`. The production `/gamedata` mount maps to the configured
|
||||
* Gamedata filesystem root; other relative URLs map under public/.
|
||||
*/
|
||||
export async function getFurnitureDataPath(): Promise<string> {
|
||||
const url =
|
||||
(await siteSettings.get(
|
||||
"furni_data_url",
|
||||
"/nitro-assets/config/FurnitureData.json5",
|
||||
)) ?? "/nitro-assets/config/FurnitureData.json5";
|
||||
(await siteSettings.get("furni_data_url", DEFAULT_FURNI_DATA_URL)) ??
|
||||
DEFAULT_FURNI_DATA_URL;
|
||||
if (path.isAbsolute(url) && !url.startsWith("/")) return url;
|
||||
if (url === "/gamedata" || url.startsWith("/gamedata/")) {
|
||||
const gamedataRoot = await getGamedataRoot();
|
||||
if (gamedataRoot) {
|
||||
const relative = url.replace(/^\/gamedata\/?/, "");
|
||||
return path.join(/*turbopackIgnore: true*/ gamedataRoot, relative);
|
||||
}
|
||||
}
|
||||
const relative = url.replace(/^\/+/, "");
|
||||
// The `relative` segment is admin-configurable so its concrete value is
|
||||
// unknown at build time; without the hint Turbopack traces the entire
|
||||
|
||||
Reference in new issue
Block a user