mirror of
https://codeberg.org/vlw/victorwesterlund.com.git
synced 2025-09-14 03:23:41 +02:00
Added status checker endpoint for Shields.io under "status.php" Added router.php and reference in server.conf Removed ping.php
32 lines
No EOL
540 B
PHP
32 lines
No EOL
540 B
PHP
<?php
|
|
|
|
header("Content-Type: application/json");
|
|
|
|
$api = $_GET["api"];
|
|
|
|
function response($online = false) {
|
|
$isError = $online ? true : false;
|
|
$message = $online ? "Online" : "Offline";
|
|
$color = $online ? "green" : "lightgrey";
|
|
|
|
$response = [
|
|
"schemaVersion" => 1,
|
|
"label" => "API",
|
|
"message" => $message,
|
|
"color" => $color,
|
|
"isError" => $isError
|
|
];
|
|
|
|
echo json_encode($response);
|
|
}
|
|
|
|
function getStatus() {
|
|
if(!is_dir($api)) {
|
|
response(false);
|
|
return false;
|
|
}
|
|
|
|
response(true);
|
|
}
|
|
|
|
getStatus(); |