mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e513998a9 | ||
|
|
df34226a22 | ||
|
|
2f7f2362bb | ||
|
|
a78543c60f | ||
|
|
00783749ba | ||
|
|
9aba91a773 | ||
|
|
dd3c86aa5b | ||
|
|
f770ba0e5e | ||
|
|
c444210294 | ||
|
|
84dcfe4a14 | ||
|
|
7a3541439b | ||
|
|
7ab8a01fb6 | ||
|
|
88729e0eca | ||
|
|
63a6e47878 | ||
|
|
984dad4111 | ||
|
|
2540b71fb7 | ||
|
|
80fca2e53a | ||
|
|
4d0ca1cd1a | ||
|
|
50aeb01e0a | ||
|
|
a1a218c325 | ||
|
|
e560754bb6 | ||
|
|
dbc23c6473 | ||
|
|
a2bd62da92 | ||
|
|
c0d16b51de | ||
|
|
d68870c254 | ||
|
|
d91b46d730 | ||
|
|
0758f0d8aa | ||
|
|
eacd63d472 | ||
|
|
39240e908d | ||
|
|
2f734c237b |
No files matched your search
@@ -13,14 +13,22 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
||||||
|
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
|
||||||
|
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||||
|
PUBLIC_ASSET_REPO: ${{ secrets.PUBLIC_ASSET_REPO }}
|
||||||
|
PUBLIC_ASSET_BRANCH: ${{ secrets.PUBLIC_ASSET_BRANCH }}
|
||||||
|
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
host:
|
host:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: oven-sh/setup-bun@v1
|
- uses: oven-sh/setup-bun@v1
|
||||||
with:
|
# with:
|
||||||
bun-version: 1.1.33
|
# bun-version: 1.1.33
|
||||||
|
|
||||||
- name: Download release assets
|
- name: Download release assets
|
||||||
run: |
|
run: |
|
||||||
@@ -32,12 +40,11 @@ jobs:
|
|||||||
mkdir -p dist/bot
|
mkdir -p dist/bot
|
||||||
unzip bot.zip -d dist/bot
|
unzip bot.zip -d dist/bot
|
||||||
|
|
||||||
|
- name: Install sharp
|
||||||
|
run: bun init -y && bun add sharp
|
||||||
|
|
||||||
|
- name: Move directories
|
||||||
|
run: mv dist/bot/prisma .
|
||||||
|
|
||||||
- name: Run bot
|
- name: Run bot
|
||||||
env:
|
run: bun run dist/bot/main.js
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
||||||
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
|
||||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
|
||||||
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
|
|
||||||
run: |
|
|
||||||
mv dist/bot/prisma .
|
|
||||||
bun dist/bot/main.js
|
|
||||||
@@ -19,8 +19,10 @@ jobs:
|
|||||||
- name: Generate leaderboard
|
- name: Generate leaderboard
|
||||||
env:
|
env:
|
||||||
PUBLIC_ASSET_BRANCH: main
|
PUBLIC_ASSET_BRANCH: main
|
||||||
|
PUBLIC_ASSET_REPO: ${{ secrets.PUBLIC_ASSET_REPO }}
|
||||||
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
|
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
||||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||||
|
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
||||||
run: bun build:ratingleaderboard --region=asia
|
run: bun build:ratingleaderboard --region=asia
|
||||||
@@ -19,8 +19,10 @@ jobs:
|
|||||||
- name: Generate leaderboard
|
- name: Generate leaderboard
|
||||||
env:
|
env:
|
||||||
PUBLIC_ASSET_BRANCH: main
|
PUBLIC_ASSET_BRANCH: main
|
||||||
|
PUBLIC_ASSET_REPO: ${{ secrets.PUBLIC_ASSET_REPO }}
|
||||||
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
|
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
||||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||||
|
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
||||||
run: bun build:ratingleaderboard --region=eu
|
run: bun build:ratingleaderboard --region=eu
|
||||||
@@ -19,8 +19,10 @@ jobs:
|
|||||||
- name: Generate leaderboard
|
- name: Generate leaderboard
|
||||||
env:
|
env:
|
||||||
PUBLIC_ASSET_BRANCH: main
|
PUBLIC_ASSET_BRANCH: main
|
||||||
|
PUBLIC_ASSET_REPO: ${{ secrets.PUBLIC_ASSET_REPO }}
|
||||||
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
|
DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }}
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
||||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||||
|
PUBLIC_WARGAMING_APPLICATION_ID: ${{ secrets.PUBLIC_WARGAMING_APPLICATION_ID }}
|
||||||
run: bun build:ratingleaderboard --region=com
|
run: bun build:ratingleaderboard --region=com
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# BlitzKit 1.26.1
|
||||||
|
|
||||||
|
The auctions are here!
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Added the `/auction` command
|
||||||
|
- No need to login or go to the official website, just use `/auction`
|
||||||
|
- Everything built into Discord, one step at a time!
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "blitzkit",
|
"name": "blitzkit",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.26.0",
|
"version": "1.26.1",
|
||||||
"description": "🎉 Tools for everything World of Tanks Blitz",
|
"description": "🎉 Tools for everything World of Tanks Blitz",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./types.d.ts",
|
"types": "./types.d.ts",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"@blitzkit/core": "workspace:*",
|
"@blitzkit/core": "workspace:*",
|
||||||
"satori": "^0.10.14",
|
"satori": "^0.10.14",
|
||||||
"@resvg/resvg-js": "^2.6.2",
|
"@resvg/resvg-js": "^2.6.2",
|
||||||
"discord.js": "^14.15.3",
|
"discord.js": "^14.16.3",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"@radix-ui/colors": "^3.0.0",
|
"@radix-ui/colors": "^3.0.0",
|
||||||
"fuzzysort": "^2.0.4",
|
"fuzzysort": "^2.0.4",
|
||||||
|
|||||||
@@ -0,0 +1,128 @@
|
|||||||
|
import {
|
||||||
|
BlitzTankClass,
|
||||||
|
Region,
|
||||||
|
regionToRegionSubdomain,
|
||||||
|
} from '@blitzkit/core';
|
||||||
|
import { tankDefinitions } from '../core/blitzkit/nonBlockingPromises';
|
||||||
|
import { createLocalizedCommand } from '../core/discord/createLocalizedCommand';
|
||||||
|
import { translator } from '../core/localization/translator';
|
||||||
|
import { CommandRegistry } from '../events/interactionCreate';
|
||||||
|
|
||||||
|
interface Auction {
|
||||||
|
count: number;
|
||||||
|
has_next: boolean;
|
||||||
|
results: Result[];
|
||||||
|
}
|
||||||
|
|
||||||
|
type Result =
|
||||||
|
| {
|
||||||
|
id?: number;
|
||||||
|
type: 'vehicle';
|
||||||
|
countable?: boolean;
|
||||||
|
entity?: Entity;
|
||||||
|
initial_count?: number;
|
||||||
|
current_count?: number;
|
||||||
|
saleable?: boolean;
|
||||||
|
available_from?: Date;
|
||||||
|
available_before?: Date;
|
||||||
|
price?: Price;
|
||||||
|
next_price?: Price | null;
|
||||||
|
available: true;
|
||||||
|
display?: boolean;
|
||||||
|
next_price_datetime: Date;
|
||||||
|
next_price_timestamp: number;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
available: false;
|
||||||
|
type: 'vehicle';
|
||||||
|
};
|
||||||
|
|
||||||
|
interface Entity {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
nation: string;
|
||||||
|
subnation: string;
|
||||||
|
use_subnation_flag: boolean;
|
||||||
|
type_slug: BlitzTankClass;
|
||||||
|
level: number;
|
||||||
|
roman_level: string;
|
||||||
|
user_string: string;
|
||||||
|
image_url: string;
|
||||||
|
preview_image_url: string;
|
||||||
|
is_premium: boolean;
|
||||||
|
is_collectible: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Price {
|
||||||
|
currency: Currency;
|
||||||
|
value: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Currency {
|
||||||
|
name: 'gold';
|
||||||
|
count: number;
|
||||||
|
title: 'Gold';
|
||||||
|
image_url: string;
|
||||||
|
sizes: unknown;
|
||||||
|
type: 'currency';
|
||||||
|
}
|
||||||
|
|
||||||
|
export const auctionCommand = new Promise<CommandRegistry>((resolve) => {
|
||||||
|
resolve({
|
||||||
|
command: createLocalizedCommand('auction'),
|
||||||
|
|
||||||
|
async handler(interaction) {
|
||||||
|
const { t, translate } = translator(interaction.locale);
|
||||||
|
const awaitedTankDefinitions = await tankDefinitions;
|
||||||
|
const region: Region = 'com';
|
||||||
|
const pageSize = 80;
|
||||||
|
const saleable = true;
|
||||||
|
const data = await fetch(
|
||||||
|
`https://${regionToRegionSubdomain(
|
||||||
|
region,
|
||||||
|
)}.wotblitz.com/en/api/events/items/auction/?page_size=${
|
||||||
|
pageSize
|
||||||
|
}&type[]=vehicle&saleable=${saleable}`,
|
||||||
|
).then((response) => response.json() as Promise<Auction>);
|
||||||
|
const saleableTanks = data.results.filter((result) => result.available);
|
||||||
|
|
||||||
|
if (saleableTanks.length === 0) {
|
||||||
|
return t`bot.commands.auction.errors.no_auction`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextPricesTimestamp = saleableTanks[0].next_price_timestamp;
|
||||||
|
|
||||||
|
const title = `# ${t`bot.commands.auction.body.title`}`;
|
||||||
|
const subtitle = `${translate('bot.commands.auction.body.subtitle', [
|
||||||
|
`${saleableTanks.length} / ${data.results.length}`,
|
||||||
|
`<t:${nextPricesTimestamp}:R>`,
|
||||||
|
'<https://wotblitz.com/auction/>',
|
||||||
|
])}`;
|
||||||
|
const body = saleableTanks
|
||||||
|
.map((data, index) => {
|
||||||
|
const tank = awaitedTankDefinitions.tanks[data.entity!.id];
|
||||||
|
|
||||||
|
if (!tank) return '';
|
||||||
|
|
||||||
|
const name = `[${tank.name}](<https://blitzkit.app/tools/tankopedia/${
|
||||||
|
tank.id
|
||||||
|
}>)`;
|
||||||
|
const next = translate('bot.commands.auction.body.next', [
|
||||||
|
`<:gold:1317173197082333244> ${data.next_price!.value.toLocaleString(
|
||||||
|
interaction.locale,
|
||||||
|
)}`,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return `${
|
||||||
|
index + 1
|
||||||
|
}. ${name} <:gold:1317173197082333244> ${data.price!.value.toLocaleString(
|
||||||
|
interaction.locale,
|
||||||
|
)}\n-# ${next}`;
|
||||||
|
})
|
||||||
|
.join('\n\n');
|
||||||
|
const content = `${title}\n${subtitle}\n\n${body}`;
|
||||||
|
|
||||||
|
return content;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import packageJSON from '../../../../package.json' assert { type: 'json' };
|
import packageJSON from '../../../../package.json';
|
||||||
import { client } from '../core/discord/client';
|
import { client } from '../core/discord/client';
|
||||||
import { createLocalizedCommand } from '../core/discord/createLocalizedCommand';
|
import { createLocalizedCommand } from '../core/discord/createLocalizedCommand';
|
||||||
import { translator } from '../core/localization/translator';
|
import { translator } from '../core/localization/translator';
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ import { assertSecret } from '@blitzkit/core';
|
|||||||
import { ShardingManager } from 'discord.js';
|
import { ShardingManager } from 'discord.js';
|
||||||
|
|
||||||
export const manager = new ShardingManager('dist/bot/workers/bot.js', {
|
export const manager = new ShardingManager('dist/bot/workers/bot.js', {
|
||||||
token: assertSecret(process.env.DISCORD_TOKEN),
|
token: assertSecret(import.meta.env.DISCORD_TOKEN),
|
||||||
});
|
});
|
||||||
@@ -13,7 +13,7 @@ export const translations = SUPPORTED_LOCALES.reduce<
|
|||||||
>(
|
>(
|
||||||
(table, locale) => ({
|
(table, locale) => ({
|
||||||
...table,
|
...table,
|
||||||
[locale]: require(`@blitzkit/core/lang/${locale}.json`),
|
[locale]: require(`../../../../../core/lang/${locale}.json`),
|
||||||
}),
|
}),
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
SlashCommandSubcommandsOnlyBuilder,
|
SlashCommandSubcommandsOnlyBuilder,
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { aboutCommand } from '../../commands/about';
|
import { aboutCommand } from '../../commands/about';
|
||||||
|
import { auctionCommand } from '../../commands/auction';
|
||||||
import { breakdownCommand } from '../../commands/breakdown';
|
import { breakdownCommand } from '../../commands/breakdown';
|
||||||
import { debugCommand } from '../../commands/debug';
|
import { debugCommand } from '../../commands/debug';
|
||||||
import { evolutionCommand } from '../../commands/evolution';
|
import { evolutionCommand } from '../../commands/evolution';
|
||||||
@@ -76,6 +77,7 @@ interface CommandRegistryExplicit extends CommandRegistryBase {
|
|||||||
export type CommandRegistry = CommandRegistryImplicit | CommandRegistryExplicit;
|
export type CommandRegistry = CommandRegistryImplicit | CommandRegistryExplicit;
|
||||||
|
|
||||||
export const COMMANDS_RAW: Promise<CommandRegistry>[] = [
|
export const COMMANDS_RAW: Promise<CommandRegistry>[] = [
|
||||||
|
auctionCommand,
|
||||||
permissionsCommand,
|
permissionsCommand,
|
||||||
debugCommand,
|
debugCommand,
|
||||||
aboutCommand,
|
aboutCommand,
|
||||||
@@ -115,7 +117,7 @@ export const commands = Promise.allSettled(COMMANDS_RAW).then((rawCommands) => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
const rest = new REST().setToken(assertSecret(process.env.DISCORD_TOKEN));
|
const rest = new REST().setToken(assertSecret(import.meta.env.DISCORD_TOKEN));
|
||||||
|
|
||||||
commands.then((awaitedCommands) => {
|
commands.then((awaitedCommands) => {
|
||||||
const body = Object.values(awaitedCommands).map((registry) =>
|
const body = Object.values(awaitedCommands).map((registry) =>
|
||||||
@@ -123,7 +125,7 @@ commands.then((awaitedCommands) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
rest.put(
|
rest.put(
|
||||||
Routes.applicationCommands(assertSecret(process.env.DISCORD_CLIENT_ID)),
|
Routes.applicationCommands(assertSecret(import.meta.env.DISCORD_CLIENT_ID)),
|
||||||
{
|
{
|
||||||
body,
|
body,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
import { manager } from './core/discord/manager';
|
import { manager } from './core/discord/manager';
|
||||||
|
|
||||||
|
console.log('pre manager event listeners and spawn');
|
||||||
|
|
||||||
manager
|
manager
|
||||||
.on('shardCreate', (shard) => {
|
.on('shardCreate', (shard) => {
|
||||||
console.log(`🟡 Launching shard ${shard.id}`);
|
console.log(`🟡 Launching shard ${shard.id}`);
|
||||||
shard.on('ready', () => console.log(`🟢 Launched shard ${shard.id}`));
|
shard.on('ready', () => console.log(`🟢 Launched shard ${shard.id}`));
|
||||||
})
|
})
|
||||||
.spawn();
|
.spawn();
|
||||||
|
|
||||||
|
console.log('post manager event listeners and spawn');
|
||||||
@@ -6,4 +6,8 @@ console.log(`🟡 Launching bot ${client.shard?.ids[0]}`);
|
|||||||
|
|
||||||
registerProcesses();
|
registerProcesses();
|
||||||
|
|
||||||
client.login(assertSecret(process.env.DISCORD_TOKEN));
|
console.log(`post register processes on shard ${client.shard?.ids[0]}`);
|
||||||
|
|
||||||
|
client.login(assertSecret(import.meta.env.DISCORD_TOKEN));
|
||||||
|
|
||||||
|
console.log(`post client login on shard ${client.shard?.ids[0]}`);
|
||||||
@@ -7,3 +7,5 @@ parentPort?.on('message', async (svg: string) => {
|
|||||||
const png = svgToPng(svg);
|
const png = svgToPng(svg);
|
||||||
parentPort?.postMessage(png);
|
parentPort?.postMessage(png);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(`post render thread parent port on thread ${threadId}`);
|
||||||
@@ -291,6 +291,23 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"commands": {
|
"commands": {
|
||||||
|
"auction": {
|
||||||
|
"$": "auction",
|
||||||
|
"description": "Tanks available right now in the auction",
|
||||||
|
|
||||||
|
"body": {
|
||||||
|
"title": "Blitz Auction",
|
||||||
|
"subtitle": "%s available • next prices %s\nBid now: %s",
|
||||||
|
"next": "Next price: %s"
|
||||||
|
},
|
||||||
|
"errors": {
|
||||||
|
"no_auction": "# No ongoing auction\n\nCurrently, there are no tanks available for purchase in the auction. If you think this is an error, please report this discrepancy in [the official Discord Server](https://discord.gg/nDt7AjGJQH)."
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"bid": "Bid now"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"replay": {
|
"replay": {
|
||||||
"$": "replay",
|
"$": "replay",
|
||||||
"description": "Display replay results"
|
"description": "Display replay results"
|
||||||
|
|||||||
@@ -323,9 +323,9 @@
|
|||||||
"$": "zonas-horarias",
|
"$": "zonas-horarias",
|
||||||
"description": "Cómo Blitzkrieg infiere y utiliza tu zona horaria"
|
"description": "Cómo Blitzkrieg infiere y utiliza tu zona horaria"
|
||||||
},
|
},
|
||||||
"creators": {
|
"credits": {
|
||||||
"$": "creadores",
|
"$": "credits",
|
||||||
"description": "Personas que han trabajado en el bot"
|
"description": "People who have helped BlitzKit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -323,9 +323,9 @@
|
|||||||
"$": "vremenske zone",
|
"$": "vremenske zone",
|
||||||
"description": "Kako \"Blitzkrieg\" koristi podatke o tvojoj vremenskoj zoni"
|
"description": "Kako \"Blitzkrieg\" koristi podatke o tvojoj vremenskoj zoni"
|
||||||
},
|
},
|
||||||
"creators": {
|
"credits": {
|
||||||
"$": "stvarači",
|
"$": "credits",
|
||||||
"description": "Ljudi koji su radili na robotu"
|
"description": "People who have helped BlitzKit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export type BlitzTankClass =
|
||||||
|
| 'lightTank'
|
||||||
|
| 'mediumTank'
|
||||||
|
| 'heavyTank'
|
||||||
|
| 'AT-SPG';
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
export * from './canSplash';
|
export * from './canSplash';
|
||||||
export * from './clans';
|
export * from './clans';
|
||||||
|
export * from './classes';
|
||||||
export * from './constants';
|
export * from './constants';
|
||||||
export * from './equipmentPrice';
|
export * from './equipmentPrice';
|
||||||
export * from './fetchBlitz';
|
export * from './fetchBlitz';
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export async function isValidBlitzId(id: number, token?: string) {
|
|||||||
|
|
||||||
const json = await fetch(
|
const json = await fetch(
|
||||||
`https://api.wotblitz.${region}/wotb/account/info/?account_id=${id}&application_id=${assertSecret(
|
`https://api.wotblitz.${region}/wotb/account/info/?account_id=${id}&application_id=${assertSecret(
|
||||||
process.env.PUBLIC_WARGAMING_APPLICATION_ID,
|
import.meta.env.PUBLIC_WARGAMING_APPLICATION_ID,
|
||||||
)}${
|
)}${
|
||||||
token === undefined ? '' : `&access_token=${token}`
|
token === undefined ? '' : `&access_token=${token}`
|
||||||
}&fields=account_id%2C-account_id`,
|
}&fields=account_id%2C-account_id`,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export async function getArchivedLatestSeasonNumber() {
|
|||||||
const regionsURL = (
|
const regionsURL = (
|
||||||
(await fetch(
|
(await fetch(
|
||||||
`https://api.github.com/repos/tresabhi/${assertSecret(
|
`https://api.github.com/repos/tresabhi/${assertSecret(
|
||||||
process.env.PUBLIC_ASSET_REPO,
|
import.meta.env.PUBLIC_ASSET_REPO,
|
||||||
)}/git/trees/main`,
|
)}/git/trees/main`,
|
||||||
).then((response) => response.json())) as GitHubTrees
|
).then((response) => response.json())) as GitHubTrees
|
||||||
).tree.find(({ path }) => path === 'regions')!.url;
|
).tree.find(({ path }) => path === 'regions')!.url;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { assertSecret } from '@blitzkit/core';
|
||||||
import { mkdir, writeFile } from 'fs/promises';
|
import { mkdir, writeFile } from 'fs/promises';
|
||||||
import { parse as parsePath } from 'path';
|
import { parse as parsePath } from 'path';
|
||||||
import ProgressBar from 'progress';
|
import ProgressBar from 'progress';
|
||||||
@@ -6,7 +7,6 @@ import { dvp } from '../../../submodules/blitzkit-closed/src/dvp';
|
|||||||
import { readStringDVPL } from '../src/core/blitz/readStringDVPL';
|
import { readStringDVPL } from '../src/core/blitz/readStringDVPL';
|
||||||
import { DATA } from './buildAssets/constants';
|
import { DATA } from './buildAssets/constants';
|
||||||
import { readYAMLDVPL } from './core/blitz/readYAMLDVPL';
|
import { readYAMLDVPL } from './core/blitz/readYAMLDVPL';
|
||||||
import { assertSecret } from '@blitzkit/core';
|
|
||||||
import { writeDVPL } from './core/blitz/writeDVPL';
|
import { writeDVPL } from './core/blitz/writeDVPL';
|
||||||
|
|
||||||
const versionTextFile = await readStringDVPL(`${DATA}/version.txt.dvpl`);
|
const versionTextFile = await readStringDVPL(`${DATA}/version.txt.dvpl`);
|
||||||
@@ -22,7 +22,7 @@ let patchIndex = 1;
|
|||||||
while (true) {
|
while (true) {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${assertSecret(
|
`${assertSecret(
|
||||||
process.env.WOTB_DLC_CDN,
|
import.meta.env.WOTB_DLC_CDN,
|
||||||
)}/dlc/s${currentVersion}_${patchIndex}.yaml`,
|
)}/dlc/s${currentVersion}_${patchIndex}.yaml`,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -31,10 +31,10 @@ while (true) {
|
|||||||
|
|
||||||
const data = parseYaml(await response.text());
|
const data = parseYaml(await response.text());
|
||||||
const dvpm = await fetch(
|
const dvpm = await fetch(
|
||||||
`${assertSecret(process.env.WOTB_DLC_CDN)}/dlc/${data.dx11}`,
|
`${assertSecret(import.meta.env.WOTB_DLC_CDN)}/dlc/${data.dx11}`,
|
||||||
).then((response) => response.arrayBuffer());
|
).then((response) => response.arrayBuffer());
|
||||||
const dvpd = await fetch(
|
const dvpd = await fetch(
|
||||||
`${assertSecret(process.env.WOTB_DLC_CDN)}/dlc/${data.dx11.replace(
|
`${assertSecret(import.meta.env.WOTB_DLC_CDN)}/dlc/${data.dx11.replace(
|
||||||
'.dvpm',
|
'.dvpm',
|
||||||
'.dvpd',
|
'.dvpd',
|
||||||
)}`,
|
)}`,
|
||||||
@@ -63,7 +63,7 @@ while (true) {
|
|||||||
console.log('Found dynamic content localizations; patching...');
|
console.log('Found dynamic content localizations; patching...');
|
||||||
|
|
||||||
const localizationsResponse = await fetch(
|
const localizationsResponse = await fetch(
|
||||||
`${assertSecret(process.env.WOTB_DLC_CDN)}/dlc/${
|
`${assertSecret(import.meta.env.WOTB_DLC_CDN)}/dlc/${
|
||||||
data.dynamicContentLocalizationsDir
|
data.dynamicContentLocalizationsDir
|
||||||
}/en.yaml`,
|
}/en.yaml`,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ export async function currencies() {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
const glossary = await fetch(assertSecret(process.env.WOTB_GLOSSARY)).then(
|
const glossary = await fetch(
|
||||||
(response) => response.json() as Promise<BlitzGlossary>,
|
assertSecret(import.meta.env.WOTB_GLOSSARY),
|
||||||
);
|
).then((response) => response.json() as Promise<BlitzGlossary>);
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
Object.entries(glossary)
|
Object.entries(glossary)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
Armor,
|
Armor,
|
||||||
assertSecret,
|
assertSecret,
|
||||||
|
BlitzTankClass,
|
||||||
CamouflageDefinitions,
|
CamouflageDefinitions,
|
||||||
Consumable,
|
Consumable,
|
||||||
ConsumableDefinitions,
|
ConsumableDefinitions,
|
||||||
@@ -70,7 +71,6 @@ const blitzTankFilterDefinitionCategoryToBlitzkit: Record<
|
|||||||
function vector3TupleToBlitzkit(tuple: Vector3Tuple) {
|
function vector3TupleToBlitzkit(tuple: Vector3Tuple) {
|
||||||
return { x: tuple[0], y: tuple[1], z: tuple[2] } satisfies Vector3;
|
return { x: tuple[0], y: tuple[1], z: tuple[2] } satisfies Vector3;
|
||||||
}
|
}
|
||||||
type BlitzTankClass = 'lightTank' | 'mediumTank' | 'heavyTank' | 'AT-SPG';
|
|
||||||
const blitzTankClassToBlitzkit: Record<BlitzTankClass, TankClass> = {
|
const blitzTankClassToBlitzkit: Record<BlitzTankClass, TankClass> = {
|
||||||
lightTank: TankClass.LIGHT,
|
lightTank: TankClass.LIGHT,
|
||||||
'AT-SPG': TankClass.TANK_DESTROYER,
|
'AT-SPG': TankClass.TANK_DESTROYER,
|
||||||
@@ -514,7 +514,7 @@ export async function definitions() {
|
|||||||
|
|
||||||
const wargamingTankopedia = (await fetch(
|
const wargamingTankopedia = (await fetch(
|
||||||
`https://api.wotblitz.com/wotb/encyclopedia/vehicles/?application_id=${assertSecret(
|
`https://api.wotblitz.com/wotb/encyclopedia/vehicles/?application_id=${assertSecret(
|
||||||
process.env.PUBLIC_WARGAMING_APPLICATION_ID,
|
import.meta.env.PUBLIC_WARGAMING_APPLICATION_ID,
|
||||||
)}&fields=description`,
|
)}&fields=description`,
|
||||||
).then((response) => response.json())) as {
|
).then((response) => response.json())) as {
|
||||||
data: { [key: number]: { description: null | string } };
|
data: { [key: number]: { description: null | string } };
|
||||||
|
|||||||
@@ -25,10 +25,13 @@ build({
|
|||||||
'.node': 'empty',
|
'.node': 'empty',
|
||||||
'.json': 'json',
|
'.json': 'json',
|
||||||
},
|
},
|
||||||
|
external: ['sharp'],
|
||||||
minifyIdentifiers: false, // causes goofy ahh issues
|
minifyIdentifiers: false, // causes goofy ahh issues
|
||||||
minifySyntax: !dev,
|
minifySyntax: !dev,
|
||||||
minifyWhitespace: !dev,
|
minifyWhitespace: !dev,
|
||||||
sourcemap: !dev,
|
sourcemap: !dev,
|
||||||
|
jsxImportSource: 'react',
|
||||||
|
jsx: 'automatic',
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const module of await readdir(`${modulesRoot}/@resvg`)) {
|
for (const module of await readdir(`${modulesRoot}/@resvg`)) {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ export async function commitAssets(message: string, changes: FileChange[]) {
|
|||||||
if (changes.length === 0) return;
|
if (changes.length === 0) return;
|
||||||
|
|
||||||
await commitMultipleFiles(
|
await commitMultipleFiles(
|
||||||
assertSecret(process.env.PUBLIC_ASSET_REPO),
|
assertSecret(import.meta.env.PUBLIC_ASSET_REPO),
|
||||||
assertSecret(process.env.PUBLIC_ASSET_BRANCH),
|
assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH),
|
||||||
`${message} - ${new Date().toDateString()}`,
|
`${message} - ${new Date().toDateString()}`,
|
||||||
changes,
|
changes,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ import { Octokit } from '@octokit/rest';
|
|||||||
Octokit.plugin(throttling);
|
Octokit.plugin(throttling);
|
||||||
|
|
||||||
export const octokit = new Octokit({
|
export const octokit = new Octokit({
|
||||||
auth: assertSecret(process.env.GH_TOKEN),
|
auth: assertSecret(import.meta.env.GH_TOKEN),
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user