From 51f8fe5bdea2358959b6d6e624454cdb6e612a67 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 14 Jan 2021 18:51:19 -0700 Subject: [PATCH 1/2] Update ApiV1Controller --- app/Http/Controllers/Api/ApiV1Controller.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 2ecd3ed05..96c37b044 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -1435,13 +1435,15 @@ class ApiV1Controller extends Controller $limit = $request->input('limit') ?? 3; $user = $request->user(); - $key = 'user:last_active_at:id:'.$user->id; - $ttl = now()->addMinutes(5); - Cache::remember($key, $ttl, function() use($user) { - $user->last_active_at = now(); - $user->save(); - return; - }); + if($user) { + $key = 'user:last_active_at:id:'.$user->id; + $ttl = now()->addMinutes(5); + Cache::remember($key, $ttl, function() use($user) { + $user->last_active_at = now(); + $user->save(); + return; + }); + } if($min || $max) { $dir = $min ? '>' : '<'; From 36a722aa3cf3050c4b433ec07962db6a8b8290c7 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 14 Jan 2021 18:54:13 -0700 Subject: [PATCH 2/2] Update InboxValidator --- app/Jobs/InboxPipeline/InboxValidator.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Jobs/InboxPipeline/InboxValidator.php b/app/Jobs/InboxPipeline/InboxValidator.php index 82aac7861..ab153e384 100644 --- a/app/Jobs/InboxPipeline/InboxValidator.php +++ b/app/Jobs/InboxPipeline/InboxValidator.php @@ -80,7 +80,8 @@ class InboxValidator implements ShouldQueue $headers, $payload, $actor, - $hash + $hash, + $profile ) { $key = 'ap:inbox:actor-delete-exists:' . $hash; $actorDelete = Cache::remember($key, now()->addMinutes(15), function() use($actor) { @@ -89,7 +90,7 @@ class InboxValidator implements ShouldQueue ->exists(); }); if($actorDelete) { - if($this->verifySignature($headers, $payload) == true) { + if($this->verifySignature($headers, $profile, $payload) == true) { Cache::set($key, false); $profile = Profile::whereNotNull('domain') ->whereNull('status')