diff options
Diffstat (limited to 'modules-available/locationinfo/inc/locationinfohooks.inc.php')
-rw-r--r-- | modules-available/locationinfo/inc/locationinfohooks.inc.php | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/modules-available/locationinfo/inc/locationinfohooks.inc.php b/modules-available/locationinfo/inc/locationinfohooks.inc.php index 8e4975e9..8ec217cc 100644 --- a/modules-available/locationinfo/inc/locationinfohooks.inc.php +++ b/modules-available/locationinfo/inc/locationinfohooks.inc.php @@ -5,9 +5,9 @@ class LocationInfoHooks /** * @param string $uuid panel uuid - * @return bool|string panel name if exists, false otherwise + * @return false|string panel name if exists, false otherwise */ - public static function getPanelName($uuid) + public static function getPanelName(string $uuid) { $ret = Database::queryFirst('SELECT panelname FROM locationinfo_panel WHERE paneluuid = :uuid', compact('uuid')); if ($ret === false) @@ -18,14 +18,11 @@ class LocationInfoHooks /** * Hook called by runmode module where we should modify the client config according to our * needs. Disable standby/logout timeouts, enable autologin, set URL. - * - * @param $machineUuid - * @param $panelUuid */ - public static function configHook($machineUuid, $panelUuid) + public static function configHook(string $machineUuid, string $panelUuid): void { $type = InfoPanel::getConfig($panelUuid, $data); - if ($type === false) + 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.) @@ -51,7 +48,7 @@ class LocationInfoHooks RunMode::updateClientFlag($machineUuid, 'locationinfo', true); } else { // Automatic login RunMode::updateClientFlag($machineUuid, 'locationinfo', false); - ConfigHolder::add('SLX_AUTOLOGIN', '1', 1000); + ConfigHolder::add('SLX_AUTOLOGIN', 'ON', 1000); ConfigHolder::add('SLX_ADDONS', '', 1000); } if (!empty($data['browser'])) { @@ -72,13 +69,19 @@ class LocationInfoHooks if ($data['allow-tty'] === 'yes' || $data['allow-tty'] === 'no') { ConfigHolder::add('SLX_TTY_SWITCH', $data['allow-tty'], 1000); } + if (($data['zoom-factor'] ?? 100) != 100) { + ConfigHolder::add('SLX_BROWSER_ZOOM', $data['zoom-factor']); + } } else { // Not URL panel ConfigHolder::add('SLX_BROWSER_URL', 'http://' . $_SERVER['SERVER_ADDR'] . '/panel/' . $panelUuid); - ConfigHolder::add('SLX_BROWSER_INSECURE', '1'); // TODO: Sat server might redirect to HTTPS, which in turn could have a self-signed cert - push to client - ConfigHolder::add('SLX_AUTOLOGIN', '1', 1000); + ConfigHolder::add('SLX_AUTOLOGIN', 'ON', 1000); ConfigHolder::add('SLX_ADDONS', '', 1000); } + $al = ConfigHolder::get('SLX_AUTOLOGIN'); + if (!empty($al) && $al !== 'OFF' && $al != 0) { + ConfigHolder::add('SLX_SHUTDOWN_TIMEOUT', '', 1000); + } ConfigHolder::add('SLX_LOGOUT_TIMEOUT', '', 1000); ConfigHolder::add('SLX_SCREEN_STANDBY_TIMEOUT', '', 1000); ConfigHolder::add('SLX_SYSTEM_STANDBY_TIMEOUT', '', 1000); @@ -87,10 +90,8 @@ class LocationInfoHooks /** * Turn multiline list into space separated list, removing any * comments (starting with #) - * @param string $list - * @return string */ - private static function mangleList($list) + private static function mangleList(string $list): string { return preg_replace('/\s*(#[^\n]*)?(\n|$)/', ' ', $list); } |