fix: identify badge items by .gif presence in album1584 directory
CI / check (push) Successful in 30s
CI / release (push) Skipped
CI / deploy (push) Successful in 58s

Badge items like HC_Badge, BADGE_SHREK_03 have item_names that don't start
with 'badge_' and interaction_type='default'. Now loads known badge codes
from <gamedataRoot>/album1584/*.gif files and uses that set to exclude
badge items from .nitro and icon audit checks. Also removes incorrect
startsWith('badge_') check that would wrongly skip badge display cases
which DO have .nitro files.
This commit is contained in:
openhands committed 2026-08-03 22:05:49 +02:00
1 parent 750973de38
commit b1a1e5125c
3 files changed
+67 -9

No files matched your search

+19 -1
View File
@@ -11,6 +11,7 @@ import {
import {
type FurniAssetWriteTargets,
getFurniAssetWriteTargets,
getGamedataRoot,
} from "@/lib/services/furni-asset-dirs";
import { downloadFile } from "@/lib/services/import/core/download";
import { parseNitroBundle } from "@/lib/services/swf/nitro-builder";
@@ -136,6 +137,23 @@ export async function repairMissingNitros(
...targets.mirrorDirs.map((d) => d.nitroDir),
]);
// Load known badge codes from the album directory so we can skip badge
// items — they use .gif files, not .nitro bundles.
let badgeSet: Set<string> | null = null;
try {
const gamedataRoot = await getGamedataRoot();
if (gamedataRoot) {
const badgeFiles = await fs
.readdir(path.join(gamedataRoot, "album1584"))
.catch(() => [] as string[]);
badgeSet = new Set(
badgeFiles.filter((f) => f.endsWith(".gif")).map((f) => f.slice(0, -4)),
);
}
} catch {
badgeSet = null;
}
let items: Array<{ id: number; item_name: string }>;
try {
const [rows] = (await db.execute(sql`
@@ -155,7 +173,7 @@ export async function repairMissingNitros(
const processItem = async (classname: string) => {
// Badge items use .gif files, not .nitro bundles.
if (classname.startsWith("badge_")) {
if (badgeSet?.has(classname) ?? false) {
return { status: "skipped" } as const;
}
const fileName = `${classname}.nitro`;