mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +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 { RatingsInfo } from '../../commands/ratings';
|
||||||
import { Region } from '../../constants/regions';
|
import { Region } from '../../constants/regions';
|
||||||
import { context } from '../blitzkrieg/context';
|
|
||||||
import { withCORSProxy } from '../blitzkrieg/withCORSProxy';
|
import { withCORSProxy } from '../blitzkrieg/withCORSProxy';
|
||||||
import regionToRegionSubdomain from './regionToRegionSubdomain';
|
import regionToRegionSubdomain from './regionToRegionSubdomain';
|
||||||
|
|
||||||
export default async function getRatingsInfo(region: Region) {
|
export default async function getRatingsInfo(region: Region) {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
withCORSProxy(
|
withCORSProxy(
|
||||||
context === 'bot'
|
`https://${regionToRegionSubdomain(
|
||||||
? `https://${regionToRegionSubdomain(
|
region,
|
||||||
region,
|
)}.wotblitz.com/en/api/rating-leaderboards/season/`,
|
||||||
)}.wotblitz.com/en/api/rating-leaderboards/season/`
|
|
||||||
: `/api/ratings/info/${region}`,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ import { context } from './context';
|
|||||||
|
|
||||||
export function withCORSProxy(url: string) {
|
export function withCORSProxy(url: string) {
|
||||||
return context === 'website'
|
return context === 'website'
|
||||||
? `https://corsproxy.wotblitz.com/?${encodeURIComponent(url)}`
|
? `https://corsproxy.io/?${encodeURIComponent(url)}`
|
||||||
: url;
|
: url;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user