3 Commits

Author SHA1 Message Date
e37785d98a update cordinates in spaceapi 2024-05-19 21:56:00 +02:00
4890a0af04 nix/module: fix spaceapi endpoint 2024-05-19 20:06:22 +02:00
7bf2c31db3 feat: adds spaceapi endpoint ()
A basic implementation of the https://spaceapi.io/ specification.
Tested working door sensor status. Added basic info about us, our website, git forge and wiki.

Co-authored with @sindos and @oysteikt.

Reviewed-on: 
Co-authored-by: Felix Albrigtsen <felix@albrigtsen.it>
Co-committed-by: Felix Albrigtsen <felix@albrigtsen.it>
2024-05-18 20:05:13 +02:00
2 changed files with 6 additions and 6 deletions

@@ -196,9 +196,6 @@ in
include ${pkgs.nginx}/conf/fastcgi_params;
fastcgi_param SCRIPT_FILENAME ${finalPackage}/share/php/pvv-nettsiden/www$fastcgi_script_name;
fastcgi_pass unix:${config.services.phpfpm.pools."pvv-nettsiden".socket};
location = /spaceapi.php {
add_header Content-Type application/json;
}
'';
# based on https://simplesamlphp.org/docs/stable/simplesamlphp-install.html#configuring-nginx

@@ -2,6 +2,9 @@
require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'inc', 'include.php']);
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
$pdo = new \PDO($DB_DSN, $DB_USER, $DB_PASS);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@@ -20,8 +23,8 @@ $doorEntry = (object)($door->getCurrent());
"ext_mazemap": "https://link.mazemap.com/2n2HWa7H",
"address": "Sem Sælands vei 1, 7034 Trondheim, Norway",
"timezone": "Europe/Oslo",
"lon": 10.242,
"lat": 63.250
"lon": 10.4038103,
"lat": 63.417025
},
"contact": {
"irc": "irc://irc.pvv.ntnu.no/pvv",
@@ -39,7 +42,7 @@ $doorEntry = (object)($door->getCurrent());
"feeds": {
"wiki": {
"type": "atom",
"url": "https://www.pvv.ntnu.no/w/api.php?hidebots=1&urlversion=1&action=feedrecentchanges&feedformat=atom"
"url": "https://wiki.pvv.ntnu.no/w/api.php?hidebots=1&urlversion=1&action=feedrecentchanges&feedformat=atom"
},
"calendar": {
"type": "html",