Merge branch 'main' into dev-tank-search

This commit is contained in:
TrèsAbhi committed 2024-06-23 20:11:23 -05:00
commit 1d65dc755f
19 files changed
+110 -6453

No files matched your search

+14 -32
View File
@@ -16,52 +16,34 @@ jobs:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Checkout repository - uses: actions/checkout@v4
uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
token: ${{ secrets.GH_TOKEN }} token: ${{ secrets.GH_TOKEN }}
- uses: oven-sh/setup-bun@v1
- name: Use node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install Yarn
run: npm install --location=global yarn
- name: Use node_modules cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies - name: Install dependencies
run: yarn run: bun install
- name: Add fixed sharp
run: yarn add [email protected] --ignore-engines
- name: Setup DepotDownloader - name: Setup DepotDownloader
run: yarn setup:depotdownloader run: bun scripts/setupDepotDownloader.ts
- name: Run DepotDownloader - name: Run DepotDownloader
run: ./temp/depotDownloader/DepotDownloader.exe -app 444200 -username ${{ secrets.DEPOT_DOWNLOADER_USERNAME }} -password "${{ secrets.DEPOT_DOWNLOADER_PASSWORD }}" run: ./temp/depotDownloader/DepotDownloader.exe -os windows -app 444200 -username ${{ secrets.DEPOT_DOWNLOADER_USERNAME }} -password "${{ secrets.DEPOT_DOWNLOADER_PASSWORD }}"
- name: Apply patches - name: Apply patches
run: | run: |
$env:GH_TOKEN = "${{ secrets.GH_TOKEN }}" $env:GH_TOKEN = "${{ secrets.GH_TOKEN }}"
$env:DISCORD_TOKEN = "${{ secrets.DISCORD_TOKEN }}" $env:DISCORD_TOKEN = "${{ secrets.DISCORD_TOKEN }}"
$env:DATABASE_URL = "${{ secrets.DATABASE_URL }}" $env:DATABASE_URL = "${{ secrets.DATABASE_URL }}"
$env:WOTB_DLC_CDN = "${{ secrets.WOTB_DLC_CDN }}" $env:WOTB_DLC_CDN = "${{ secrets.WOTB_DLC_CDN }}"
yarn setup:patches --depot bun scripts/applyPatches.ts --depot
- name: Build assets - name: Build assets
run: | run: |
$env:GH_TOKEN = "${{ secrets.GH_TOKEN }}" $env:GH_TOKEN = "${{ secrets.GH_TOKEN }}"
$env:DISCORD_TOKEN = "${{ secrets.DISCORD_TOKEN }}" $env:DISCORD_TOKEN = "${{ secrets.DISCORD_TOKEN }}"
$env:DATABASE_URL = "${{ secrets.DATABASE_URL }}" $env:DATABASE_URL = "${{ secrets.DATABASE_URL }}"
$env:VIDEOS_SHEET = "${{ secrets.VIDEOS_SHEET }}" $env:VIDEOS_SHEET = "${{ secrets.VIDEOS_SHEET }}"
$env:GOOGLE_APPLICATION_CREDENTIALS = "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}" $env:GOOGLE_APPLICATION_CREDENTIALS = "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}"
yarn build:assets --all-targets --depot ${{ github.ref == 'refs/heads/main' && '--production' || '' }} bun scripts/buildAssets/index.ts --all-targets --depot --production
+8 -29
View File
@@ -17,44 +17,23 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }} url: ${{ steps.deployment.outputs.page_url }}
steps: steps:
- name: Checkout - uses: actions/checkout@v4
uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1
- name: Use node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install Yarn
run: npm install --location=global yarn
- name: Use node_modules cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies - name: Install dependencies
run: yarn run: bun install
- name: Build docs - name: Build docs
run: yarn build:docs run: bun build:docs
- name: Configure pages - uses: actions/configure-pages@v2
uses: actions/configure-pages@v2 - uses: actions/upload-pages-artifact@v1
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v1
with: with:
path: dist/docs path: dist/docs
- name: Deploy - id: deployment
id: deployment
uses: actions/deploy-pages@v1 uses: actions/deploy-pages@v1
- uses: actions/upload-artifact@v4
- name: Archive build
uses: actions/upload-artifact@v4
with: with:
name: dist name: dist
path: docs/.vitepress/dist path: docs/.vitepress/dist
+4 -19
View File
@@ -9,26 +9,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - uses: actions/checkout@v4
uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1
- name: Use node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install Yarn
run: npm install --location=global yarn
- name: Use node_modules cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies - name: Install dependencies
run: yarn run: bun install
- name: Generate leaderboard - name: Generate leaderboard
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} yarn publish:ratingleaderboard --region=asia --target=midnight --production run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} bun scripts/buildRatingLeaderboard.ts --region=asia --target=midnight --production
+4 -19
View File
@@ -9,26 +9,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - uses: actions/checkout@v4
uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1
- name: Use node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install Yarn
run: npm install --location=global yarn
- name: Use node_modules cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies - name: Install dependencies
run: yarn run: bun install
- name: Generate leaderboard - name: Generate leaderboard
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} yarn publish:ratingleaderboard --region=eu --target=midnight --production run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} bun scripts/buildRatingLeaderboard.ts --region=eu --target=midnight --production
+4 -19
View File
@@ -9,26 +9,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - uses: actions/checkout@v4
uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1
- name: Use node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install Yarn
run: npm install --location=global yarn
- name: Use node_modules cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies - name: Install dependencies
run: yarn run: bun install
- name: Generate all leaderboards - name: Generate all leaderboards
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} yarn publish:ratingleaderboard --region=na,asia,eu --target=latest --production run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} bun scripts/buildRatingLeaderboard.ts --region=na,asia,eu --target=latest --production
+4 -19
View File
@@ -9,26 +9,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - uses: actions/checkout@v4
uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1
- name: Use node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install Yarn
run: npm install --location=global yarn
- name: Use node_modules cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies - name: Install dependencies
run: yarn run: bun install
- name: Generate leaderboard - name: Generate leaderboard
run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} yarn publish:ratingleaderboard --region=na --target=midnight --production run: GH_TOKEN=${{ secrets.GH_TOKEN }} DISCORD_TOKEN=${{ secrets.DISCORD_TOKEN }} DATABASE_URL=${{ secrets.DATABASE_URL }} bun scripts/buildRatingLeaderboard.ts --region=na --target=midnight --production
+5 -20
View File
@@ -12,32 +12,17 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - uses: actions/checkout@v4
uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1
- name: Use node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install Yarn
run: npm install --location=global yarn
- name: Use node_modules cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies - name: Install dependencies
run: yarn run: bun install
- name: Build Prisma - name: Build Prisma
run: yarn prisma generate run: bun prisma generate
- name: Build - name: Build
run: yarn build:bot --production run: bun build:bot --production
- name: Archive build - name: Archive build
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
-43
View File
@@ -1,43 +0,0 @@
name: CI Build Docs
on: push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install Yarn
run: npm install --location=global yarn
- name: Use node_modules cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn
- name: Build
run: yarn build:docs
- name: Archive build
uses: actions/upload-artifact@v4
with:
name: docs
path: dist/docs
+4 -19
View File
@@ -12,29 +12,14 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - uses: actions/checkout@v4
uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v1
- name: Use node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Install Yarn
run: npm install --location=global yarn
- name: Use node_modules cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies - name: Install dependencies
run: yarn run: bun install
- name: Build - name: Build
run: yarn build:website run: bun build:website
- name: Archive build - name: Archive build
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
BIN
View File
Binary file not shown.
+1
View File
@@ -15,3 +15,4 @@ BlitzKit is a one man band **TrèsAbhi** but I am far from solo.
| Tankopedia pre-release testing | [OPTML], Aeson, \_34, Droodles | | Tankopedia pre-release testing | [OPTML], Aeson, \_34, Droodles |
| Website advertisement platform | Aeson, Droodles | | Website advertisement platform | Aeson, Droodles |
| Compare pre-release testing | [OPTML], Droodles | | Compare pre-release testing | [OPTML], Droodles |
| Redacted | GonnaHetzMe |
+6 -12
View File
@@ -7,29 +7,22 @@
"scripts": { "scripts": {
"build:averages": "bun scripts/averages", "build:averages": "bun scripts/averages",
"build:db": "prisma generate", "build:db": "prisma generate",
"build:bot": "vite-node --script scripts/build --production", "build:bot": "bun scripts/build.ts --production",
"build:website": "yarn build:db && yarn build:sitemap && next build", "build:website": "bun build:db && bun build:sitemap && next build",
"build:sitemap": "vite-node --script scripts/sitemap", "build:sitemap": "bun scripts/sitemap.ts",
"build:docs": "vitepress build docs", "build:docs": "vitepress build docs",
"build:ratingleaderboard": "vite-node --script scripts/buildRatingLeaderboard", "build:ratingleaderboard": "bun --script scripts/buildRatingLeaderboard.ts",
"build:assets": "vite-node --max_old_space_size=16384 --script scripts/buildAssets/index",
"test": "vite-node --script scripts/test",
"test2": "vite-node --script scripts/test2",
"dev:bot": "vite-node --script scripts/build && yarn start:bot", "dev:bot": "vite-node --script scripts/build && yarn start:bot",
"dev:docs": "vitepress dev docs", "dev:docs": "vitepress dev docs",
"dev:website": "next dev", "dev:website": "next dev",
"start:bot": "node --enable-source-maps dist/bot/index.cjs", "start:bot": "node --enable-source-maps dist/bot/index.cjs",
"start:website": "next start", "start:website": "next start",
"host:docs": "vitepress preview docs", "host:docs": "vitepress preview docs",
"publish:ratingleaderboard": "vite-node --script scripts/buildRatingLeaderboard --publish",
"setup:patches": "vite-node --script scripts/applyPatches",
"lint": "npx tsc", "lint": "npx tsc",
"lint:website": "next lint", "lint:website": "next lint",
"format": "prettier --write \"**/*.@(json|js|jsx|css|md|ts|tsx|html|xml|yml|gltf)\"", "format": "prettier --write \"**/*.@(json|js|jsx|css|md|ts|tsx|html|xml|yml|gltf)\"",
"lint:version": "vite-node --script scripts/checkVersionMissMatch",
"knip": "knip", "knip": "knip",
"update": "yarn upgrade --latest", "update": "yarn upgrade --latest",
"setup:depotdownloader": "vite-node --script scripts/setupDepotDownloader",
"tunnel": "cloudflared tunnel --url http://localhost:3000", "tunnel": "cloudflared tunnel --url http://localhost:3000",
"discoverids": "scripts/discoverIds.ts" "discoverids": "scripts/discoverIds.ts"
}, },
@@ -49,6 +42,7 @@
"@vanilla-extract/css": "^1.13.0", "@vanilla-extract/css": "^1.13.0",
"adm-zip": "^0.5.12", "adm-zip": "^0.5.12",
"bepaint": "^0.1.0-beta.3", "bepaint": "^0.1.0-beta.3",
"csv-parse": "^5.5.6",
"decompress": "^4.2.1", "decompress": "^4.2.1",
"discord.js": "^14.13.0", "discord.js": "^14.13.0",
"dotenv": "^16.3.1", "dotenv": "^16.3.1",
@@ -87,6 +81,7 @@
"devDependencies": { "devDependencies": {
"@total-typescript/ts-reset": "^0.5.1", "@total-typescript/ts-reset": "^0.5.1",
"@types/adm-zip": "^0.5.5", "@types/adm-zip": "^0.5.5",
"@types/bun": "^1.1.5",
"@types/decompress": "^4.2.7", "@types/decompress": "^4.2.7",
"@types/escape-html": "^1.0.2", "@types/escape-html": "^1.0.2",
"@types/express": "^4.17.18", "@types/express": "^4.17.18",
@@ -105,7 +100,6 @@
"crc": "^4.3.2", "crc": "^4.3.2",
"fast-xml-parser": "^4.3.2", "fast-xml-parser": "^4.3.2",
"knip": "^3.4.0", "knip": "^3.4.0",
"lz4": "^0.6.5",
"prettier": "^3.0.3", "prettier": "^3.0.3",
"prisma": "^5.4.1", "prisma": "^5.4.1",
"typescript": "^5.4.5" "typescript": "^5.4.5"
+4 -1
View File
@@ -17,7 +17,10 @@ export async function boosterIcons(production: boolean) {
await Promise.all( await Promise.all(
boosterFiles.map(async (file) => { boosterFiles.map(async (file) => {
const name = file.match(/booster_(.+).txt.dvpl/)![1]; const name = file.match(/booster_(.+).txt.dvpl/)?.[1];
if (name === undefined) return;
const sizes = ( const sizes = (
await readStringDVPL(`${DATA}/${POI.boosterIcons}/${file}`) await readStringDVPL(`${DATA}/${POI.boosterIcons}/${file}`)
) )
-12
View File
@@ -1,12 +0,0 @@
import { readdir } from 'fs/promises';
import packageJSON from '../package.json';
const { version } = packageJSON;
const changelogs = await readdir('docs/changelogs');
const hasVersion = changelogs.includes(`${version}.md`);
if (hasVersion) {
console.log(`Version ${version} found in changelogs`);
} else {
throw new Error(`Version ${version} not found in changelogs`);
}
+17 -8
View File
@@ -1,9 +1,8 @@
import { crc32 } from 'crc'; import { crc32 } from 'crc';
import { decodeBlock } from 'lz4'; import { decompressBlock } from 'lz4js';
/** /**
* Thanks Maddoxkkm! Modernized heavily. * Thanks Maddoxkkm! Modified heavily to be modern.
*
* https://github.com/Maddoxkkm/dvpl_converter/ * https://github.com/Maddoxkkm/dvpl_converter/
*/ */
export function readDVPL(buffer: Buffer) { export function readDVPL(buffer: Buffer) {
@@ -30,6 +29,7 @@ export function readDVPL(buffer: Buffer) {
if (crc32(targetBlock) !== footerData.crc32) { if (crc32(targetBlock) !== footerData.crc32) {
throw new TypeError('DVPL CRC32 mismatch'); throw new TypeError('DVPL CRC32 mismatch');
} }
if (footerData.type === 0) { if (footerData.type === 0) {
if (!(footerData.oSize === footerData.cSize && footerData.type === 0)) { if (!(footerData.oSize === footerData.cSize && footerData.type === 0)) {
throw new RangeError('DVPL type and size mismatch'); throw new RangeError('DVPL type and size mismatch');
@@ -37,14 +37,23 @@ export function readDVPL(buffer: Buffer) {
return targetBlock; return targetBlock;
} else if (footerData.type === 1 || footerData.type === 2) { } else if (footerData.type === 1 || footerData.type === 2) {
const deDVPLBlock = Buffer.alloc(footerData.oSize); const source = new Uint8Array(targetBlock);
const DecompressedBlockSize = decodeBlock(targetBlock, deDVPLBlock); const destination = new Uint8Array(footerData.oSize);
const decompressedSize = decompressBlock(
source,
destination,
0,
source.length,
0,
);
if (DecompressedBlockSize !== footerData.oSize) { if (decompressedSize !== footerData.oSize) {
throw new RangeError('Decompressed DVPL size mismatch'); throw new RangeError(
`Decompressed DVPL size mismatch (${decompressedSize} vs ${footerData.oSize})`,
);
} }
return deDVPLBlock; return Buffer.from(destination);
} else { } else {
throw new SyntaxError('Unknown DVPL format'); throw new SyntaxError('Unknown DVPL format');
} }
+11 -3
View File
@@ -1,5 +1,5 @@
import { crc32 } from 'crc'; import { crc32 } from 'crc';
import { encodeBlockHC } from 'lz4'; import { compressBlock } from 'lz4js';
/** /**
* Thanks Maddoxkkm! Modernized heavily. * Thanks Maddoxkkm! Modernized heavily.
@@ -7,8 +7,16 @@ import { encodeBlockHC } from 'lz4';
* https://github.com/Maddoxkkm/dvpl_converter/ * https://github.com/Maddoxkkm/dvpl_converter/
*/ */
export function writeDVPL(buffer: Buffer) { export function writeDVPL(buffer: Buffer) {
let output = Buffer.alloc(buffer.length); const source = new Uint8Array(buffer);
const compressedBlockSize = encodeBlockHC(buffer, output); const destination = new Uint8Array(buffer.length);
const compressedBlockSize = compressBlock(
source,
destination,
0,
source.length,
0,
);
let output = Buffer.from(destination);
if (compressedBlockSize === 0 || compressedBlockSize >= buffer.length) { if (compressedBlockSize === 0 || compressedBlockSize >= buffer.length) {
const footerBuffer = toDVPLFooter( const footerBuffer = toDVPLFooter(
+23
View File
@@ -0,0 +1,23 @@
export async function patientFetchJSON<Type extends object>(
url: string,
timeout = 1000,
options?: Partial<{ cache: 'no-store' }>,
) {
let patientJSON: Type;
while (patientJSON! === undefined) {
try {
patientJSON = (await fetch(url, options).then((response) =>
response.json(),
)) as Type;
} catch (error) {
console.warn(
`Failed to fetch ${url} as JSON; retrying in ${timeout}ms...`,
error,
);
await new Promise((resolve) => setTimeout(resolve, timeout));
}
}
return patientJSON;
}
-6197
View File
File diff suppressed because it is too large. Load diff