mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
Merge pull request #61 from tresabhi/1.15.9
This commit is contained in:
4 files changed
+40
-14
No files matched your search
@@ -0,0 +1,13 @@
|
|||||||
|
# Blitzkrieg 1.15.9
|
||||||
|
|
||||||
|
~~Curiosity killed the cat~~ Ratings killed the Blitzkrieg
|
||||||
|
|
||||||
|
## Fixes
|
||||||
|
|
||||||
|
- Deleted ratings players are now handled properly
|
||||||
|
|
||||||
|
## Technical Fixes
|
||||||
|
|
||||||
|
- Latest archived season number
|
||||||
|
- Is now cached properly
|
||||||
|
- Is now fetched in a chaining fashion correctly
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "blitzkrieg",
|
"name": "blitzkrieg",
|
||||||
"version": "1.15.8",
|
"version": "1.15.9",
|
||||||
"description": "🎉 Tools for everything World of Tanks Blitz",
|
"description": "🎉 Tools for everything World of Tanks Blitz",
|
||||||
"main": "src/server.ts",
|
"main": "src/server.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -298,8 +298,8 @@ export const ratingsCommand = new Promise<CommandRegistryRaw>(
|
|||||||
position: firstPlayerIndex + index + 1,
|
position: firstPlayerIndex + index + 1,
|
||||||
clan: clanData[player.id]?.clan?.tag,
|
clan: clanData[player.id]?.clan?.tag,
|
||||||
nickname:
|
nickname:
|
||||||
clanData[player.id]?.account_name ??
|
clanData[index]?.account_name ??
|
||||||
`Unknown Player ${player.id}`,
|
`Deleted ${player.id}`,
|
||||||
}) satisfies SimplifiedPlayer,
|
}) satisfies SimplifiedPlayer,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,17 +1,28 @@
|
|||||||
import getRatingsInfo from '../blitz/getRatingsInfo';
|
import getRatingsInfo from '../blitz/getRatingsInfo';
|
||||||
|
|
||||||
|
interface GitHubTrees {
|
||||||
|
tree: { path: string; url: string }[];
|
||||||
|
}
|
||||||
|
|
||||||
let cachedLatestArchivedSeasonNumber: number | null = null;
|
let cachedLatestArchivedSeasonNumber: number | null = null;
|
||||||
|
|
||||||
export async function getArchivedLatestSeasonNumber() {
|
export async function getArchivedLatestSeasonNumber() {
|
||||||
|
if (cachedLatestArchivedSeasonNumber !== null) {
|
||||||
|
return cachedLatestArchivedSeasonNumber;
|
||||||
|
}
|
||||||
|
|
||||||
const ratingsInfo = await getRatingsInfo('com');
|
const ratingsInfo = await getRatingsInfo('com');
|
||||||
|
|
||||||
if (ratingsInfo.detail) {
|
if (ratingsInfo.detail) {
|
||||||
const comURL = (
|
const regionsURL = (
|
||||||
(await fetch(
|
(await fetch(
|
||||||
'https://api.github.com/repos/tresabhi/blitzkrieg-assets/git/trees/main/regions',
|
'https://api.github.com/repos/tresabhi/blitzkrieg-assets/git/trees/main',
|
||||||
).then((response) => response.json())) as {
|
).then((response) => response.json())) as GitHubTrees
|
||||||
tree: { path: string; url: string }[];
|
).tree.find(({ path }) => path === 'regions')!.url;
|
||||||
}
|
const comURL = (
|
||||||
|
(await fetch(regionsURL).then((response) =>
|
||||||
|
response.json(),
|
||||||
|
)) as GitHubTrees
|
||||||
).tree.find(({ path }) => path === 'com')!.url;
|
).tree.find(({ path }) => path === 'com')!.url;
|
||||||
const ratingsURL = (
|
const ratingsURL = (
|
||||||
(await fetch(comURL).then((response) => response.json())) as {
|
(await fetch(comURL).then((response) => response.json())) as {
|
||||||
@@ -20,14 +31,16 @@ export async function getArchivedLatestSeasonNumber() {
|
|||||||
).tree[0].url;
|
).tree[0].url;
|
||||||
const latestSeason = Math.max(
|
const latestSeason = Math.max(
|
||||||
...(
|
...(
|
||||||
(await fetch(ratingsURL).then((response) => {
|
(await fetch(ratingsURL).then((response) => response.json())) as {
|
||||||
response.json();
|
tree: { path: string }[];
|
||||||
})) as { tree: { path: string }[] }
|
}
|
||||||
).tree.map(({ path }) => parseInt(path)),
|
).tree.map(({ path }) => Number(path)),
|
||||||
);
|
);
|
||||||
|
|
||||||
return latestSeason;
|
cachedLatestArchivedSeasonNumber = latestSeason;
|
||||||
} else {
|
} else {
|
||||||
return ratingsInfo.current_season - 1;
|
cachedLatestArchivedSeasonNumber = ratingsInfo.current_season - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return cachedLatestArchivedSeasonNumber;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user