fix bug with required https

This commit is contained in:
2025-09-13 23:37:12 +02:00
parent 1b5013b05e
commit 059bc6e299
3 changed files with 6 additions and 4 deletions

View File

@@ -14,8 +14,8 @@ popover.textContent = 'Loading...'
document.body.appendChild(popover); document.body.appendChild(popover);
const [badges, emotes] = await Promise.all([ const [badges, emotes] = await Promise.all([
fetch(`http://${location.host}/chat/getBadges`).then(data => data.json()), fetch(`${location.href}/getBadges`).then(data => data.json()),
fetch(`http://${location.host}/chat/getEmotes`).then(data => data.json()) fetch(`${location.href}/getEmotes`).then(data => data.json())
]); ]);
await prefetchImages(Object.values(emotes)); await prefetchImages(Object.values(emotes));

View File

@@ -5,7 +5,9 @@ import { type twitchEventData } from "web/chatWidget/websockettypes";
import { parseMessage } from './createMessage'; import { parseMessage } from './createMessage';
import { serverInstruction } from 'web/serverTypes'; import { serverInstruction } from 'web/serverTypes';
const socket = new WebSocket(`ws://${location.host}`); const wsAddress = `ws${location.protocol === "https:" ? 's' : ''}://${location.host}`;
const socket = new WebSocket(wsAddress);
socket.onopen = () => { socket.onopen = () => {
const instruction: serverInstruction = { const instruction: serverInstruction = {

View File

@@ -51,7 +51,7 @@ export default Bun.serve({
ws.close(); ws.close();
} }
}, },
development: true, development: process.env.NODE_ENV === "development",
error(error) { error(error) {
logger.err(`Error at chatwidget server: ${error}`); logger.err(`Error at chatwidget server: ${error}`);
return new Response("Internal Server Error", { status: 500 }) return new Response("Internal Server Error", { status: 500 })