From 236559a4d9668c6f1abdc99a9eaf44ea9f74bf66 Mon Sep 17 00:00:00 2001 From: forenta Date: Sun, 5 Sep 2021 21:19:35 +0200 Subject: [PATCH 01/12] Created localized exception.php (DE) --- resources/lang/de/exception.php | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 resources/lang/de/exception.php diff --git a/resources/lang/de/exception.php b/resources/lang/de/exception.php new file mode 100644 index 000000000..53e92f36f --- /dev/null +++ b/resources/lang/de/exception.php @@ -0,0 +1,11 @@ + [ + 'invalid' => [ + 'album' => 'Mindestens 1 Foto oder Video muss enthalten sein.', + ], + ], + +]; From f0bcab4b416838951bef92a63295f38e6f930891 Mon Sep 17 00:00:00 2001 From: forenta Date: Sun, 5 Sep 2021 21:21:49 +0200 Subject: [PATCH 02/12] Update German translation --- resources/lang/de/navmenu.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/lang/de/navmenu.php b/resources/lang/de/navmenu.php index 7408e455d..443de3aab 100644 --- a/resources/lang/de/navmenu.php +++ b/resources/lang/de/navmenu.php @@ -1,7 +1,6 @@ 'Suche', 'home' => 'Heim', 'local' => 'Lokal', @@ -16,5 +15,5 @@ return [ 'admin' => 'Administration', 'logout' => 'Abmelden', 'directMessages' => 'Privatnachrichten', - + 'composePost' => 'Neuen Post erstellen', ]; From 85847f7a9f685fbfb44cffdd5aad7a3e765f801a Mon Sep 17 00:00:00 2001 From: forenta Date: Sun, 5 Sep 2021 21:23:24 +0200 Subject: [PATCH 03/12] Update German translation --- resources/lang/de/site.php | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lang/de/site.php b/resources/lang/de/site.php index 1197b5e51..aaa03c3a1 100644 --- a/resources/lang/de/site.php +++ b/resources/lang/de/site.php @@ -15,5 +15,6 @@ return [ 'contact' => 'Kontakt', 'contact-us' => 'Kontaktiere uns', 'places' => 'Orte', + 'profiles' => 'Profile', ]; From 44dfeb8c9a1f3306ab46cd133784dd28b41f8881 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 10 Sep 2021 21:23:47 -0600 Subject: [PATCH 04/12] Update de localization, Create New Post -> New --- resources/lang/de/navmenu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/de/navmenu.php b/resources/lang/de/navmenu.php index 443de3aab..f75ca7a00 100644 --- a/resources/lang/de/navmenu.php +++ b/resources/lang/de/navmenu.php @@ -15,5 +15,5 @@ return [ 'admin' => 'Administration', 'logout' => 'Abmelden', 'directMessages' => 'Privatnachrichten', - 'composePost' => 'Neuen Post erstellen', + 'composePost' => 'Neu', ]; From 65655eaa89b28a17ac595d06e60b21136831aa91 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 10 Sep 2021 21:25:30 -0600 Subject: [PATCH 05/12] Formatting --- resources/lang/de/site.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/lang/de/site.php b/resources/lang/de/site.php index aaa03c3a1..92f81e03b 100644 --- a/resources/lang/de/site.php +++ b/resources/lang/de/site.php @@ -15,6 +15,5 @@ return [ 'contact' => 'Kontakt', 'contact-us' => 'Kontaktiere uns', 'places' => 'Orte', - 'profiles' => 'Profile', - + 'profiles' => 'Profile', ]; From 9f0f5a3d463a726c7efee11fab68a048b45d8a9c Mon Sep 17 00:00:00 2001 From: Tomas Brabenec Date: Sat, 11 Sep 2021 05:28:59 +0200 Subject: [PATCH 06/12] Update site.php (#2889) Co-authored-by: daniel --- resources/lang/cs/site.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/lang/cs/site.php b/resources/lang/cs/site.php index 12034cf6b..97413fbcd 100644 --- a/resources/lang/cs/site.php +++ b/resources/lang/cs/site.php @@ -12,5 +12,9 @@ return [ 'l10nWip' => 'Stále pracujeme na podpoře lokalizací', 'currentLocale' => 'Aktuální jazyk', 'selectLocale' => 'Vyberte si jeden z podporovaných jazyků', - + 'contact' => 'Kontakt', + 'contact-us' => 'Kontaktujte nás', + 'places' => 'Místa', + 'profiles' => 'Profily', + ]; From a1d7586be47e55a94b5373bf73c6fd9604604982 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 10 Sep 2021 21:29:45 -0600 Subject: [PATCH 07/12] Formatting --- resources/lang/cs/site.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/resources/lang/cs/site.php b/resources/lang/cs/site.php index 97413fbcd..9a8540888 100644 --- a/resources/lang/cs/site.php +++ b/resources/lang/cs/site.php @@ -1,7 +1,6 @@ 'O nás', 'help' => 'Nápověda', 'language' => 'Jazyk', @@ -12,9 +11,8 @@ return [ 'l10nWip' => 'Stále pracujeme na podpoře lokalizací', 'currentLocale' => 'Aktuální jazyk', 'selectLocale' => 'Vyberte si jeden z podporovaných jazyků', - 'contact' => 'Kontakt', - 'contact-us' => 'Kontaktujte nás', - 'places' => 'Místa', - 'profiles' => 'Profily', - + 'contact' => 'Kontakt', + 'contact-us' => 'Kontaktujte nás', + 'places' => 'Místa', + 'profiles' => 'Profily', ]; From ac6b3f07deb5942a1977757478b43c77fcc24b2d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 10 Sep 2021 21:44:29 -0600 Subject: [PATCH 08/12] Update controllers, fixes #2906 --- app/Http/Controllers/Import/Instagram.php | 11 +++++++---- app/Http/Controllers/Import/Mastodon.php | 11 +++++++---- app/Http/Controllers/ImportController.php | 4 ---- app/Http/Controllers/PollController.php | 10 ++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/Http/Controllers/Import/Instagram.php b/app/Http/Controllers/Import/Instagram.php index bde316e13..39d1d4d2e 100644 --- a/app/Http/Controllers/Import/Instagram.php +++ b/app/Http/Controllers/Import/Instagram.php @@ -15,10 +15,13 @@ use App\Jobs\ImportPipeline\ImportInstagram; trait Instagram { - public function instagram() - { - return view('settings.import.instagram.home'); - } + public function instagram() + { + if(config_cache('pixelfed.import.instagram.enabled') != true) { + abort(404, 'Feature not enabled'); + } + return view('settings.import.instagram.home'); + } public function instagramStart(Request $request) { diff --git a/app/Http/Controllers/Import/Mastodon.php b/app/Http/Controllers/Import/Mastodon.php index 14aa48f77..243cefc37 100644 --- a/app/Http/Controllers/Import/Mastodon.php +++ b/app/Http/Controllers/Import/Mastodon.php @@ -6,8 +6,11 @@ use Illuminate\Http\Request; trait Mastodon { - public function mastodon() - { - return view('settings.import.mastodon.home'); - } + public function mastodon() + { + if(config_cache('pixelfed.import.instagram.enabled') != true) { + abort(404, 'Feature not enabled'); + } + return view('settings.import.mastodon.home'); + } } diff --git a/app/Http/Controllers/ImportController.php b/app/Http/Controllers/ImportController.php index 9885455e9..4a7a27e74 100644 --- a/app/Http/Controllers/ImportController.php +++ b/app/Http/Controllers/ImportController.php @@ -11,10 +11,6 @@ class ImportController extends Controller public function __construct() { $this->middleware('auth'); - - if(config_cache('pixelfed.import.instagram.enabled') != true) { - abort(404, 'Feature not enabled'); - } } } diff --git a/app/Http/Controllers/PollController.php b/app/Http/Controllers/PollController.php index 13d1f4518..b176e03d3 100644 --- a/app/Http/Controllers/PollController.php +++ b/app/Http/Controllers/PollController.php @@ -11,14 +11,10 @@ use App\Services\FollowerService; class PollController extends Controller { - - public function __construct() - { - abort_if(!config_cache('instance.polls.enabled'), 404); - } - public function getPoll(Request $request, $id) { + abort_if(!config_cache('instance.polls.enabled'), 404); + $poll = Poll::findOrFail($id); $status = Status::findOrFail($poll->status_id); if($status->scope != 'public') { @@ -34,6 +30,8 @@ class PollController extends Controller public function vote(Request $request, $id) { + abort_if(!config_cache('instance.polls.enabled'), 404); + abort_unless($request->user(), 403); $this->validate($request, [ From 4a609dc377b2a800469b19c767621b0c407fc4f8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 19 Sep 2021 23:05:56 -0600 Subject: [PATCH 09/12] Update NotificationService, fix 500 bug --- app/Services/NotificationService.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/app/Services/NotificationService.php b/app/Services/NotificationService.php index 6eaca0301..e84ea9903 100644 --- a/app/Services/NotificationService.php +++ b/app/Services/NotificationService.php @@ -27,7 +27,10 @@ class NotificationService { $ids = self::coldGet($id, $start, $stop); } foreach($ids as $id) { - $res->push(self::getNotification($id)); + $n = self::getNotification($id); + if($n != null) { + $res->push($n); + } } return $res; } @@ -56,7 +59,10 @@ class NotificationService { $res = collect([]); foreach($ids as $id) { - $res->push(self::getNotification($id)); + $n = self::getNotification($id); + if($n != null) { + $res->push($n); + } } return $res->toArray(); } @@ -71,7 +77,10 @@ class NotificationService { $res = collect([]); foreach($ids as $id) { - $res->push(self::getNotification($id)); + $n = self::getNotification($id); + if($n != null) { + $res->push($n); + } } return $res->toArray(); } @@ -129,7 +138,12 @@ class NotificationService { public static function getNotification($id) { return Cache::remember('service:notification:'.$id, now()->addDays(3), function() use($id) { - $n = Notification::with('item')->findOrFail($id); + $n = Notification::with('item')->find($id); + + if(!$n) { + return null; + } + $fractal = new Fractal\Manager(); $fractal->setSerializer(new ArraySerializer()); $resource = new Fractal\Resource\Item($n, new NotificationTransformer()); From 3c7ac155f58d39fbe8e419056f47fb0b35cec7dc Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 19 Sep 2021 23:07:01 -0600 Subject: [PATCH 10/12] Update changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b20d1c68..40069178e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Release Notes ## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.11.1...dev) +### Updated +- Updated NotificationService, fix 500 bug. ([4a609dc3](https://github.com/pixelfed/pixelfed/commit/4a609dc3)) +- ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1) ### Added @@ -112,7 +115,6 @@ - Updated DirectMessageController, fix autocomplete bug. ([0f00be4d](https://github.com/pixelfed/pixelfed/commit/0f00be4d)) - Updated StoryService, fix division by zero bug. ([6ae1ba0a](https://github.com/pixelfed/pixelfed/commit/6ae1ba0a)) - Updated ApiV1Controller, fix empty public timeline bug. ([0584f9ee](https://github.com/pixelfed/pixelfed/commit/0584f9ee)) -- ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.0 (2021-06-01)](https://github.com/pixelfed/pixelfed/compare/v0.10.10...v0.11.0) ### Added From a900de2121762cab296c9a6a160492edf71156c4 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 20 Sep 2021 00:21:16 -0600 Subject: [PATCH 11/12] Update HttpSignatures, update instance actor headers. Fixes #2935 --- app/Services/ActivityPubFetchService.php | 13 ++++++------- app/Util/ActivityPub/HttpSignature.php | 3 +-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/Services/ActivityPubFetchService.php b/app/Services/ActivityPubFetchService.php index 94e9357a3..c73e96139 100644 --- a/app/Services/ActivityPubFetchService.php +++ b/app/Services/ActivityPubFetchService.php @@ -2,7 +2,7 @@ namespace App\Services; -use Zttp\Zttp; +use Illuminate\Support\Facades\Http; use App\Profile; use App\Util\ActivityPub\Helpers; use App\Util\ActivityPub\HttpSignature; @@ -15,14 +15,13 @@ class ActivityPubFetchService return 0; } - $headers = HttpSignature::instanceActorSign($url, false, [ - 'Accept' => 'application/activity+json, application/json', - 'User-Agent' => '(Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')' - ]); + $headers = HttpSignature::instanceActorSign($url, false); + $headers['Accept'] = 'application/activity+json, application/json'; + $headers['User-Agent'] = '(Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')'; - return Zttp::withHeaders($headers) + return Http::withHeaders($headers) ->timeout(30) ->get($url) ->body(); } -} \ No newline at end of file +} diff --git a/app/Util/ActivityPub/HttpSignature.php b/app/Util/ActivityPub/HttpSignature.php index fff531fcf..792762b10 100644 --- a/app/Util/ActivityPub/HttpSignature.php +++ b/app/Util/ActivityPub/HttpSignature.php @@ -43,7 +43,7 @@ class HttpSignature { $digest = self::_digest($body); } $headers = self::_headersToSign($url, $body ? $digest : false); - $headers = array_unique(array_merge($headers, $addlHeaders)); + $headers = array_merge($headers, $addlHeaders); $stringToSign = self::_headersToSigningString($headers); $signedHeaders = implode(' ', array_map('strtolower', array_keys($headers))); $key = openssl_pkey_get_private($privateKey); @@ -133,7 +133,6 @@ class HttpSignature { 'Date' => $date->format('D, d M Y H:i:s \G\M\T'), 'Host' => parse_url($url, PHP_URL_HOST), 'Accept' => 'application/activity+json, application/json', - 'Content-Type' => 'application/activity+json' ]; if($digest) { From 9b4b78ef31b5e91af6c578b325ce3705126bc55f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 20 Sep 2021 00:22:09 -0600 Subject: [PATCH 12/12] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2ab5ed77..097443189 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Updated - Updated NotificationService, fix 500 bug. ([4a609dc3](https://github.com/pixelfed/pixelfed/commit/4a609dc3)) +- Update HttpSignatures, update instance actor headers. Fixes #2935. ([a900de21](https://github.com/pixelfed/pixelfed/commit/a900de21)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.1 (2021-09-07)](https://github.com/pixelfed/pixelfed/compare/v0.11.0...v0.11.1)