mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
fix: cors url
This commit is contained in:
1 parent
6b6ee94d9b
commit
44f03a1fce
2 files changed
+4
-7
No files matched your search
@@ -1,17 +1,14 @@
|
||||
import { RatingsInfo } from '../../commands/ratings';
|
||||
import { Region } from '../../constants/regions';
|
||||
import { context } from '../blitzkrieg/context';
|
||||
import { withCORSProxy } from '../blitzkrieg/withCORSProxy';
|
||||
import regionToRegionSubdomain from './regionToRegionSubdomain';
|
||||
|
||||
export default async function getRatingsInfo(region: Region) {
|
||||
const response = await fetch(
|
||||
withCORSProxy(
|
||||
context === 'bot'
|
||||
? `https://${regionToRegionSubdomain(
|
||||
region,
|
||||
)}.wotblitz.com/en/api/rating-leaderboards/season/`
|
||||
: `/api/ratings/info/${region}`,
|
||||
`https://${regionToRegionSubdomain(
|
||||
region,
|
||||
)}.wotblitz.com/en/api/rating-leaderboards/season/`,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -2,6 +2,6 @@ import { context } from './context';
|
||||
|
||||
export function withCORSProxy(url: string) {
|
||||
return context === 'website'
|
||||
? `https://corsproxy.wotblitz.com/?${encodeURIComponent(url)}`
|
||||
? `https://corsproxy.io/?${encodeURIComponent(url)}`
|
||||
: url;
|
||||
}
|
||||
Reference in new issue
Block a user