Use relative browser URLs

This commit is contained in:
codex
2026-06-12 20:28:43 +02:00
parent 0ea5428240
commit f303711d45
3 changed files with 14 additions and 10 deletions
+6 -6
View File
@@ -238,7 +238,7 @@ async function drawCaptchaPassphrase() {
const image = new Image();
image.decoding = "async";
image.src = `/captcha.svg?${Date.now()}`;
image.src = `captcha.svg?${Date.now()}`;
await image.decode();
context.clearRect(0, 0, width, height);
context.drawImage(image, 0, 0, width, height);
@@ -253,7 +253,7 @@ async function captchaIsCorrect() {
if (!answer) return false;
const params = new URLSearchParams({ answer });
const response = await fetch(`/captcha/verify?${params}`, { cache: "no-store" });
const response = await fetch(`captcha/verify?${params}`, { cache: "no-store" });
if (!response.ok) return false;
const result = await response.json();
return Boolean(result.ok);
@@ -582,7 +582,7 @@ async function sendWatchState({
const watchAction = action === "play" ? "play" : "pause";
const playlist = playlistWithActivePosition(position);
await fetch(`/watch/${encodeURIComponent(roomId)}`, {
await fetch(`watch/${encodeURIComponent(roomId)}`, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
@@ -1118,7 +1118,7 @@ function removeRemoteTile(id) {
}
async function sendSignal(to, payload) {
await fetch(`/signal/${encodeURIComponent(roomId)}`, {
await fetch(`signal/${encodeURIComponent(roomId)}`, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ ...payload, from: peerId, to, name: displayName, clientId })
@@ -1128,7 +1128,7 @@ async function sendSignal(to, payload) {
async function sendRoomEvent(payload) {
if (!peerId) return;
await fetch(`/room-event/${encodeURIComponent(roomId)}`, {
await fetch(`room-event/${encodeURIComponent(roomId)}`, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ ...payload, from: peerId, name: displayName, clientId })
@@ -1336,7 +1336,7 @@ async function joinCall() {
await ensureLocalStream();
const params = new URLSearchParams({ name: displayName, clientId, captcha: captchaAnswer() });
events = new EventSource(`/events/${encodeURIComponent(roomId)}?${params}`);
events = new EventSource(`events/${encodeURIComponent(roomId)}?${params}`);
events.onmessage = (event) => handleSignal(JSON.parse(event.data)).catch(console.error);
events.onerror = () => setStatus("Connection to signaling server was interrupted or captcha was denied.");
setStatus(`Joining as ${displayName}...`);
+3 -3
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>kkkmeet</title>
<link rel="stylesheet" href="/styles.css" />
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<main class="app-shell">
@@ -190,7 +190,7 @@
</dialog>
<div id="audio" hidden></div>
<script src="/vendor/speakjs/speakClient.js"></script>
<script type="module" src="/app.js"></script>
<script src="vendor/speakjs/speakClient.js"></script>
<script type="module" src="app.js"></script>
</body>
</html>
+5 -1
View File
@@ -1,6 +1,10 @@
var speakWorker;
try {
speakWorker = new Worker('/vendor/speakjs/speakWorker.js');
var speakClientScript = document.currentScript && document.currentScript.src;
var speakWorkerUrl = speakClientScript
? new URL('speakWorker.js', speakClientScript).toString()
: 'vendor/speakjs/speakWorker.js';
speakWorker = new Worker(speakWorkerUrl);
} catch(e) {
console.log('speak.js warning: no worker support');
}