false, 'error' => 'login_required', ], 401); } if (($_SERVER['REQUEST_METHOD'] ?? 'GET') !== 'POST') { json_out([ 'ok' => false, 'error' => 'method_not_allowed', ], 405); } require_csrf(); $subscription = push_subscription_from_json((string)file_get_contents('php://input')); save_push_subscription($subscription); json_out([ 'ok' => true, ]);