From a8e1e47070f69d2780d35c82dbe54a8866c14be3 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 13 Nov 2024 10:58:42 +0100 Subject: [locationinfo] Add support for Firefox --- .../locationinfo/inc/locationinfo.inc.php | 3 +- .../locationinfo/inc/locationinfohooks.inc.php | 28 ++- .../locationinfo/lang/de/template-tags.json | 6 +- .../locationinfo/lang/en/template-tags.json | 6 +- modules-available/locationinfo/page.inc.php | 4 +- .../templates/page-config-panel-url.html | 208 ++++++++++++--------- 6 files changed, 151 insertions(+), 104 deletions(-) (limited to 'modules-available') diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php index 42829a18..1165164d 100644 --- a/modules-available/locationinfo/inc/locationinfo.inc.php +++ b/modules-available/locationinfo/inc/locationinfo.inc.php @@ -125,8 +125,9 @@ class LocationInfo 'insecure-ssl' => 0, 'reload-minutes' => 0, 'split-login' => 0, - 'browser' => 'slx-browser', + 'browser' => 'firefox', 'interactive' => 0, + 'hw-video' => 0, 'bookmarks' => '', 'allow-tty' => '', 'url' => '', diff --git a/modules-available/locationinfo/inc/locationinfohooks.inc.php b/modules-available/locationinfo/inc/locationinfohooks.inc.php index 8ec217cc..406d03c1 100644 --- a/modules-available/locationinfo/inc/locationinfohooks.inc.php +++ b/modules-available/locationinfo/inc/locationinfohooks.inc.php @@ -25,10 +25,6 @@ class LocationInfoHooks if ($type === null) return; // TODO: Invalid panel - what should we do? if ($type === 'URL') { - // Check if we should set the insecure SSL mode (accept invalid/self signed certs etc.) - if ($data['insecure-ssl'] !== 0) { - ConfigHolder::add('SLX_BROWSER_INSECURE', '1'); - } if ($data['reload-minutes'] > 0) { ConfigHolder::add('SLX_BROWSER_RELOAD_SECS', $data['reload-minutes'] * 60); } @@ -52,16 +48,30 @@ class LocationInfoHooks ConfigHolder::add('SLX_ADDONS', '', 1000); } if (!empty($data['browser'])) { - if ($data['browser'] === 'chromium') { + $browser = $data['browser']; + if ($browser === 'chromium') { $browser = 'chromium chrome'; - } else { + } elseif ($browser === 'slx-browser') { $browser = 'slxbrowser slx-browser'; - $data['interactive'] = (isset($data['split-login']) && $data['split-login']); } ConfigHolder::add('SLX_BROWSER', $browser, 1000); + // There was probably some reason for this: When split-login is enabled, we force + // an interactive browser (full UI). I guess because some users might not + // know how to exit the browser otherwise? Past me was stupid enough not to leave + // a comment here or in the commit message.... + $data['interactive'] = (isset($data['split-login']) && $data['split-login']); } - if (isset($data['interactive']) && $data['interactive']) { - ConfigHolder::add('SLX_BROWSER_INTERACTIVE', '1', 1000); + // Check if we should enable insecure SSL mode (accept invalid/self-signed certs etc.), + // if we should display the full UI, and whether we force HW acceleration for video playback + $features = [ + 'insecure-ssl' => 'SLX_BROWSER_INSECURE', + 'interactive' => 'SLX_BROWSER_INTERACTIVE', + 'hw-video' => 'SLX_BROWSER_HWVIDEO', + ]; + foreach ($features as $key => $var) { + if ($data[$key] ?? false) { + ConfigHolder::add($var, '1', 1000); + } } if (!empty($data['bookmarks'])) { ConfigHolder::add('SLX_BROWSER_BOOKMARKS', $data['bookmarks'], 1000); diff --git a/modules-available/locationinfo/lang/de/template-tags.json b/modules-available/locationinfo/lang/de/template-tags.json index fe6a3e53..95e8804d 100644 --- a/modules-available/locationinfo/lang/de/template-tags.json +++ b/modules-available/locationinfo/lang/de/template-tags.json @@ -38,6 +38,7 @@ "lang_editUrlPanelHints": "Hier k\u00f6nnen Sie konfigurieren, welche URL das Panel aufrufen soll. Dies erm\u00f6glicht Ihnen z.B. in Eingangsbereichen aktuelle Meldungen der Hochschule oder sonstige Webseiten anzuzeigen.", "lang_entryName": "Name", "lang_error": "Fehler", + "lang_firefox": "Firefox", "lang_for": "f\u00fcr", "lang_fourLocsHint": "Hier k\u00f6nnen Sie bis zu vier Orte ausw\u00e4hlen, die in diesem Panel angezeigt werden.", "lang_free": "Ge\u00f6ffnet", @@ -47,6 +48,8 @@ "lang_goToLocation": "Gehe zu Raum", "lang_goToLocationWarning": "Weiterleitung zum Raum-Modul", "lang_hostnameTooltip": "Zeige kurzen Hostnamen in Rechner-Piktogramm", + "lang_hwAccelVideo": "Video Hardware-Decode erzwingen", + "lang_hwAccelVideoTooltip": "Versuche hardwarebeschleunigte Videodekodierung zu erzwingen, auch wenn der Browser dies auf der vorgefundenen Hardware standardm\u00e4\u00dfig nicht tut. Kann die Leistung verbessern, oder aber zu Anzeige-\/Stabilit\u00e4tsproblemen f\u00fchren.", "lang_ignoreSslTooltip": "Akzeptiere ung\u00fcltige, abgelaufene oder selbstsignierte SSL-Zertifikate", "lang_insecureSsl": "Unsicheres SSL", "lang_interactive": "Interaktiver Browser", @@ -140,7 +143,8 @@ "lang_typeTooltip": "Legt fest um welchen Server-Typ es sich handelt", "lang_updateRates": "Aktualisierungsintervall", "lang_url": "URL", - "lang_urlListHelp": "Sie k\u00f6nnen hier Listen von URLs oder Hostnamen angeben, die dann als Whitelist bzw. Blacklist interpretiert werden. Je nach gew\u00e4hltem Browser hat entweder die Whitelist Vorrang, oder die \"genauere\" Regel. Wenn keine Regel zutrifft, wird der Zugriff erlaubt, es sei denn, es gibt den Eintrag \"*\" in der Blacklist. Je nach verwendetem Browser wird \"*\" als Wildcard an verschiedenen Stellen unterst\u00fctzt. Sie k\u00f6nnen Kommentare hinter oder zwischen den Zeilen mittels \"#\" einleiten. Weitere Informationen finden Sie im bwLehrpool-Wiki.", + "lang_urlListHelp": "Sie k\u00f6nnen hier Listen von URLs oder Hostnamen angeben, die dann als Whitelist bzw. Blacklist interpretiert werden. Je nach gew\u00e4hltem Browser hat entweder die Whitelist Vorrang, oder die \"genauere\" Regel. Wenn keine Regel zutrifft, wird der Zugriff erlaubt, es sei denn, es gibt den Eintrag \"*\" in der Blacklist. Je nach verwendetem Browser wird \"*\" als Wildcard an verschiedenen Stellen unterst\u00fctzt. Sie k\u00f6nnen Kommentare hinter oder zwischen den Zeilen mittels \"#\" einleiten.", + "lang_urlListHelpUrl": "Weitere Informationen finden Sie im bwLehrpool-Wiki.", "lang_urlPanel": "URL-Panel", "lang_urlTooltip": "URL die aufgerufen wird", "lang_useDefault": "Vorgabe f\u00fcr Raum\/Rechner verwenden", diff --git a/modules-available/locationinfo/lang/en/template-tags.json b/modules-available/locationinfo/lang/en/template-tags.json index 5f612d16..31c1a355 100644 --- a/modules-available/locationinfo/lang/en/template-tags.json +++ b/modules-available/locationinfo/lang/en/template-tags.json @@ -38,6 +38,7 @@ "lang_editUrlPanelHints": "Here you can define which URL is opened by the panel. This enables you to show news about your university or any other website.", "lang_entryName": "Name", "lang_error": "Error", + "lang_firefox": "Firefox", "lang_for": "for", "lang_fourLocsHint": "You can pick up to four locations that will be shown in this panel.", "lang_free": "Open", @@ -47,6 +48,8 @@ "lang_goToLocation": "GoTo Location", "lang_goToLocationWarning": "Forward to Location-Module", "lang_hostnameTooltip": "Show simple hostname inside computer icon", + "lang_hwAccelVideo": "Force hardware accelerated video decode", + "lang_hwAccelVideoTooltip": "Try to force the browser to use hardware accelerated video decode. Might improve performance, but might also lead to instability or glitches.", "lang_ignoreSslTooltip": "Accept invalid, expired or self-signed ssl certificates", "lang_insecureSsl": "Insecure SSL", "lang_interactive": "Interactive Browser", @@ -140,7 +143,8 @@ "lang_typeTooltip": "Defines on which type of server you want to connect to", "lang_updateRates": "Update rates", "lang_url": "URL", - "lang_urlListHelp": "You can specify lists of URLs or hostnames here, which are then interpreted as a whitelist or blacklist. Depending on the selected browser, either the whitelist or the \"more precise\" rule takes precedence. If no rule applies, access will be allowed unless there is an entry \"*\" in the blacklist. Depending on the browser used, \"*\" is supported as a wildcard in different places. You can introduce comments at the end of or between lines using \"#\". Further information can be found in the bwLehrpool-Wiki.", + "lang_urlListHelp": "You can specify lists of URLs or hostnames here, which are then interpreted as a whitelist or blacklist. Depending on the selected browser, either the whitelist or the \"more precise\" rule takes precedence. If no rule applies, access will be allowed unless there is an entry \"*\" in the blacklist. Depending on the browser used, \"*\" is supported as a wildcard in different places. You can introduce comments at the end of or between lines using \"#\".", + "lang_urlListHelpUrl": "Further information can be found in the bwLehrpool-Wiki.", "lang_urlPanel": "URL panel", "lang_urlTooltip": "URL which is shown by the panel", "lang_useDefault": "Use setting from location\/machine", diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index 63a02ba2..7e19bfbc 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -354,8 +354,9 @@ class Page_LocationInfo extends Page 'whitelist' => preg_replace("/[\r\n]+/m", "\n", Request::post('whitelist', '', 'string')), 'blacklist' => preg_replace("/[\r\n]+/m", "\n", Request::post('blacklist', '', 'string')), 'split-login' => Request::post('split-login', 0, 'bool'), - 'browser' => Request::post('browser', 'slx-browser', 'string'), + 'browser' => Request::post('browser', 'firefox', 'string'), 'interactive' => Request::post('interactive', '0', 'bool'), + 'hw-video' => Request::post('hw-video', '0', 'bool'), 'bookmarks' => $bookmarkString ?: '', 'allow-tty' => Request::post('allow-tty', '', 'string'), 'zoom-factor' => Request::post('zoom-factor', 100, 'int'), @@ -1019,6 +1020,7 @@ class Page_LocationInfo extends Page 'split-login_checked' => $config['split-login'] ? 'checked' : '', 'browser' => $config['browser'], 'interactive_checked' => $config['interactive'] ? 'checked' : '', + 'hwvideo_checked' => $config['hw-video'] ? 'checked' : '', 'bookmarks' => $bookmarksArray, 'allow-tty_' . $config['allow-tty'] . '_checked' => 'checked', )); diff --git a/modules-available/locationinfo/templates/page-config-panel-url.html b/modules-available/locationinfo/templates/page-config-panel-url.html index 3aaf8620..e7f6fb1b 100644 --- a/modules-available/locationinfo/templates/page-config-panel-url.html +++ b/modules-available/locationinfo/templates/page-config-panel-url.html @@ -44,23 +44,6 @@ -
-
-
- -
-
-
- - -
-
-
- {{lang_ignoreSslTooltip}} -
-
-
-
@@ -112,6 +95,9 @@
{{lang_urlListHelp}} + + {{lang_urlListHelpUrl}} +
@@ -136,102 +122,141 @@
- +
-
- +
+ +
+
+ {{zoom-factor}}%
- {{lang_browserTooltip}} + {{lang_zoomFactorTooltip}}
-
+
- +
-
- - -
+
- {{lang_interactiveTooltip}} + {{lang_browserTooltip}}
-
-
-
- -
-
- -
-
- {{lang_bookmarksTooltip}} -
-
-