mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-21 12:53:56 +01:00
feat: public blitzkrieg-db
This commit is contained in:
1 parent
0b9db21c10
commit
dfe1e37592
7 files changed
+44
-130
No files matched your search
@@ -1,7 +1,5 @@
|
||||
import { BlitzkriegRatingsLeaderboard } from '../../../scripts/buildRatingsLeaderboard';
|
||||
import { Region } from '../../constants/regions';
|
||||
import { DATABASE_REPO } from './getArchivedRatingsMidnightLeaderboard';
|
||||
import { octokit } from './octokit';
|
||||
|
||||
const LEADERBOARD_CACHE: Record<
|
||||
Region,
|
||||
@@ -20,18 +18,10 @@ export async function getArchivedRatingsLeaderboard(
|
||||
return LEADERBOARD_CACHE[region][season];
|
||||
}
|
||||
|
||||
const { data } = await octokit.repos.getContent({
|
||||
...DATABASE_REPO,
|
||||
path: `${region}/ratings/${season}/latest.json`,
|
||||
});
|
||||
|
||||
if (Array.isArray(data) || data.type !== 'file') {
|
||||
throw new Error('Archived ratings data is malformed');
|
||||
}
|
||||
|
||||
const response = await fetch(data.download_url!);
|
||||
const response = await fetch(
|
||||
`https://raw.githubusercontent.com/tresabhi/blitzkrieg-db/main/${region}/ratings/${season}/latest.json`,
|
||||
);
|
||||
const json = (await response.json()) as BlitzkriegRatingsLeaderboard;
|
||||
|
||||
LEADERBOARD_CACHE[region][season] = json;
|
||||
|
||||
return json;
|
||||
|
||||
Reference in new issue
Block a user