fix: country code judgement problem

This commit is contained in:
ikechan8370 2023-03-24 12:38:03 +08:00
parent c1ca4f2f9b
commit cc1f5611a7
3 changed files with 5 additions and 5 deletions

View file

@ -364,9 +364,7 @@ export async function isCN () {
let response = await fetch('https://ipinfo.io/country')
let countryCode = (await response.text()).trim()
await redis.set('CHATGPT:COUNTRY_CODE', countryCode, { EX: 3600 })
if (countryCode !== 'CN') {
return false
}
return countryCode === 'CN'
} catch (err) {
console.warn(err)
// 没拿到归属地默认CN