mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
fix: change blitzkit icons to big icons
This commit is contained in:
1 parent
b8c8528e1c
commit
d60551d30a
2 files changed
+18
-18
No files matched your search
@@ -1,11 +1,11 @@
|
||||
import { BLITZKIT_TANK_ICON_SIZE, fetchTankDefinitions } from '@blitzkit/core';
|
||||
import { launch } from 'puppeteer';
|
||||
import sharp from 'sharp';
|
||||
import { commitAssets } from '../core/github/commitAssets';
|
||||
import { FileChange } from '../core/github/commitMultipleFiles';
|
||||
import { BLITZKIT_TANK_ICON_SIZE, fetchTankDefinitions } from "@blitzkit/core";
|
||||
import { launch } from "puppeteer";
|
||||
import sharp from "sharp";
|
||||
import { commitAssets } from "../core/github/commitAssets";
|
||||
import { FileChange } from "../core/github/commitMultipleFiles";
|
||||
|
||||
export async function blitzkitTankIcons() {
|
||||
console.log('Building blitzkit tank icons...');
|
||||
console.log("Building blitzkit tank icons...");
|
||||
|
||||
const browser = await launch();
|
||||
const page = await browser.newPage();
|
||||
@@ -21,7 +21,7 @@ export async function blitzkitTankIcons() {
|
||||
|
||||
try {
|
||||
await page.goto(`http://localhost:4321/api/tankopedia/tank-icon/${id}/`, {
|
||||
waitUntil: 'networkidle0',
|
||||
waitUntil: "networkidle0",
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`${id} ${name} time out`, error);
|
||||
@@ -29,21 +29,21 @@ export async function blitzkitTankIcons() {
|
||||
}
|
||||
|
||||
const screenshot = await page.screenshot({
|
||||
type: 'webp',
|
||||
type: "webp",
|
||||
omitBackground: true,
|
||||
});
|
||||
const content = await sharp(screenshot).trim({ threshold: 100 }).toBuffer();
|
||||
|
||||
index++;
|
||||
console.log(
|
||||
`Rendered ${id} (${name}) ${((index / tanks.length) * 100).toFixed(2)}%`,
|
||||
`Rendered ${id} (${name}) ${((index / tanks.length) * 100).toFixed(2)}%`
|
||||
);
|
||||
|
||||
files.push({ path: `icons/tanks/blitzkit/${id}.webp`, content });
|
||||
files.push({ path: `icons/tanks/big/${id}.webp`, content });
|
||||
}
|
||||
|
||||
await page.close();
|
||||
await browser.close();
|
||||
|
||||
await commitAssets('tank icons', files);
|
||||
await commitAssets("tank icons", files);
|
||||
}
|
||||
Reference in new issue
Block a user