diff --git a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/sso-login.php b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/sso-login.php
index a964e066c..cfe8d5833 100644
--- a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/sso-login.php
+++ b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/sso-login.php
@@ -18,5 +18,5 @@ echo $wcExtractor->getScriptTagHtml();
?>
" . json_encode($this->webguiGlobals, JSON_PRETTY_PRINT) . ""; $this->var = (array)parse_ini_file('state/var.ini'); @@ -123,7 +124,8 @@ class ServerState /** * Retrieve the value of a webgui global setting. */ - public function getWebguiGlobal(string $key, string $subkey = null) { + public function getWebguiGlobal(string $key, string $subkey = null) + { if (!$subkey) { return _var($this->webguiGlobals, $key, ''); } @@ -131,7 +133,8 @@ class ServerState return _var($keyArray, $subkey, ''); } - private function setConnectValues() { + private function setConnectValues() + { if (file_exists('/var/lib/pkgtools/packages/dynamix.unraid.net')) { $this->connectPluginInstalled = 'dynamix.unraid.net.plg'; } @@ -158,13 +161,15 @@ class ServerState $this->getFlashBackupStatus(); } - private function getFlashBackupStatus() { + private function getFlashBackupStatus() + { $flashbackupCfg = '/var/local/emhttp/flashbackup.ini'; $this->flashbackupStatus = (file_exists($flashbackupCfg)) ? @parse_ini_file($flashbackupCfg) : []; $this->flashBackupActivated = empty($this->flashbackupStatus['activated']) ? '' : 'true'; } - private function getMyServersCfgValues() { + private function getMyServersCfgValues() + { /** * @todo can we read this from somewhere other than the flash? Connect page uses this path and /boot/config/plugins/dynamix.my.servers/myservers.cfg… * - $myservers_memory_cfg_path ='/var/local/emhttp/myservers.cfg'; @@ -197,10 +202,11 @@ class ServerState $this->registered = !empty($this->myServersFlashCfg['remote']['apikey']) && $this->connectPluginInstalled; $this->registeredTime = $this->myServersFlashCfg['remote']['regWizTime'] ?? ''; $this->username = $this->myServersFlashCfg['remote']['username'] ?? ''; - $this->ssoSubIds = $this->myServersFlashCfg['remote']['ssoSubIds'] ?? ''; + $this->ssoEnabled = $this->myServersFlashCfg['remote']['ssoSubIds'] !== ''; } - private function getConnectKnownOrigins() { + private function getConnectKnownOrigins() + { /** * Allowed origins warning displayed when the current webGUI URL is NOT included in the known lists of allowed origins. * Include localhost in the test, but only display HTTP(S) URLs that do not include localhost. @@ -208,7 +214,7 @@ class ServerState $this->host = $_SERVER['HTTP_HOST'] ?? "unknown"; $memoryCfgPath = '/var/local/emhttp/myservers.cfg'; $this->myServersMemoryCfg = (file_exists($memoryCfgPath)) ? @parse_ini_file($memoryCfgPath) : []; - $this->myServersMiniGraphConnected = (($this->myServersMemoryCfg['minigraph']??'') === 'CONNECTED'); + $this->myServersMiniGraphConnected = (($this->myServersMemoryCfg['minigraph'] ?? '') === 'CONNECTED'); $allowedOrigins = $this->myServersMemoryCfg['allowedOrigins'] ?? ""; $extraOrigins = $this->myServersFlashCfg['api']['extraOrigins'] ?? ""; @@ -224,8 +230,8 @@ class ServerState $this->combinedKnownOrigins = explode(",", $combinedOrigins); if ($this->combinedKnownOrigins) { - foreach($this->combinedKnownOrigins as $key => $origin) { - if ( (strpos($origin, "http") === false) || (strpos($origin, "localhost") !== false) ) { + foreach ($this->combinedKnownOrigins as $key => $origin) { + if ((strpos($origin, "http") === false) || (strpos($origin, "localhost") !== false)) { // clean up $this->combinedKnownOrigins, only display warning if origins still remain to display unset($this->combinedKnownOrigins[$key]); } @@ -238,7 +244,8 @@ class ServerState } } - private function detectActivationCode() { + private function detectActivationCode() + { // Fresh server and we're not loading with a callback param to install if ($this->state !== 'ENOKEYFILE' || !empty($_GET['c'])) { return; @@ -312,6 +319,7 @@ class ServerState "registered" => $this->registered, "registeredTime" => $this->registeredTime, "site" => _var($_SERVER, 'REQUEST_SCHEME') . "://" . _var($_SERVER, 'HTTP_HOST'), + "ssoEnabled" => $this->ssoEnabled, "state" => $this->state, "theme" => [ "banner" => !empty($this->getWebguiGlobal('display', 'banner')), @@ -326,7 +334,6 @@ class ServerState "uptime" => 1000 * (time() - round(strtok(exec("cat /proc/uptime"), ' '))), "username" => $this->username, "wanFQDN" => @$this->nginxCfg['NGINX_WANFQDN'] ?? '', - "ssoSubIds" => $this->ssoSubIds ]; if ($this->combinedKnownOrigins) { @@ -357,7 +364,8 @@ class ServerState * * @return string */ - public function getServerStateJson() { + public function getServerStateJson() + { return json_encode($this->getServerState()); } @@ -366,7 +374,8 @@ class ServerState * * @return string */ - public function getServerStateJsonForHtmlAttr() { + public function getServerStateJsonForHtmlAttr() + { $json = json_encode($this->getServerState()); return htmlspecialchars($json, ENT_QUOTES, 'UTF-8'); } diff --git a/web/_data/serverState.ts b/web/_data/serverState.ts index 05abb341a..a1c4e91f6 100644 --- a/web/_data/serverState.ts +++ b/web/_data/serverState.ts @@ -181,7 +181,7 @@ export const serverState: Server = { regExp, regGuid, site: 'http://localhost:4321', - ssoSubIds: '1234567890,0987654321,297294e2-b31c-4bcc-a441-88aee0ad609f', + ssoEnabled: true, state, theme: { banner: false, diff --git a/web/components/SsoButton.ce.vue b/web/components/SsoButton.ce.vue index 8be9d48ef..a0e939689 100644 --- a/web/components/SsoButton.ce.vue +++ b/web/components/SsoButton.ce.vue @@ -3,7 +3,7 @@ import Button from '~/components/Brand/Button.vue'; import { ACCOUNT } from '~/helpers/urls'; export interface Props { - subids?: string; + ssoenabled?: boolean; } const props = defineProps