From ef36a72e7d0735cb299fdf69e63614c48a855bfa Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Thu, 8 Jul 2021 17:43:51 +0100 Subject: Allow cors in bookmarklet --- public/bookmarks/add/index.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'public') diff --git a/public/bookmarks/add/index.php b/public/bookmarks/add/index.php index 7df8ced..835fa64 100644 --- a/public/bookmarks/add/index.php +++ b/public/bookmarks/add/index.php @@ -2,10 +2,18 @@ error_reporting(E_ALL); + require_once(__DIR__.'/../../../includes/functions.php'); $config = require_once(__DIR__.'/../../../config.php'); +if ('OPTIONS' === filter_input(INPUT_SERVER, 'REQUEST_METHOD')) { + respondAndExit(200, 'OK', [ + 'Access-Control-Allow-Methods: POST', + 'Access-Control-Allow-Headers: Content-Type, Authorization', + ]); +} + if ('POST' !== filter_input(INPUT_SERVER, 'REQUEST_METHOD')) { respondAndExit(405, 'Method Not Allowed'); } -- cgit v1.2.3-13-gbd6f