feat: adds spaceapi endpoint

This commit is contained in:
Felix Albrigtsen 2024-05-12 03:36:51 +02:00
parent 13a6df92ce
commit a20fae7595
1 changed files with 46 additions and 0 deletions

46
www/spaceapi.php Normal file
View File

@ -0,0 +1,46 @@
<?php
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$door = new \pvv\side\Door($pdo);
$doorEntry = (object)($door->getCurrent());
?>
{
"api": "0.13",
"api_compatibility": ["14"],
"space": "Programvareverkstedet",
"logo": "https://git.pvv.ntnu.no/Drift/pvv-nixos-config/raw/branch/main/assets/logo_blue_regular.png",
"url": "https://www.pvv.ntnu.no/",
"location": {
"address": "Sem Sælands vei 1, 7034 Trondheim, Norway",
"timezone: "Europe/Oslo",
"lon": 10.242,
"lat": 63.250
},
"contact": {
"irc": "//irc.pvv.ntnu.no/pvv",
"email": "pvv@pvv.ntnu.no",
"discord": "https://discord.gg/8VTBr6Q",
"gopher": "gopher://isvegg.pvv.ntnu.no",
"matrix": "#pvv:pvv.ntnu.no"
},
"issue_report_channels": ["email"],
"state": {
"open": <?php echo($doorEntry->open ? "true" : "false"); ?>,
"lastchange": <?php echo($doorEntry->time ? $doorEntry->time : 0); ?>
},
"feeds": {
"wiki": {
"type": "atom",
"url": "https://www.pvv.ntnu.no/w/api.php?hidebots=1&urlversion=1&action=feedrecentchanges&feedformat=atom"
}
},
"projects": [
"https://github.com/Programvareverkstedet/",
"https://git.pvv.ntnu.no/"
]
}