Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko259 committed Sep 11, 2024
2 parents a1af0c1 + fa0e4f4 commit 1724dbf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions app/Http/Middleware/ApiToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,15 @@ public function handle(Request $request, Closure $next, $args = ''): Response

if($key === null || ($args == 'edit' && $key->readonly == true))
{
return response()->json([
'message' => 'Unauthorized',
], 401);
// Exception for open calendar fetch
if (preg_match('/^\/api\/calendars\/\d+\/events$/', $request->getRequestUri())) {
$request->attributes->set('unauthenticated', true);
return $next($request);
} else {
return response()->json([
'message' => 'Unauthorized',
], 401);
}
}

$key->update(['last_used_at', now()]);
Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
|
*/
/* x-release-please-start-version */
'version' => '1.0.1',
'version' => '1.0.2',
/* x-release-please-end */

/*
Expand Down

0 comments on commit 1724dbf

Please sign in to comment.