Update docker/ui.php

Co-authored-by: qodo-merge-pro-for-open-source[bot] <189517486+qodo-merge-pro-for-open-source[bot]@users.noreply.github.com>
This commit is contained in:
sstidl 2024-12-29 17:49:51 +01:00 committed by GitHub
parent fe85a805ac
commit 0274f6e587
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -14,7 +14,12 @@ $mode=getenv("MODE");
if($mode=="standalone" || $mode=="backend"){ ?>
var SPEEDTEST_SERVERS=[];
<?php } elseif ($mode=="dual") {
$servers = json_decode(file_get_contents('/servers.json'), true);
$jsonContent = @file_get_contents('/servers.json');
if ($jsonContent === false) {
$servers = [];
} else {
$servers = json_decode($jsonContent, true) ?: [];
}
// find out my own URL
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";