feat: refine ISAC media and notification workflows
This commit is contained in:
@@ -23,12 +23,15 @@ for (const name of ISAC_DATA_TABLES) {
|
||||
}
|
||||
|
||||
const icons = [];
|
||||
const exportedStorageKeys = new Set();
|
||||
const iconTable = tables.find((table) => table.name === 'game_data_icons');
|
||||
const managedImageTable = tables.find((table) => table.name === 'managed_images');
|
||||
for (const row of [...(iconTable?.rows ?? []), ...(managedImageTable?.rows ?? [])]) {
|
||||
if (typeof row.storage_key !== 'string' || !/^[a-z_]+-[0-9a-f-]{36}\.webp$/i.test(row.storage_key)) {
|
||||
throw new Error(`Invalid managed asset storage key "${String(row.storage_key)}".`);
|
||||
}
|
||||
if (exportedStorageKeys.has(row.storage_key)) continue;
|
||||
exportedStorageKeys.add(row.storage_key);
|
||||
const content = await readFile(join(iconDirectory, row.storage_key));
|
||||
icons.push({ storageKey: row.storage_key, contentBase64: content.toString('base64') });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user