Merge pull request #3319 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-03-16 20:23:49 -06:00 committed by GitHub
commit 19192a2e3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 51 deletions

View file

@ -5,6 +5,7 @@ namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\{Media, Status};
use Carbon\Carbon;
use App\Services\MediaStorageService;
class MediaGarbageCollector extends Command
{
@ -41,8 +42,8 @@ class MediaGarbageCollector extends Command
{
$limit = 20000;
$gc = Media::doesntHave('status')
->where('created_at', '<', Carbon::now()->subHours(1)->toDateTimeString())
$gc = Media::whereNull('status_id')
->where('created_at', '<', Carbon::now()->subHours(12)->toDateTimeString())
->orderBy('created_at','asc')
->take($limit)
->get();
@ -50,14 +51,7 @@ class MediaGarbageCollector extends Command
$bar = $this->output->createProgressBar($gc->count());
$bar->start();
foreach($gc as $media) {
$path = storage_path("app/$media->media_path");
$thumb = storage_path("app/$media->thumbnail_path");
if(is_file($path)) {
unlink($path);
}
if(is_file($thumb)) {
unlink($thumb);
}
MediaStorageService::delete($media);
$media->forceDelete();
$bar->advance();
}

View file

@ -223,6 +223,9 @@ class InboxValidator implements ShouldQueue
'User-Agent' => 'PixelfedBot v0.1 - https://pixelfed.org',
])->get($actor->remote_url);
$res = json_decode($res->body(), true, 8);
if(!$res || empty($res) || !isset($res['publicKey']) || !isset($res['publicKey']['id'])) {
return;
}
if($res['publicKey']['id'] !== $actor->key_id) {
return;
}

View file

@ -211,6 +211,9 @@ class InboxWorker implements ShouldQueue
'User-Agent' => 'PixelfedBot v0.1 - https://pixelfed.org',
])->get($actor->remote_url);
$res = json_decode($res->body(), true, 8);
if(!$res || empty($res) || !isset($res['publicKey']) || !isset($res['publicKey']['id'])) {
return;
}
if($res['publicKey']['id'] !== $actor->key_id) {
return;
}

Binary file not shown.

Binary file not shown.