From c58caced838a9a7954e7fefa60c01567bb6bc107 Mon Sep 17 00:00:00 2001 From: winter Date: Tue, 17 Dec 2024 21:04:20 +0000 Subject: winter REPORTEDLY forgot to implement subscribe routes --- routes/subscribe.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'routes/subscribe.php') diff --git a/routes/subscribe.php b/routes/subscribe.php index c18d484..91a611f 100644 --- a/routes/subscribe.php +++ b/routes/subscribe.php @@ -1,11 +1,23 @@ mount('/subscribe', function (array $args) { - + $instance = Instance::findByRequestHeaders(); + if ($instance == null) { + throw new Unauthorized(); + } + $instance->auth->outboundPushEnabled = true; + http_response_code(204); // "No Content" }); Router::getInstance()->mount('/unsubscribe', function (array $args) { - + $instance = Instance::findByRequestHeaders(); + if ($instance == null) { + throw new Unauthorized(); + } + $instance->auth->outboundPushEnabled = false; + http_response_code(204); // "No Content" }); \ No newline at end of file -- cgit v1.3