Files
kestrelos/app/composables/useWebRTCFailureReason.js
Keli Grubb 17f28401ba
All checks were successful
ci/woodpecker/push/push Pipeline was successful
minor: heavily simplify server and app content. unify styling (#4)
Co-authored-by: Madison Grubb <madison@elastiflow.com>
Reviewed-on: #4
2026-02-14 04:52:18 +00:00

14 lines
622 B
JavaScript

/** Pure: fetches WebRTC failure reason (e.g. wrong host). Returns frozen object. */
export async function getWebRTCFailureReason() {
try {
const res = await $fetch('/api/live/debug-request-host', { credentials: 'include' })
const clientHostname = typeof window !== 'undefined' ? window.location.hostname : ''
const serverHostname = res?.hostname ?? ''
if (serverHostname && clientHostname && serverHostname !== clientHostname) {
return Object.freeze({ wrongHost: Object.freeze({ serverHostname, clientHostname }) })
}
}
catch { /* ignore */ }
return Object.freeze({ wrongHost: null })
}