From 519c24983a524e270c5fa8defcef1bd2bf4418ce Mon Sep 17 00:00:00 2001 From: Zack Spear Date: Mon, 11 Dec 2023 19:37:20 -0500 Subject: [PATCH] fix: combinedKnownOrigins in state.php for UPC --- .../emhttp/plugins/dynamix.my.servers/include/state.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php index 273fb307c..ebea80108 100644 --- a/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php +++ b/plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/include/state.php @@ -137,7 +137,6 @@ class ServerState $allowedOrigins = $this->myServersMemoryCfg['allowedOrigins'] ?? ""; $extraOrigins = $this->myServersFlashCfg['api']['extraOrigins'] ?? ""; - // if the current host is not in the allowed origins list and extra origins list, display a warning if (stripos($allowedOrigins.",", "/".$this->host.",") === false && stripos($extraOrigins.",", "/".$this->host.",") === false) { $this->combinedKnownOrigins = explode(", ", $allowedOrigins); @@ -155,6 +154,10 @@ class ServerState unset($this->combinedKnownOrigins[$key]); } } + // for some reason the unset creates an associative array, so reindex the array with just the values. Otherwise we get an object passed to the UPC JS instead of an array. + if ($this->combinedKnownOrigins) { + $this->combinedKnownOrigins = array_values($this->combinedKnownOrigins); + } } }