feat: adds spaceapi endpoint #57
@ -198,6 +198,10 @@ in
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools."pvv-nettsiden".socket};
|
||||
'';
|
||||
|
||||
"= /spaceapi.php".extraConfig = ''
|
||||
add_header Content-Type application/json;
|
||||
'';
|
||||
|
||||
# based on https://simplesamlphp.org/docs/stable/simplesamlphp-install.html#configuring-nginx
|
||||
"^~ /simplesaml/" = {
|
||||
alias = "${finalPackage}/${finalPackage.passthru.simplesamlphpPath}/public/";
|
||||
|
68
www/spaceapi.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?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_compatibility": ["14"],
|
||||
"space": "Programvareverkstedet",
|
||||
"logo": "https://git.pvv.ntnu.no/assets/img/logo.png",
|
||||
"url": "https://www.pvv.ntnu.no/",
|
||||
oysteikt marked this conversation as resolved
Outdated
|
||||
"location": {
|
||||
"ext_campus": "NTNU Gløshaugen",
|
||||
"ext_room_name": "Oppredning/Gruvedrift, Floor 2, Room 247",
|
||||
"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
|
||||
felixalb marked this conversation as resolved
Outdated
oysteikt
commented
Should this be Should this be `irc://irc.pvv.ntnu.no/pvv` maybe?
|
||||
},
|
||||
oysteikt marked this conversation as resolved
oysteikt
commented
Should we add Should we add `issue_mail`?
|
||||
"contact": {
|
||||
"irc": "irc://irc.pvv.ntnu.no/pvv",
|
||||
"email": "pvv@pvv.ntnu.no",
|
||||
"ext_discord": "https://discord.gg/8VTBr6Q",
|
||||
"gopher": "gopher://isvegg.pvv.ntnu.no",
|
||||
"matrix": "#pvv:pvv.ntnu.no"
|
||||
},
|
||||
"issue_report_channels": ["email"],
|
||||
oysteikt marked this conversation as resolved
oysteikt
commented
Maybe add a message, just in case anyone is wondering
Maybe add a message, just in case anyone is wondering
```json
"message": "Open for public when members are present"
```
|
||||
"state": {
|
||||
"open": <?php echo($doorEntry->open ? "true" : "false"); ?>,
|
||||
"lastchange": <?php echo($doorEntry->time ? $doorEntry->time : 0); ?>,
|
||||
"message": "<?php echo($doorEntry->open ? "open for public, members are present" : "closed"); ?>"
|
||||
},
|
||||
"feeds": {
|
||||
"wiki": {
|
||||
felixalb marked this conversation as resolved
Outdated
oysteikt
commented
Maybe add Maybe add `calender` https://www.pvv.ntnu.no/hendelser/?
felixalb
commented
That link is neither RSS nor ical, so that i don't think that's allowed per https://spaceapi.io/docs/. Ical support on the website would be amazing though, but surprisingly difficult to implement due to our terrible event system. That link is neither RSS nor ical, so that i don't think that's allowed per https://spaceapi.io/docs/. Ical support on the website would be amazing though, but surprisingly difficult to implement due to our terrible event system.
felixalb
commented
I added the /hendelser/-page to "links" for now. I added the /hendelser/-page to "links" for now.
oysteikt
commented
No, I do think we could add it under calendar. The No, I do think we could add it under calendar. The `type` being `rss`, `atom` or `ical` are just being provided as examples. We could set `"type": "html"` and still be compliant.
|
||||
"type": "atom",
|
||||
"url": "https://www.pvv.ntnu.no/w/api.php?hidebots=1&urlversion=1&action=feedrecentchanges&feedformat=atom"
|
||||
},
|
||||
"calendar": {
|
||||
"type": "html",
|
||||
felixalb marked this conversation as resolved
Outdated
oysteikt
commented
Should we add links to other official medias, like youtube, facebook or linkedin using Should we add links to other official medias, like youtube, facebook or linkedin using `links`?
felixalb
commented
Not right there, under projects
But we could make a list of
The list you recommended seems good 👍 Not right there, under projects
> "projects": Your project sites (links to GitHub, wikis or wherever your projects are hosted)
But we could make a list of
> "links": Arbitrary links that you'd like to share
The list you recommended seems good 👍
oysteikt
commented
Thanks, that was what I meant. Not sure where else to comment Thanks, that was what I meant. Not sure where else to comment
|
||||
"url": "https://www.pvv.ntnu.no/hendelser/"
|
||||
}
|
||||
},
|
||||
"projects": [
|
||||
"https://github.com/Programvareverkstedet/",
|
||||
"https://git.pvv.ntnu.no/",
|
||||
"https://www.pvv.ntnu.no/prosjekt/"
|
||||
],
|
||||
"links": [
|
||||
{
|
||||
"name": "YouTube",
|
||||
"url": "https://www.youtube.com/@pvvntnu5640"
|
||||
},
|
||||
{
|
||||
"name": "LinkedIn",
|
||||
"url": "https://www.linkedin.com/company/pvvntnu/"
|
||||
},
|
||||
{
|
||||
"name": "Facebook",
|
||||
"url": "https://www.facebook.com/pvvntnu/"
|
||||
}
|
||||
]
|
||||
}
|
We could potentially use https://git.pvv.ntnu.no/assets/img/logo.svg instead