blob: 91a611f4cbb12f6bde1d2ff6af118b5e4674716d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<?php
use Digitigrade\HttpResponseStatus\Unauthorized;
use Digitigrade\Model\Instance;
use Digitigrade\Router;
Router::getInstance()->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"
});
|