fix: combinedKnownOrigins in state.php for UPC

This commit is contained in:
Zack Spear
2023-12-11 19:37:20 -05:00
committed by Zack Spear
parent 735db3d5f5
commit 519c24983a

View File

@@ -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);
}
}
}