diff --git a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page index c7f84fd10b..26311afb9c 100644 --- a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page +++ b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page @@ -15,12 +15,29 @@ Tag="globe" */ require_once "$docroot/plugins/dynamix.my.servers/include/state.php"; require_once "$docroot/plugins/dynamix.my.servers/include/api-config.php"; +require_once "$docroot/plugins/dynamix.my.servers/include/connect-config.php"; require_once "$docroot/webGui/include/Wrappers.php"; $serverState = new ServerState(); $keyfile = $serverState->keyfileBase64; -$myServersFlashCfg = $serverState->myServersFlashCfg; +$connectConfig = ConnectConfig::getConfig(); +$legacyRemoteCfg = $serverState->myServersFlashCfg['remote'] ?? []; + +$remoteDynamicRemoteAccessType = $connectConfig['dynamicRemoteAccessType'] ?? ($legacyRemoteCfg['dynamicRemoteAccessType'] ?? null); +$remoteWanAccessRaw = $connectConfig['wanaccess'] ?? ($legacyRemoteCfg['wanaccess'] ?? null); +$remoteUpnpEnabledRaw = $connectConfig['upnpEnabled'] ?? ($legacyRemoteCfg['upnpEnabled'] ?? null); +$remoteWanPortRaw = $connectConfig['wanport'] ?? ($legacyRemoteCfg['wanport'] ?? null); + +$wanaccessEnabled = filter_var($remoteWanAccessRaw, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); +if ($wanaccessEnabled === null) { + $wanaccessEnabled = false; +} +$upnpEnabled = filter_var($remoteUpnpEnabledRaw, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); +if ($upnpEnabled === null) { + $upnpEnabled = false; +} +$remoteWanPort = is_numeric($remoteWanPortRaw) ? (int)$remoteWanPortRaw : 0; $showT2Fa = (file_exists('/boot/config/plugins/dynamix.my.servers/showT2Fa')); @@ -37,9 +54,7 @@ $passwd_result = exec('/usr/bin/passwd --status root'); $boolWebUIAuth = $isRegistered && (($passwd_result !== false) && (substr($passwd_result, 0, 6) == 'root P')); // Helper to determine the current value for the remote access input -$dynamicRemoteAccessType = $myServersFlashCfg['remote']['dynamicRemoteAccessType'] ?? null; -$upnpEnabled = ($myServersFlashCfg['remote']['upnpEnabled'] ?? null) === 'yes'; -$wanaccessEnabled = ($myServersFlashCfg['remote']['wanaccess'] ?? null) === 'yes'; +$dynamicRemoteAccessType = $remoteDynamicRemoteAccessType ?? null; $currentRemoteAccessValue = 'OFF'; if ($dynamicRemoteAccessType === 'STATIC') { @@ -59,6 +74,12 @@ if ($dynamicRemoteAccessType === 'STATIC') { $enableRemoteT2fa = $showT2Fa && $currentRemoteAccessValue !== 'OFF' && $hasMyUnraidNetCert; $enableLocalT2fa = $showT2Fa && $var['USE_SSL'] === 'auto' && $hasMyUnraidNetCert; $shade="shade-".($display['theme']??'unk'); +$wanAccessOriginal = $remoteWanAccessRaw; +if (is_bool($wanAccessOriginal)) { + $wanAccessOriginal = $wanAccessOriginal ? 'yes' : 'no'; +} elseif (!is_string($wanAccessOriginal)) { + $wanAccessOriginal = ''; +} ?>