mirror of
https://github.com/jech/galene.git
synced 2024-11-22 08:35:57 +01:00
Derive group name from status
This avoids hard-wiring URLs in the client.
This commit is contained in:
parent
ceb82fcf05
commit
4e275a63b4
1 changed files with 11 additions and 6 deletions
|
@ -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() {
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue