From 4890a0af045c1f353bcd23002a326a1cd208d417 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 18 May 2024 20:54:05 +0200 Subject: [PATCH] nix/module: fix spaceapi endpoint --- nix/module.nix | 4 ---- www/spaceapi.php | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/nix/module.nix b/nix/module.nix index 1b4c7bd..f278ab9 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -198,10 +198,6 @@ 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/"; diff --git a/www/spaceapi.php b/www/spaceapi.php index 04964a8..2b7ea08 100644 --- a/www/spaceapi.php +++ b/www/spaceapi.php @@ -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); @@ -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",