mirror of
https://github.com/unraid/api.git
synced 2026-01-06 16:49:49 -06:00
improve: state.php ensure UPC in consistent state
This commit is contained in:
@@ -77,23 +77,19 @@ $key_contents = str_replace(['+','/','='], ['-','_',''], trim(base64_encode(@fil
|
||||
if (file_exists('/boot/config/plugins/dynamix/dynamix.cfg')) {
|
||||
extract(parse_ini_file('/boot/config/plugins/dynamix/dynamix.cfg',true));
|
||||
}
|
||||
if (empty($remote)) {
|
||||
$remote = [
|
||||
"apikey" => "",
|
||||
"username" => "",
|
||||
"avatar" => "",
|
||||
"wanaccess" => "no",
|
||||
"wanport" => "443"
|
||||
];
|
||||
}
|
||||
if (empty($remote['username'])) {
|
||||
$remote['username'] = '';
|
||||
}
|
||||
if (empty($remote['avatar'])) {
|
||||
$remote['avatar'] = '';
|
||||
}
|
||||
|
||||
$arr = [];
|
||||
if (empty($remote['apikey']) || empty($var['regFILE']) || empty($remote['username']) || empty($remote['avatar'])) {
|
||||
$arr['registered'] = 0;
|
||||
$arr['username'] = '';
|
||||
$arr['avatar'] = '';
|
||||
$arr['apikey'] = '';
|
||||
} else {
|
||||
$arr['registered'] = 1;
|
||||
$arr['username'] = $remote['username'];
|
||||
$arr['avatar'] = $remote['avatar'];
|
||||
$arr['apikey'] = $remote['apikey'];
|
||||
}
|
||||
$arr['event'] = 'STATE';
|
||||
$arr['ts'] = time();
|
||||
$arr['deviceCount'] = $var['deviceCount'];
|
||||
@@ -108,11 +104,7 @@ $arr['serverip'] = $_SERVER['SERVER_ADDR'];
|
||||
$arr['internalip'] = $_SERVER['SERVER_ADDR'];
|
||||
$arr['internalport'] = $_SERVER['SERVER_PORT'];
|
||||
$arr['protocol'] = $_SERVER['REQUEST_SCHEME'];
|
||||
$arr['registered'] = empty($remote['apikey']) || empty($var['regFILE']) ? 0 : 1;
|
||||
$arr['username'] = $remote['username'];
|
||||
$arr['avatar'] = $remote['avatar'];
|
||||
$arr['locale'] = $_SESSION['locale'] ? $_SESSION['locale'] : 'en_US';
|
||||
$arr['apikey'] = $remote['apikey'];
|
||||
|
||||
echo json_encode($arr);
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user