mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-10 03:07:41 +08:00
feat: Implement Vercel environment detection and pause settings auto-fetch after consecutive failures to prevent excessive API calls.
This commit is contained in:
13
webui/src/utils/runtimeEnv.js
Normal file
13
webui/src/utils/runtimeEnv.js
Normal 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' }
|
||||
}
|
||||
Reference in New Issue
Block a user