Backfill icons too in the Gamedata bundle sync
Extend the post-import backfill to also copy missing _icon.png files into /var/www/Gamedata/icons (in addition to nitros into bundled/furniture) so all imported furniture shows an icon in-game. Report copied nitros and icons separately in the API/SSE responses.
This commit is contained in:
1 parent
bcd24bfca4
commit
b4021f6b42
4 files changed
+99
-54
No files matched your search
@@ -15,7 +15,7 @@ import {
|
|||||||
downloadFile,
|
downloadFile,
|
||||||
ensureDirectories,
|
ensureDirectories,
|
||||||
ensureFurniOwnership,
|
ensureFurniOwnership,
|
||||||
syncNitrosToGamedataBundle,
|
syncAssetsToGamedataBundle,
|
||||||
} from "@/lib/services/furni-import";
|
} from "@/lib/services/furni-import";
|
||||||
import { getOfficialHabboFurnidata } from "@/lib/services/habbo-furnidata-cache";
|
import { getOfficialHabboFurnidata } from "@/lib/services/habbo-furnidata-cache";
|
||||||
import { rcon } from "@/lib/services/rcon";
|
import { rcon } from "@/lib/services/rcon";
|
||||||
@@ -262,8 +262,8 @@ export const POST = withAdmin(
|
|||||||
// Keep regenerated assets readable by the web server
|
// Keep regenerated assets readable by the web server
|
||||||
const ownership = await ensureFurniOwnership();
|
const ownership = await ensureFurniOwnership();
|
||||||
|
|
||||||
// Backfill any missing nitros into the emulator's Gamedata bundle
|
// Backfill any missing nitros and icons into the emulator's Gamedata bundle
|
||||||
const nitrosSynced = await syncNitrosToGamedataBundle();
|
const assetsSynced = await syncAssetsToGamedataBundle();
|
||||||
|
|
||||||
send({
|
send({
|
||||||
type: "regen_complete",
|
type: "regen_complete",
|
||||||
@@ -272,7 +272,8 @@ export const POST = withAdmin(
|
|||||||
skipped,
|
skipped,
|
||||||
furniDataAdded: furniDataEntries.length,
|
furniDataAdded: furniDataEntries.length,
|
||||||
ownershipFixed: ownership.fixed,
|
ownershipFixed: ownership.fixed,
|
||||||
nitrosSynced: nitrosSynced.copied,
|
nitrosSynced: assetsSynced.copiedNitros,
|
||||||
|
iconsSynced: assetsSynced.copiedIcons,
|
||||||
duration: Date.now() - startTime,
|
duration: Date.now() - startTime,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
ensureFurniOwnership,
|
ensureFurniOwnership,
|
||||||
importSingleFurni,
|
importSingleFurni,
|
||||||
reconcileImportedOfferIds,
|
reconcileImportedOfferIds,
|
||||||
syncNitrosToGamedataBundle,
|
syncAssetsToGamedataBundle,
|
||||||
} from "@/lib/services/furni-import";
|
} from "@/lib/services/furni-import";
|
||||||
import { rcon } from "@/lib/services/rcon";
|
import { rcon } from "@/lib/services/rcon";
|
||||||
import type { ImportSingleResult } from "@/types/furni";
|
import type { ImportSingleResult } from "@/types/furni";
|
||||||
@@ -218,10 +218,13 @@ export const POST = withAdmin(
|
|||||||
let offerIdsFixed = 0;
|
let offerIdsFixed = 0;
|
||||||
let ownershipFixed: string[] = [];
|
let ownershipFixed: string[] = [];
|
||||||
let nitrosSynced: string[] = [];
|
let nitrosSynced: string[] = [];
|
||||||
|
let iconsSynced: string[] = [];
|
||||||
try {
|
try {
|
||||||
offerIdsFixed = (await reconcileImportedOfferIds()).fixed;
|
offerIdsFixed = (await reconcileImportedOfferIds()).fixed;
|
||||||
ownershipFixed = (await ensureFurniOwnership()).fixed;
|
ownershipFixed = (await ensureFurniOwnership()).fixed;
|
||||||
nitrosSynced = (await syncNitrosToGamedataBundle()).copied;
|
const assetsSynced = await syncAssetsToGamedataBundle();
|
||||||
|
nitrosSynced = assetsSynced.copiedNitros;
|
||||||
|
iconsSynced = assetsSynced.copiedIcons;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn(
|
console.warn(
|
||||||
"[import-furni] Post-import reconcile/ownership failed:",
|
"[import-furni] Post-import reconcile/ownership failed:",
|
||||||
@@ -237,6 +240,7 @@ export const POST = withAdmin(
|
|||||||
offerIdsFixed,
|
offerIdsFixed,
|
||||||
ownershipFixed,
|
ownershipFixed,
|
||||||
nitrosSynced,
|
nitrosSynced,
|
||||||
|
iconsSynced,
|
||||||
duration: Date.now() - startTime,
|
duration: Date.now() - startTime,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import {
|
|||||||
importSingleFurni,
|
importSingleFurni,
|
||||||
reconcileImportedOfferIds,
|
reconcileImportedOfferIds,
|
||||||
resetCatalogPageCache,
|
resetCatalogPageCache,
|
||||||
syncNitrosToGamedataBundle,
|
syncAssetsToGamedataBundle,
|
||||||
} from "@/lib/services/furni-import";
|
} from "@/lib/services/furni-import";
|
||||||
import { getOfficialHabboFurnidata } from "@/lib/services/habbo-furnidata-cache";
|
import { getOfficialHabboFurnidata } from "@/lib/services/habbo-furnidata-cache";
|
||||||
import { listFurniture } from "@/lib/services/habbofurni";
|
import { listFurniture } from "@/lib/services/habbofurni";
|
||||||
@@ -413,7 +413,7 @@ export const POST = withAdmin(
|
|||||||
const ownership = await ensureFurniOwnership();
|
const ownership = await ensureFurniOwnership();
|
||||||
|
|
||||||
// Backfill any missing nitros into the emulator's Gamedata bundle
|
// Backfill any missing nitros into the emulator's Gamedata bundle
|
||||||
const nitrosSynced = await syncNitrosToGamedataBundle();
|
const assetsSynced = await syncAssetsToGamedataBundle();
|
||||||
|
|
||||||
const succeeded = results.filter((r) => r.ok).length;
|
const succeeded = results.filter((r) => r.ok).length;
|
||||||
const failed = results.filter((r) => !r.ok).length;
|
const failed = results.filter((r) => !r.ok).length;
|
||||||
@@ -425,7 +425,8 @@ export const POST = withAdmin(
|
|||||||
results,
|
results,
|
||||||
offerIdsFixed: reconciled.fixed,
|
offerIdsFixed: reconciled.fixed,
|
||||||
ownershipFixed: ownership.fixed,
|
ownershipFixed: ownership.fixed,
|
||||||
nitrosSynced: nitrosSynced.copied,
|
nitrosSynced: assetsSynced.copiedNitros,
|
||||||
|
iconsSynced: assetsSynced.copiedIcons,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,8 +482,8 @@ export const POST = withAdmin(
|
|||||||
// Keep asset + furnidata folders readable by the web server
|
// Keep asset + furnidata folders readable by the web server
|
||||||
const ownership = await ensureFurniOwnership();
|
const ownership = await ensureFurniOwnership();
|
||||||
|
|
||||||
// Backfill any missing nitros into the emulator's Gamedata bundle
|
// Backfill any missing nitros and icons into the emulator's Gamedata bundle
|
||||||
const nitrosSynced = await syncNitrosToGamedataBundle();
|
const assetsSynced = await syncAssetsToGamedataBundle();
|
||||||
|
|
||||||
logAudit({
|
logAudit({
|
||||||
userId: ctx.session.user.id,
|
userId: ctx.session.user.id,
|
||||||
@@ -506,7 +507,8 @@ export const POST = withAdmin(
|
|||||||
catalogItemId: result.catalogItemId,
|
catalogItemId: result.catalogItemId,
|
||||||
offerIdsFixed: reconciled.fixed,
|
offerIdsFixed: reconciled.fixed,
|
||||||
ownershipFixed: ownership.fixed,
|
ownershipFixed: ownership.fixed,
|
||||||
nitrosSynced: nitrosSynced.copied,
|
nitrosSynced: assetsSynced.copiedNitros,
|
||||||
|
iconsSynced: assetsSynced.copiedIcons,
|
||||||
spriteCount: result.spriteCount,
|
spriteCount: result.spriteCount,
|
||||||
warnings: result.warnings,
|
warnings: result.warnings,
|
||||||
});
|
});
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user