Skip to content

Commit 8888587

Browse files
committed
replace myserversCfg['remote'] with connect.json in state.php
1 parent dea0f44 commit 8888587

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

  • plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include

plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -179,32 +179,35 @@ private function getMyServersCfgValues()
179179
*/
180180
$flashCfgPath = '/boot/config/plugins/dynamix.my.servers/myservers.cfg';
181181
$this->myServersFlashCfg = file_exists($flashCfgPath) ? @parse_ini_file($flashCfgPath, true) : [];
182+
$connectJsonPath = '/boot/config/plugins/dynamix.my.servers/configs/connect.json';
183+
$connectConfig = file_exists($connectJsonPath) ? @json_decode(file_get_contents($connectJsonPath), true) : [];
184+
182185
// ensure some vars are defined here so we don't have to test them later
183-
if (empty($this->myServersFlashCfg['remote']['apikey'])) {
184-
$this->myServersFlashCfg['remote']['apikey'] = "";
186+
if (empty($connectConfig['apikey'])) {
187+
$connectConfig['apikey'] = "";
185188
}
186-
if (empty($this->myServersFlashCfg['remote']['wanaccess'])) {
187-
$this->myServersFlashCfg['remote']['wanaccess'] = "no";
189+
if (empty($connectConfig['wanaccess'])) {
190+
$connectConfig['wanaccess'] = false;
188191
}
189-
if (empty($this->myServersFlashCfg['remote']['wanport'])) {
190-
$this->myServersFlashCfg['remote']['wanport'] = 33443;
192+
if (empty($connectConfig['wanport'])) {
193+
$connectConfig['wanport'] = 33443;
191194
}
192-
if (empty($this->myServersFlashCfg['remote']['upnpEnabled'])) {
193-
$this->myServersFlashCfg['remote']['upnpEnabled'] = "no";
195+
if (empty($connectConfig['upnpEnabled'])) {
196+
$connectConfig['upnpEnabled'] = false;
194197
}
195-
if (empty($this->myServersFlashCfg['remote']['dynamicRemoteAccessType'])) {
196-
$this->myServersFlashCfg['remote']['dynamicRemoteAccessType'] = "DISABLED";
198+
if (empty($connectConfig['dynamicRemoteAccessType'])) {
199+
$connectConfig['dynamicRemoteAccessType'] = "DISABLED";
197200
}
198201

199202
$this->apiKey = $this->myServersFlashCfg['upc']['apikey'] ?? '';
200203
$this->apiVersion = $this->myServersFlashCfg['api']['version'] ?? '';
201-
$this->avatar = (!empty($this->myServersFlashCfg['remote']['avatar']) && $this->connectPluginInstalled) ? $this->myServersFlashCfg['remote']['avatar'] : '';
202-
$this->email = $this->myServersFlashCfg['remote']['email'] ?? '';
203-
$this->hasRemoteApikey = !empty($this->myServersFlashCfg['remote']['apikey']);
204-
$this->registered = !empty($this->myServersFlashCfg['remote']['apikey']) && $this->connectPluginInstalled;
205-
$this->registeredTime = $this->myServersFlashCfg['remote']['regWizTime'] ?? '';
206-
$this->username = $this->myServersFlashCfg['remote']['username'] ?? '';
207-
$this->ssoEnabled = !empty($this->myServersFlashCfg['remote']['ssoSubIds'] ?? '');
204+
$this->avatar = (!empty($connectConfig['avatar']) && $this->connectPluginInstalled) ? $connectConfig['avatar'] : '';
205+
$this->email = $connectConfig['email'] ?? '';
206+
$this->hasRemoteApikey = !empty($connectConfig['apikey']);
207+
$this->registered = !empty($connectConfig['apikey']) && $this->connectPluginInstalled;
208+
$this->registeredTime = $connectConfig['regWizTime'] ?? '';
209+
$this->username = $connectConfig['username'] ?? '';
210+
$this->ssoEnabled = !empty($connectConfig['ssoSubIds'] ?? '');
208211
}
209212

210213
private function getConnectKnownOrigins()

0 commit comments

Comments
 (0)