Files
mwy/frontend/src/config/neteasePlayer.ts

18 lines
639 B
TypeScript
Raw Normal View History

2026-05-11 19:34:35 +08:00
/**
* Django
*
* `frontend/.env` / `.env.development`
* VITE_NETEASE_PLAYER_SRC=https://music.163.com/outchain/player?type=2&id=…&auto=1&height=66
* `<iframe … src="…">` src
*/
function extractIframeSrc(raw: string): string {
const t = raw.trim()
if (!t) return ''
const m = /\bsrc\s*=\s*["']([^"']+)["']/i.exec(t)
return (m ? m[1] : t).trim()
}
const fromEnv = (import.meta.env.VITE_NETEASE_PLAYER_SRC as string | undefined)?.trim() ?? ''
export const NETEASE_PLAYER_SRC = extractIframeSrc(fromEnv)