Commit 4e275a63 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Derive group name from status

This avoids hard-wiring URLs in the client.
parent ceb82fcf
...@@ -3441,11 +3441,6 @@ async function serverConnect() { ...@@ -3441,11 +3441,6 @@ async function serverConnect() {
} }
async function start() { async function start() {
group = decodeURIComponent(
location.pathname.replace(/^\/[a-z]*\//, '').replace(/\/$/, '')
);
/** @type {Object} */
try { try {
let r = await fetch(".status.json") let r = await fetch(".status.json")
if(!r.ok) if(!r.ok)
...@@ -3453,7 +3448,17 @@ async function start() { ...@@ -3453,7 +3448,17 @@ async function start() {
groupStatus = await r.json() groupStatus = await r.json()
} catch(e) { } catch(e) {
console.error(e); console.error(e);
return; displayWarning("Couldn't fetch status: " + e);
groupStatus = {};
}
if(groupStatus.name) {
group = groupStatus.name;
} else {
console.warn("no group name in status");
group = decodeURIComponent(
location.pathname.replace(/^\/[a-z]*\//, '').replace(/\/$/, ''),
);
} }
let parms = new URLSearchParams(window.location.search); let parms = new URLSearchParams(window.location.search);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment