summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo
diff options
context:
space:
mode:
authorSimon Rettberg2019-11-12 11:31:46 +0100
committerSimon Rettberg2019-11-12 11:31:46 +0100
commitdd48d827a1bffe3825ecc2a34bedb7a641d92613 (patch)
treeeabab6cd99a9973b2db947b29c3529ca42958fd0 /modules-available/locationinfo
parent[statistics] FIX STUFF (diff)
downloadslx-admin-dd48d827a1bffe3825ecc2a34bedb7a641d92613.tar.gz
slx-admin-dd48d827a1bffe3825ecc2a34bedb7a641d92613.tar.xz
slx-admin-dd48d827a1bffe3825ecc2a34bedb7a641d92613.zip
[sysconfig/runmode] Remove "noSysconfig" functionality
Was of limited use and not properly implemented anyways.
Diffstat (limited to 'modules-available/locationinfo')
-rw-r--r--modules-available/locationinfo/hooks/runmode/config.json5
-rw-r--r--modules-available/locationinfo/inc/locationinfo.inc.php45
-rw-r--r--modules-available/locationinfo/inc/locationinfohooks.inc.php53
3 files changed, 55 insertions, 48 deletions
diff --git a/modules-available/locationinfo/hooks/runmode/config.json b/modules-available/locationinfo/hooks/runmode/config.json
index 4bba0b5f..d94165ca 100644
--- a/modules-available/locationinfo/hooks/runmode/config.json
+++ b/modules-available/locationinfo/hooks/runmode/config.json
@@ -1,8 +1,7 @@
{
- "getModeName": "LocationInfo::getPanelName",
+ "getModeName": "LocationInfoHooks::getPanelName",
"isClient": false,
- "configHook": "LocationInfo::configHook",
- "noSysconfig": true,
+ "configHook": "LocationInfoHooks::configHook",
"systemdDefaultTarget": "kiosk-mode",
"permission": ".locationinfo.panel.assign-client"
} \ No newline at end of file
diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php
index 23a20a94..d5fec3aa 100644
--- a/modules-available/locationinfo/inc/locationinfo.inc.php
+++ b/modules-available/locationinfo/inc/locationinfo.inc.php
@@ -126,49 +126,4 @@ class LocationInfo
return array();
}
- /**
- * @param string $uuid panel uuid
- * @return bool|string panel name if exists, false otherwise
- */
- public static function getPanelName($uuid)
- {
- $ret = Database::queryFirst('SELECT panelname FROM locationinfo_panel WHERE paneluuid = :uuid', compact('uuid'));
- if ($ret === false) return false;
- return $ret['panelname'];
- }
-
- /**
- * 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)
- {
- $type = InfoPanel::getConfig($panelUuid, $data);
- if ($type === false)
- 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);
- }
- ConfigHolder::add('SLX_BROWSER_URL', $data['url']);
- ConfigHolder::add('SLX_BROWSER_URLLIST', $data['urllist']);
- ConfigHolder::add('SLX_BROWSER_IS_WHITELIST', $data['iswhitelist']);
- } 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_ADDONS', '', 1000);
- ConfigHolder::add('SLX_LOGOUT_TIMEOUT', '', 1000);
- ConfigHolder::add('SLX_SCREEN_STANDBY_TIMEOUT', '', 1000);
- ConfigHolder::add('SLX_SYSTEM_STANDBY_TIMEOUT', '', 1000);
- ConfigHolder::add('SLX_AUTOLOGIN', '1', 1000);
- }
-
}
diff --git a/modules-available/locationinfo/inc/locationinfohooks.inc.php b/modules-available/locationinfo/inc/locationinfohooks.inc.php
new file mode 100644
index 00000000..09489015
--- /dev/null
+++ b/modules-available/locationinfo/inc/locationinfohooks.inc.php
@@ -0,0 +1,53 @@
+<?php
+
+class LocationInfoHooks
+{
+
+ /**
+ * @param string $uuid panel uuid
+ * @return bool|string panel name if exists, false otherwise
+ */
+ public static function getPanelName($uuid)
+ {
+ $ret = Database::queryFirst('SELECT panelname FROM locationinfo_panel WHERE paneluuid = :uuid', compact('uuid'));
+ if ($ret === false)
+ return false;
+ return $ret['panelname'];
+ }
+
+ /**
+ * 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)
+ {
+ $type = InfoPanel::getConfig($panelUuid, $data);
+ if ($type === false)
+ 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);
+ }
+ ConfigHolder::add('SLX_BROWSER_URL', $data['url']);
+ ConfigHolder::add('SLX_BROWSER_URLLIST', $data['urllist']);
+ ConfigHolder::add('SLX_BROWSER_IS_WHITELIST', $data['iswhitelist']);
+ } 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_ADDONS', '', 1000);
+ ConfigHolder::add('SLX_LOGOUT_TIMEOUT', '', 1000);
+ ConfigHolder::add('SLX_SCREEN_STANDBY_TIMEOUT', '', 1000);
+ ConfigHolder::add('SLX_SYSTEM_STANDBY_TIMEOUT', '', 1000);
+ ConfigHolder::add('SLX_AUTOLOGIN', '1', 1000);
+ }
+
+} \ No newline at end of file