diff options
6 files changed, 151 insertions, 104 deletions
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 @@ -47,23 +47,6 @@ <div class="list-group-item"> <div class="row"> <div class="col-sm-4"> - <label for="input-ssl">{{lang_insecureSsl}}</label> - </div> - <div class="col-sm-8"> - <div class="checkbox"> - <input id="input-ssl" type="checkbox" name="insecure-ssl" {{ssl_checked}} value="1"> - <label></label> - </div> - </div> - <div class="col-sm-12 small text-muted spacebottop"> - {{lang_ignoreSslTooltip}} - </div> - </div> - </div> - - <div class="list-group-item"> - <div class="row"> - <div class="col-sm-4"> <label>{{lang_allowTtySwitch}}</label> </div> <div class="col-sm-8"> @@ -112,6 +95,9 @@ </div> <div class="col-sm-12 slx-smallspace"> {{lang_urlListHelp}} + <a target="_blank" href="https://www.bwlehrpool.de/wiki/doku.php/satellite/satellitenserver_infoscreen#blackwhitelist"> + {{lang_urlListHelpUrl}} + </a> </div> </div> </div> @@ -136,102 +122,141 @@ <div class="list-group-item"> <div class="row"> <div class="col-sm-4"> - <label for="browser">{{lang_browser}}</label> + <label for="zoom-factor">{{lang_zoomFactor}}</label> </div> - <div class="col-sm-8"> - <select class="form-control" name="browser" id="browser" onchange="browserChange()"> - <option value="slx-browser" id="slx">{{lang_slxbrowser}}</option> - <option value="chromium" id="chrome">{{lang_chromium}}</option> - </select> + <div class="col-sm-7 col-xs-10"> + <input class="form-control" id="zoom-factor" type="range" min="50" max="300" step="5" + name="zoom-factor" value="{{zoom-factor}}"> + </div> + <div class="col-sm-1 col-xs-2"> + <span id="zoom-value">{{zoom-factor}}</span>% </div> <div class="col-sm-12 small text-muted spacebottop"> - {{lang_browserTooltip}} + {{lang_zoomFactorTooltip}} </div> </div> </div> - <div class="list-group-item b0-h"> + <div class="list-group-item"> <div class="row"> <div class="col-sm-4"> - <label for="interactive">{{lang_interactive}}</label> + <label for="browser">{{lang_browser}}</label> </div> <div class="col-sm-8"> - <div class="checkbox"> - <input id="interactive" type="checkbox" name="interactive" {{interactive_checked}} value="1"> - <label></label> - </div> + <select class="form-control" name="browser" id="browser" onchange="browserChange()"> + <option value="slx-browser" id="slx">{{lang_slxbrowser}}</option> + <option value="chromium" id="chrome">{{lang_chromium}}</option> + <option value="firefox" id="firefox">{{lang_firefox}}</option> + </select> </div> <div class="col-sm-12 small text-muted spacebottop"> - {{lang_interactiveTooltip}} + {{lang_browserTooltip}} </div> </div> </div> - <div class="list-group-item b0-h" id="bookmarks"> - <div class="row"> - <div class="col-sm-4"> - <label for="bookmarks">{{lang_bookmarks}}</label> - </div> - <div class="col-sm-8"> - <button type="button" class="btn btn-success" onclick="addBookmark()"> - <span class="glyphicon glyphicon-plus"></span> - </button> - </div> - <div class="col-sm-12 small text-muted spacebottop"> - {{lang_bookmarksTooltip}} - </div> - </div> - <div class="row" style="margin-top: 1em;" id="bookmarkRow" hidden> - <div class="col-sm-3 col-sm-offset-3"> - <input class="form-control" name="bookmarkNames[]" type="text" value="" - placeholder="bwLehrpool"> - </div> - <div class="col-sm-3"> - <input class="form-control" name="bookmarkUrls[]" type="text" value="" - placeholder="https://www.bwlehrpool.de/" pattern=".*://.*"> - </div> - <div class="col-sm-1"> - <button type="button" class="btn btn-danger" onclick="$(this).closest('.row').remove()"> - <span class="glyphicon glyphicon-minus"></span> - </button> + <div id="browser-specific"> + + <div class="list-group-item show-chromium show-firefox"> + <div class="row"> + <div class="col-sm-4"> + <label for="interactive">{{lang_interactive}}</label> + </div> + <div class="col-sm-8"> + <div class="checkbox"> + <input id="interactive" type="checkbox" name="interactive" {{interactive_checked}} value="1"> + <label></label> + </div> + </div> + <div class="col-sm-12 small text-muted spacebottop"> + {{lang_interactiveTooltip}} + </div> </div> </div> - {{#bookmarks}} - <div class="row" style="margin-top: 1em;"> - <div class="col-sm-3 col-sm-offset-3"> - <input class="form-control" name="bookmarkNames[]" type="text" value="{{name}}" - placeholder="bwLehrpool" required> - </div> - <div class="col-sm-3"> - <input class="form-control" name="bookmarkUrls[]" type="text" value="{{url}}" - placeholder="http://www.bwlehrpool.de/" pattern=".*://.*" required> - </div> - <div class="col-sm-1"> - <button type="button" class="btn btn-danger" onclick="$(this).closest('.row').remove()"> - <span class="glyphicon glyphicon-minus"></span> - </button> + <div class="list-group-item show-slx-browser show-chromium"> + <div class="row"> + <div class="col-sm-4"> + <label for="input-ssl">{{lang_insecureSsl}}</label> + </div> + <div class="col-sm-8"> + <div class="checkbox"> + <input id="input-ssl" type="checkbox" name="insecure-ssl" {{ssl_checked}} value="1"> + <label></label> + </div> + </div> + <div class="col-sm-12 small text-muted spacebottop"> + {{lang_ignoreSslTooltip}} + </div> </div> </div> - {{/bookmarks}} - </div> - <div class="list-group-item"> - <div class="row"> - <div class="col-sm-4"> - <label for="zoom-factor">{{lang_zoomFactor}}</label> + <div class="list-group-item show-chromium show-firefox" id="bookmarks"> + <div class="row"> + <div class="col-sm-4"> + <label for="bookmarks">{{lang_bookmarks}}</label> + </div> + <div class="col-sm-8"> + <button type="button" class="btn btn-success" onclick="addBookmark()"> + <span class="glyphicon glyphicon-plus"></span> + </button> + </div> + <div class="col-sm-12 small text-muted spacebottop"> + {{lang_bookmarksTooltip}} + </div> </div> - <div class="col-sm-7 col-xs-10"> - <input class="form-control" id="zoom-factor" type="range" min="50" max="300" step="5" - name="zoom-factor" value="{{zoom-factor}}"> + <div class="row" style="margin-top: 1em;" id="bookmarkRow" hidden> + <div class="col-sm-3 col-sm-offset-3"> + <input class="form-control" name="bookmarkNames[]" type="text" value="" + placeholder="bwLehrpool"> + </div> + <div class="col-sm-3"> + <input class="form-control" name="bookmarkUrls[]" type="text" value="" + placeholder="https://www.bwlehrpool.de/" pattern=".*://.*"> + </div> + <div class="col-sm-1"> + <button type="button" class="btn btn-danger" onclick="$(this).closest('.row').remove()"> + <span class="glyphicon glyphicon-minus"></span> + </button> + </div> </div> - <div class="col-sm-1 col-xs-2" id="zoom-value"> - </div> - <div class="col-sm-12 small text-muted spacebottop"> - {{lang_zoomFactorTooltip}} + {{#bookmarks}} + <div class="row" style="margin-top: 1em;"> + <div class="col-sm-3 col-sm-offset-3"> + <input class="form-control" name="bookmarkNames[]" type="text" value="{{name}}" + placeholder="bwLehrpool" required> + </div> + <div class="col-sm-5"> + <input class="form-control" name="bookmarkUrls[]" type="text" value="{{url}}" + placeholder="http://www.bwlehrpool.de/" pattern=".*://.*" required> + </div> + <div class="col-sm-1"> + <button type="button" class="btn btn-danger" onclick="$(this).closest('.row').remove()"> + <span class="glyphicon glyphicon-minus"></span> + </button> + </div> + </div> + {{/bookmarks}} + </div> + + <div class="list-group-item show-chromium show-firefox"> + <div class="row"> + <div class="col-sm-4"> + <label for="hw-video">{{lang_hwAccelVideo}}</label> + </div> + <div class="col-sm-8"> + <div class="checkbox"> + <input id="hw-video" type="checkbox" name="hw-video" {{hwvideo_checked}} value="1"> + <label></label> + </div> + </div> + <div class="col-sm-12 small text-muted spacebottop"> + {{lang_hwAccelVideoTooltip}} + </div> </div> </div> + </div> </div> @@ -245,6 +270,9 @@ </div> </form> +<!-- so page doesn't jump around so much when you switch browser --> +<div style="height: 300px"></div> + <script> document.addEventListener("DOMContentLoaded", function () { @@ -254,7 +282,7 @@ document.addEventListener("DOMContentLoaded", function () { var $zv = $('#zoom-value'); var $zf = $('#zoom-factor'); var sliderUpdate = function() { - $zv.text($zf.val() + '%'); + $zv.text($zf.val()); }; $zf.on('input', sliderUpdate); sliderUpdate(); @@ -263,11 +291,9 @@ document.addEventListener("DOMContentLoaded", function () { // Hide interactive-input if slx-browser is selected function browserChange() { var value = $('#browser').val(); - if (value !== 'slx-browser') { - $('.b0-h').show(); - } else { - $('.b0-h').hide(); - } + var $lgis = $('#browser-specific > .list-group-item'); + $lgis.filter(':not(.show-' + value + ')').hide(); + $lgis.filter('.show-' + value).show(); } // Add another bookmark input field to the form |