feat: Implement Vercel environment detection and pause settings auto-fetch after consecutive failures to prevent excessive API calls.

This commit is contained in:
CJACK
2026-02-20 03:22:27 +08:00
parent 1d2a6bf281
commit 2781951ce7
7 changed files with 203 additions and 45 deletions

View File

@@ -0,0 +1,13 @@
export function detectRuntimeEnv() {
const deployTarget = String(import.meta.env.VITE_DEPLOY_TARGET || '').trim().toLowerCase()
if (deployTarget === 'vercel') {
return { isVercel: true, source: 'vite_env' }
}
const host = typeof window !== 'undefined' ? String(window.location.hostname || '').toLowerCase() : ''
if (host.includes('vercel.app')) {
return { isVercel: true, source: 'hostname' }
}
return { isVercel: false, source: 'default' }
}