Compare commits

...
2 Commits
Author SHA1 Message Date
stefan.tollkuehn 217a076120 Make legal notice link configurable
The legal notice link in the navbar was hardcoded to the
bnvb website. Deployments without that legal notice showed
a dead link to a foreign site.

Move the URL into assets/config.json (legalNotice), like
the Nextcloud and adhoc buttons. The link stays hidden
unless the entry is configured.
2026-11-03 11:09:22 +01:00
stefan.tollkuehn 49a3d90dc5 Scope localStorage keys per app directory
localStorage is scoped per origin, not per path. Multiple
jitsi-launch instances on one origin (e.g. meet.bnvb.eu/i
and /p) therefore shared one language and one theme
setting, and changing it in one instance changed it in
all others.

Prefix the language and theme keys with the app directory
derived from the page path. Each instance keeps its own
state; a root deployment gets the "/" prefix and behaves
as before. Previously saved choices reset once because
the key names change.
2026-11-03 11:06:50 +01:00
3 changed files with 37 additions and 5 deletions

No files matched your search

+1
View File
@@ -2,6 +2,7 @@
"jitsiLauncher": "server.domain.tld/subdir",
"jitsiHost": "jit.si",
"nextcloudBase": "https://cloud.domain.tld",
"legalNotice": "https://www.domain.tld/legal-notice",
"allowAdhocMeetings": true,
"launchTimeout": 2000,
"backgroundImage": "path/to/backgroundimage",
+35 -4
View File
@@ -12,6 +12,20 @@
let CONFIG = {};
const CONFIG_URL = "assets/config.json";
/*
* localStorage is scoped per origin, not per path.
* Prefix keys with the app directory so parallel
* instances (e.g. meet.bnvb.eu/i and /p) stay
* independent.
*
* "/p/launch.html" becomes "/p/"
*/
const STORAGE_PREFIX =
window.location.pathname.replace(/[^/]*$/, "");
const LANGUAGE_KEY = STORAGE_PREFIX + "jitsiLauncherLanguage";
const THEME_KEY = STORAGE_PREFIX + "jitsiLauncherTheme";
/* ============================================================
* Translations
* ============================================================
@@ -34,7 +48,7 @@ function detectLanguage() {
* Saved language choice takes precedence.
*/
try {
const saved = localStorage.getItem("jitsiLauncherLanguage");
const saved = localStorage.getItem(LANGUAGE_KEY);
if (saved && TRANSLATIONS[saved]) {
return saved;
@@ -179,7 +193,7 @@ function setLanguage(language) {
translation = TRANSLATIONS[language];
try {
localStorage.setItem("jitsiLauncherLanguage", language);
localStorage.setItem(LANGUAGE_KEY, language);
} catch (error) {
/*
* localStorage can be blocked, e.g. in private mode.
@@ -225,8 +239,6 @@ function closeNavMenu() {
* ============================================================
*/
const THEME_KEY = "jitsiLauncherTheme";
function savedTheme() {
try {
const saved = localStorage.getItem(THEME_KEY);
@@ -370,6 +382,23 @@ function applyAdhocButton() {
createAdhocButton.classList.remove("hidden");
}
/* ============================================================
* LEGAL NOTICE LINK
* ============================================================ */
/*
* Only show if a legal notice URL is configured
* (CONFIG.legalNotice in assets/config.json).
*/
function applyLegalNoticeLink() {
if (!CONFIG.legalNotice || !legalNoticeLink) {
return;
}
legalNoticeLink.href = CONFIG.legalNotice;
legalNoticeLink.classList.remove("hidden");
}
/* ============================================================
* DOM elements
* ============================================================
@@ -420,6 +449,7 @@ const copyAdhocLinkButton = document.getElementById("copyAdhocLinkButton");
const navbar = document.querySelector(".navbar");
const navToggle = document.getElementById("navToggle");
const navActions = document.getElementById("navActions");
const legalNoticeLink = document.getElementById("legalNoticeLink");
/* Language menu DOM elements */
const langMenu = document.getElementById("langMenu");
@@ -1609,6 +1639,7 @@ async function start() {
applyFavicons();
applyNextcloudButton();
applyAdhocButton();
applyLegalNoticeLink();
await loadTranslations();
+1 -1
View File
@@ -30,7 +30,7 @@
</svg>
</button>
<div id="navActions" class="nav-actions">
<a class="button secondary" href="https://www.bnvb-ingenieure.de/impressum" target="_blank" rel="noopener noreferrer" data-i18n="legal_notice">
<a id="legalNoticeLink" class="button secondary hidden" href="#" target="_blank" rel="noopener noreferrer" data-i18n="legal_notice">
Legal Notice
</a>
<a class="button secondary" href="https://git.bnvb.eu/stefan.tollkuehn/jitsi-launch" target="_blank" rel="noopener noreferrer" data-i18n="source">