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) 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() 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'); 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; 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())), ]; 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.' }}