feat: relocate import tools into studio and harden catalog/furnidata integrity
- Move /admin/import/* tools under /admin/studio/* and add studio nav, layout and tabs - Add shared catalog maintenance panel plus a /admin/studio/maintenance tab - Make furnidata reconciliation overwrite conflicting entries with the DB-authoritative items_base classname/id (surfaced via fixedConflicts) - Add furnidata_translate_enabled setting to skip the heavy localized furnidata build during import (manual build-languages still forces it) - Update staff smoke contract test for the studio hub
This commit is contained in:
1 parent
c2e61dc324
commit
c7ba04bda1
36 files changed
+616
-2835
No files matched your search
@@ -41,6 +41,22 @@ export const FURNIDATA_LANGUAGES = [
|
||||
|
||||
export type FurnidataLang = (typeof FURNIDATA_LANGUAGES)[number]["lang"];
|
||||
|
||||
/**
|
||||
* Master switch for FurnitureData localization. Rebuilding the per-language
|
||||
* files deep-clones the 100k+ entry master 13× and hits LibreTranslate, which
|
||||
* can spike RAM/CPU on every import. Admins can disable it in settings to skip
|
||||
* the work entirely (the master FurnitureData.json is still written by the
|
||||
* import itself). The manual "build languages" action passes `force` to run
|
||||
* regardless.
|
||||
*/
|
||||
async function translationEnabled(): Promise<boolean> {
|
||||
try {
|
||||
return await siteSettings.getBool("furnidata_translate_enabled", true);
|
||||
} catch {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export interface LanguageFileResult {
|
||||
lang: string;
|
||||
hotel: string;
|
||||
@@ -415,9 +431,15 @@ function cloneFurniData(
|
||||
* translation exists for that classname. Runs under the furnidata lock so it
|
||||
* never interleaves with concurrent imports.
|
||||
*/
|
||||
export async function buildLocalizedFurniDataFiles(): Promise<
|
||||
LanguageFileResult[]
|
||||
> {
|
||||
export async function buildLocalizedFurniDataFiles(
|
||||
force = false,
|
||||
): Promise<LanguageFileResult[]> {
|
||||
if (!force && !(await translationEnabled())) {
|
||||
logger.debug(
|
||||
"[furni-i18n] FurnitureData translation disabled by setting; skipping localized build.",
|
||||
);
|
||||
return [];
|
||||
}
|
||||
return withFurniDataLock(async () => {
|
||||
const master = (await readFurniData()) as Record<
|
||||
string,
|
||||
@@ -554,8 +576,15 @@ export async function buildLocalizedFurniDataFiles(): Promise<
|
||||
*/
|
||||
export async function patchLocalizedFurniDataEntries(
|
||||
entries: Array<{ classname: string; name?: string; description?: string }>,
|
||||
force = false,
|
||||
): Promise<LanguageFileResult[]> {
|
||||
if (entries.length === 0) return [];
|
||||
if (!force && !(await translationEnabled())) {
|
||||
logger.debug(
|
||||
"[furni-i18n] FurnitureData translation disabled by setting; skipping localized patch.",
|
||||
);
|
||||
return [];
|
||||
}
|
||||
|
||||
return withFurniDataLock(async () => {
|
||||
const maps = await Promise.all(
|
||||
|
||||
Reference in new issue
Block a user