mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
fix: try and catch for encoding
This commit is contained in:
1 parent
f4b20611d5
commit
2c8ae40ff8
5 files changed
+17
-19
No files matched your search
@@ -1,5 +1,4 @@
|
||||
import { WargamingResponse } from '../../types/wargamingResponse.js';
|
||||
import isDev from '../process/isDev.js';
|
||||
import URLToBase64 from '../ui/URLToBase64.js';
|
||||
|
||||
/*
|
||||
@@ -58,12 +57,16 @@ export const TANK_IDS = Object.keys(tankopedia).map((id) => Number(id));
|
||||
export const TANKS = TANK_IDS.map((id) => tankopedia[id]);
|
||||
export const TANK_NAMES = TANKS.map((tank) => tank.name);
|
||||
|
||||
if (!isDev()) {
|
||||
console.log('Encoding tank images...');
|
||||
await Promise.all(
|
||||
Object.entries(tankopedia).map(async ([, tank]) => {
|
||||
console.log('Encoding tank images...');
|
||||
await Promise.all(
|
||||
Object.entries(tankopedia).map(async ([, tank]) => {
|
||||
try {
|
||||
tank.images.normal = await URLToBase64(tank.images.normal);
|
||||
}),
|
||||
);
|
||||
console.log('Encoded tank images');
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
`Failed to encode tank image for ${tank.images.normal}: ${error}`,
|
||||
);
|
||||
}
|
||||
}),
|
||||
);
|
||||
console.log('Encoded tank images');
|
||||
Reference in new issue
Block a user