add initial fetch of generalsettings on appstart to get password support and mediacentername

This commit is contained in:
2020-07-13 22:56:43 +02:00
parent 537d869338
commit 5662a6e6e5
3 changed files with 64 additions and 15 deletions

View File

@ -18,7 +18,7 @@ if (isset($_POST['action'])) {
if ($r['password'] != "-1") {
$r['passwordEnabled'] = true;
} else {
$r['passwordEnabled'] = true;
$r['passwordEnabled'] = false;
}
echo json_encode($r);
break;
@ -41,5 +41,22 @@ if (isset($_POST['action'])) {
echo '{"success": true}';
}
break;
case "loadInitialData":
$query = "SELECT * from settings";
$result = $conn->query($query);
if ($result->num_rows > 1) {
// todo throw error
}
$r = mysqli_fetch_assoc($result);
if ($r['password'] != "-1") {
$r['passwordEnabled'] = true;
} else {
$r['passwordEnabled'] = false;
}
unset($r['password']);
echo json_encode($r);
break;
}
}