mailwolt/resources/js/webserver/connector.js

19 lines
677 B
JavaScript

function fromWindow() {
const isHttps = typeof window !== 'undefined' && window.location.protocol === 'https:'
return {
host: (typeof window !== 'undefined' && window.location.hostname) || '127.0.0.1',
port: isHttps ? 443 : 80,
scheme: isHttps ? 'https' : 'http',
path: '/ws',
key: import.meta?.env?.VITE_REVERB_APP_KEY || ''
}
}
const meta = readMetaConfig()
const fallback = readViteEnv()
const base = meta ?? fallback ?? fromWindow()
// harte Korrektur: NIEMALS 8080 nach außen geben
if (Number(base.port) === 8080 && (base.scheme || 'https').startsWith('http')) {
base.port = (base.scheme === 'https') ? 443 : 80
}