From e9ad3882d25f758da3fae2f720901baf5e952817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Tollk=C3=BChn?= Date: Thu, 22 Oct 2026 15:33:52 +0200 Subject: [PATCH] move const CONFIG to json file and add documentation in README.md --- README.md | 15 ++++++++++++ assets/config.json | 15 ++++++++++++ assets/launch.js | 58 ++++++++++++++++++---------------------------- 3 files changed, 52 insertions(+), 36 deletions(-) create mode 100644 assets/config.json diff --git a/README.md b/README.md index cca4b10..dd862b9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,21 @@ A small html/js project to nudge a user to use the desktop client for Jitsi. +## Configuration + +All settings live in `assets/config.json`, loaded at startup. The launcher stays +up but links break if the file is missing or malformed. + +| Parameter | Description | +| --- | --- | +| `jitsiLauncher` | Domain of this Jitsi launcher. Used for the meeting URLs created by the meeting creator (Nextcloud, adhoc link). | +| `jitsiHost` | Jitsi domain. Used for the browser fallback URL, the desktop protocol URL and the UID of generated ICS files. | +| `nextcloudBase` | Nextcloud instance used by the "Create in Nextcloud" button (calendar event creation). | +| `launchTimeout` | Timeout in ms before the browser fallback is shown after trying to start the jitsi-meet-electron client. | +| `backgroundImage` | Path to the page background image. Empty: no background. | +| `logo` | Path to the logo shown in the logo bar. Empty: logo bar stays hidden. | +| `downloads` | Download URLs for the jitsi-meet clients, shown in the fallback view per detected OS: `windows`, `macos`, `linux`, `ios`, `android`. | + ## Third-party assets - `assets/lib/ua-parser.min.js` — [ua-parser-js](https://github.com/faisalman/ua-parser-js) v2.0.10, © Faisal Salman, licensed under AGPL-3.0. diff --git a/assets/config.json b/assets/config.json new file mode 100644 index 0000000..e9b3a3f --- /dev/null +++ b/assets/config.json @@ -0,0 +1,15 @@ +{ + "jitsiLauncher": "meet.bnvb.eu", + "jitsiHost": "meet.bnvb-ingenieure.de", + "nextcloudBase": "https://cloud.bnvb-ingenieure.de", + "launchTimeout": 2000, + "backgroundImage": "assets/images/background.png", + "logo": "assets/images/logo.svg", + "downloads": { + "windows": "https://github.com/jitsi/jitsi-meet-electron/releases/latest/download/jitsi-meet.exe", + "macos": "https://github.com/jitsi/jitsi-meet-electron/releases/latest/download/jitsi-meet.dmg", + "linux": "https://github.com/jitsi/jitsi-meet-electron/releases", + "ios": "https://apps.apple.com/app/jitsi-meet/id1165103905", + "android": "https://play.google.com/store/apps/details?id=org.jitsi.meet" + } +} diff --git a/assets/launch.js b/assets/launch.js index f573416..16eba86 100644 --- a/assets/launch.js +++ b/assets/launch.js @@ -5,42 +5,12 @@ * ============================================================ */ -const CONFIG = { - /* - * Your Jitsi Launcher domain - */ - jitsiLauncher: "meet.bnvb.eu", - /* - * Your Jitsi domain. - */ - jitsiHost: "meet.bnvb-ingenieure.de", - /* - * Your Nextcloud instance (calendar event creation). - */ - nextcloudBase: "https://cloud.bnvb-ingenieure.de", - /* - * Timeout trying to start the jitsi-meet-electron client - */ - launchTimeout: 2000, - /* - * set wallpaper for webpage - */ - backgroundImage: "assets/images/background.png", - /* - * Set logo - */ - logo: "assets/images/logo.svg", - /* - * Download URLs for jitsi-meet clients - */ - downloads: { - windows: "https://github.com/jitsi/jitsi-meet-electron/releases/latest/download/jitsi-meet.exe", - macos: "https://github.com/jitsi/jitsi-meet-electron/releases/latest/download/jitsi-meet.dmg", - linux: "https://github.com/jitsi/jitsi-meet-electron/releases", - ios: "https://apps.apple.com/app/jitsi-meet/id1165103905", - android: "https://play.google.com/store/apps/details?id=org.jitsi.meet" - } -}; +/* + * Konfiguration liegt in assets/config.json und wird beim + * Start asynchron geladen (siehe START). + */ +let CONFIG = {}; +const CONFIG_URL = "assets/config.json"; /* ============================================================ * Translations @@ -1440,6 +1410,19 @@ window * ============================================================ */ +async function loadConfig() { + try { + const response = await fetch(CONFIG_URL); + CONFIG = await response.json(); + } catch (error) { + /* + * Ohne Datei bleiben Launcher unbrauchbar – Fehler + * melden und mit leerer Konfiguration fortfahren. + */ + console.error("Error loading config:", error); + } +} + async function loadTranslations() { try { const response = await fetch(I18N_URL); @@ -1461,6 +1444,9 @@ async function loadTranslations() { */ async function start() { applyTheme(); + + await loadConfig(); + applyBackgroundImage(); applyLogo();