From 399bf5f810d7a08fe780cae359470ed0329d1c19 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 17 Nov 2022 21:02:54 -0700 Subject: [PATCH 1/6] Update HomeSettings controller, bail earlier when attempting to update email that already exists --- app/Http/Controllers/Settings/HomeSettings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Settings/HomeSettings.php b/app/Http/Controllers/Settings/HomeSettings.php index 23d434d30..e8d3d195e 100644 --- a/app/Http/Controllers/Settings/HomeSettings.php +++ b/app/Http/Controllers/Settings/HomeSettings.php @@ -159,7 +159,7 @@ trait HomeSettings public function emailUpdate(Request $request) { $this->validate($request, [ - 'email' => 'required|email', + 'email' => 'required|email|unique:users,email', ]); $changes = false; $email = $request->input('email'); From 55003148d432d0abc7fb7d1b7e101ec373bdc859 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 17 Nov 2022 21:05:21 -0700 Subject: [PATCH 2/6] Update ffmpeg config --- config/laravel-ffmpeg.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/laravel-ffmpeg.php b/config/laravel-ffmpeg.php index 21315f199..44cd1b6eb 100644 --- a/config/laravel-ffmpeg.php +++ b/config/laravel-ffmpeg.php @@ -13,9 +13,9 @@ return [ 'timeout' => 3600, - 'enable_logging' => env('FFMPEG_LOG', false), - - 'set_command_and_error_output_on_exception' => false, + 'log_channel' => env('FFMPEG_LOG_CHANNEL', false), // set to false to completely disable logging 'temporary_files_root' => env('FFMPEG_TEMPORARY_FILES_ROOT', sys_get_temp_dir()), + + 'temporary_files_encrypted_hls' => env('FFMPEG_TEMPORARY_ENCRYPTED_HLS', env('FFMPEG_TEMPORARY_FILES_ROOT', sys_get_temp_dir())), ]; From 8665eab1904fe2416d1d99ba4befb653bbf4d2ef Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 17 Nov 2022 21:28:24 -0700 Subject: [PATCH 3/6] Update ProfileController, cache actor object and atom feed --- app/Http/Controllers/ProfileController.php | 71 +++++++++++++--------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 30957cf28..3f6795d5b 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -187,10 +187,12 @@ class ProfileController extends Controller abort_if(!config_cache('federation.activitypub.enabled'), 404); abort_if($user->domain, 404); - $fractal = new Fractal\Manager(); - $resource = new Fractal\Resource\Item($user, new ProfileTransformer); - $res = $fractal->createData($resource)->toArray(); - return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json'); + return Cache::remember('pf:activitypub:user-object:by-id:' . $user->id, 3600, function() use($user) { + $fractal = new Fractal\Manager(); + $resource = new Fractal\Resource\Item($user, new ProfileTransformer); + $res = $fractal->createData($resource)->toArray(); + return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json'); + }); } public function showAtomFeed(Request $request, $user) @@ -201,36 +203,47 @@ class ProfileController extends Controller abort_if(!$pid, 404); - $profile = AccountService::get($pid); + $profile = AccountService::get($pid, true); abort_if(!$profile || $profile['locked'] || !$profile['local'], 404); - $items = DB::table('statuses') - ->whereProfileId($pid) - ->whereVisibility('public') - ->whereType('photo') - ->orderByDesc('id') - ->take(10) - ->get() - ->map(function($status) { - return StatusService::get($status->id); - }) - ->filter(function($status) { - return $status && - isset($status['account']) && - isset($status['media_attachments']) && - count($status['media_attachments']); - }) - ->values(); - $permalink = config('app.url') . "/users/{$profile['username']}.atom"; - $headers = ['Content-Type' => 'application/atom+xml']; + $data = Cache::remember('pf:atom:user-feed:by-id:' . $profile['id'], 86400, function() use($pid, $profile) { + $items = DB::table('statuses') + ->whereProfileId($pid) + ->whereVisibility('public') + ->whereType('photo') + ->orderByDesc('id') + ->take(10) + ->get() + ->map(function($status) { + return StatusService::get($status->id); + }) + ->filter(function($status) { + return $status && + isset($status['account']) && + isset($status['media_attachments']) && + count($status['media_attachments']); + }) + ->values(); + $permalink = config('app.url') . "/users/{$profile['username']}.atom"; + $headers = ['Content-Type' => 'application/atom+xml']; - if($items && $items->count()) { - $headers['Last-Modified'] = now()->parse($items->first()['created_at'])->toRfc7231String(); - } + if($items && $items->count()) { + $headers['Last-Modified'] = now()->parse($items->first()['created_at'])->toRfc7231String(); + } + + return compact('items', 'permalink', 'headers'); + }); + abort_if(!$data, 404); return response() - ->view('atom.user', compact('profile', 'items', 'permalink')) - ->withHeaders($headers); + ->view('atom.user', + [ + 'profile' => $profile, + 'items' => $data['items'], + 'permalink' => $data['permalink'] + ] + ) + ->withHeaders($data['headers']); } public function meRedirect() From b6c06c4b1d57a7633088463d2de5d47e269b93e0 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 17 Nov 2022 21:53:25 -0700 Subject: [PATCH 4/6] Update NotificationTransformer, fix mediaTag and modLog types --- .../Api/NotificationTransformer.php | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/Transformer/Api/NotificationTransformer.php b/app/Transformer/Api/NotificationTransformer.php index df8d0d30c..d4f84bbef 100644 --- a/app/Transformer/Api/NotificationTransformer.php +++ b/app/Transformer/Api/NotificationTransformer.php @@ -32,18 +32,22 @@ class NotificationTransformer extends Fractal\TransformerAbstract if($n->item_id && $n->item_type == 'App\ModLog') { $ml = $n->item; - $res['modlog'] = [ - 'id' => $ml->object_uid, - 'url' => url('/i/admin/users/modlogs/' . $ml->object_uid) - ]; + if($ml && $ml->object_uid) { + $res['modlog'] = [ + 'id' => $ml->object_uid, + 'url' => url('/i/admin/users/modlogs/' . $ml->object_uid) + ]; + } } if($n->item_id && $n->item_type == 'App\MediaTag') { $ml = $n->item; - $res['tagged'] = [ - 'username' => $ml->tagged_username, - 'post_url' => '/p/'.HashidService::encode($ml->status_id) - ]; + if($ml && $ml->tagged_username) { + $res['tagged'] = [ + 'username' => $ml->tagged_username, + 'post_url' => '/p/'.HashidService::encode($ml->status_id) + ]; + } } return $res; From bda9d16b5893027983f116ce49b4c93085ece90f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 17 Nov 2022 23:30:17 -0700 Subject: [PATCH 5/6] Update landing view --- resources/views/site/index.blade.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/views/site/index.blade.php b/resources/views/site/index.blade.php index 314e549d3..c2f59984a 100644 --- a/resources/views/site/index.blade.php +++ b/resources/views/site/index.blade.php @@ -53,15 +53,18 @@

Photo Sharing

For Everyone.

+ +

{{ config_cache('app.short_description') ?? 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms.' }}

+

Learn more

- Pixelfed + {{ config_cache('app.name') ?? 'Pixelfed' }}
-

Photo Sharing. For Everyone

+

{{ config_cache('app.short_description') ?? 'Pixelfed is an image sharing platform, an ethical alternative to centralized platforms.' }}

From fadd0534a437491d2d91d06fd8410153bdb6fa79 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 17 Nov 2022 23:31:38 -0700 Subject: [PATCH 6/6] Update changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc1043a19..449667a84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,11 @@ - Update ApiV1Controller, fix followAccountById with firstOrCreate() ([1d52ad0b](https://github.com/pixelfed/pixelfed/commit/1d52ad0b)) - Update AccountService, fix delete status ([8b7121f9](https://github.com/pixelfed/pixelfed/commit/8b7121f9)) - Update ap helpers, fix duplicate entry bug ([85cfa1ba](https://github.com/pixelfed/pixelfed/commit/85cfa1ba)) +- Update Inbox, fix handleUndoActivity ([d660e46b](https://github.com/pixelfed/pixelfed/commit/d660e46b)) +- Update HomeSettings controller, bail earlier when attempting to update email that already exists ([399bf5f8](https://github.com/pixelfed/pixelfed/commit/399bf5f8)) +- Update ProfileController, cache actor object and atom feed ([8665eab1](https://github.com/pixelfed/pixelfed/commit/8665eab1)) +- Update NotificationTransformer, fix mediaTag and modLog types ([b6c06c4b](https://github.com/pixelfed/pixelfed/commit/b6c06c4b)) +- Update landing view, add `app.name` and `app.short_description` for better customizability ([bda9d16b](https://github.com/pixelfed/pixelfed/commit/bda9d16b)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4)