1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-25 18:15:57 +01:00

Derive group name from status

This avoids hard-wiring URLs in the client.
This commit is contained in:
Juliusz Chroboczek 2022-09-01 14:37:42 +02:00
parent ceb82fcf05
commit 4e275a63b4

View file

@ -3441,11 +3441,6 @@ async function serverConnect() {
}
async function start() {
group = decodeURIComponent(
location.pathname.replace(/^\/[a-z]*\//, '').replace(/\/$/, '')
);
/** @type {Object} */
try {
let r = await fetch(".status.json")
if(!r.ok)
@ -3453,7 +3448,17 @@ async function start() {
groupStatus = await r.json()
} catch(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);