From 210a1d3ae3d5f30c208b3c0b4c95637791b05e23 Mon Sep 17 00:00:00 2001 From: Nick Zolotko Date: Mon, 12 Aug 2024 07:22:04 -0700 Subject: [PATCH 1/5] Fix Sudo Confirm Password Autofill for Password Managers Password managers are looking for "current-password" in the autocomplete tag. This fixes issue https://github.com/pixelfed/pixelfed/issues/5258 --- resources/views/auth/sudo.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/auth/sudo.blade.php b/resources/views/auth/sudo.blade.php index edbbabe25..d173d6677 100644 --- a/resources/views/auth/sudo.blade.php +++ b/resources/views/auth/sudo.blade.php @@ -29,7 +29,7 @@ type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" - autocomplete="new-password" + autocomplete="current-password" placeholder="{{__('Password')}}" required> From dcd95d687c98f27b853835ee9bfd88dcf655e868 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 12 Aug 2024 21:21:29 -0600 Subject: [PATCH 2/5] Update ApiV1Controller, fix v1/instance stats, force cast to int --- app/Http/Controllers/Api/ApiV1Controller.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 80c955fb9..253e21f7d 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -1663,9 +1663,9 @@ class ApiV1Controller extends Controller $stats = Cache::remember('api:v1:instance-data:stats', 43200, function () { return [ - 'user_count' => User::count(), - 'status_count' => StatusService::totalLocalStatuses(), - 'domain_count' => Instance::count(), + 'user_count' => (int) User::count(), + 'status_count' => (int) StatusService::totalLocalStatuses(), + 'domain_count' => (int) Instance::count(), ]; }); From c19bd1557b87962e9b73b686f371910f82c4e170 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 12 Aug 2024 22:27:48 -0600 Subject: [PATCH 3/5] Update readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 7c0117a52..e2a90535e 100644 --- a/README.md +++ b/README.md @@ -43,3 +43,10 @@ We would like to extend our thanks to the following sponsors for funding Pixelfe - [NLnet Foundation](https://nlnet.nl) and [NGI0 Discovery](https://nlnet.nl/discovery/), part of the [Next Generation Internet](https://ngi.eu) initiative. + +

This project is supported by:

+

+ + + +

From 4ca7c6c32862191d8836c48ddc299caf8677ddce Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 13 Aug 2024 00:00:51 -0600 Subject: [PATCH 4/5] Add preliminary Authorize Interaction support --- .../AuthorizeInteractionController.php | 37 +++++++++++++++++++ app/Http/Controllers/FederationController.php | 4 ++ app/Util/Lexer/RestrictedNames.php | 3 ++ app/Util/Webfinger/Webfinger.php | 15 ++++++-- routes/web.php | 3 +- 5 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 app/Http/Controllers/AuthorizeInteractionController.php diff --git a/app/Http/Controllers/AuthorizeInteractionController.php b/app/Http/Controllers/AuthorizeInteractionController.php new file mode 100644 index 000000000..701ee06f1 --- /dev/null +++ b/app/Http/Controllers/AuthorizeInteractionController.php @@ -0,0 +1,37 @@ +validate([ + 'uri' => 'required|url', + ]); + + abort_unless((bool) config_cache('federation.activitypub.enabled'), 404); + + $uri = Helpers::validateUrl($request->input('uri'), true); + abort_unless($uri, 404); + + if (! $request->user()) { + return redirect('/login?next='.urlencode($uri)); + } + + $status = Helpers::statusFetch($uri); + if ($status && isset($status['id'])) { + return redirect('/i/web/post/'.$status['id']); + } + + $profile = Helpers::profileFetch($uri); + if ($profile && isset($profile['id'])) { + return redirect('/i/web/profile/'.$profile['id']); + } + + return redirect('/i/web'); + } +} diff --git a/app/Http/Controllers/FederationController.php b/app/Http/Controllers/FederationController.php index 5738292f1..15570eb6b 100644 --- a/app/Http/Controllers/FederationController.php +++ b/app/Http/Controllers/FederationController.php @@ -66,6 +66,10 @@ class FederationController extends Controller 'type' => 'application/activity+json', 'href' => 'https://'.$domain.'/i/actor', ], + [ + 'rel' => 'http://ostatus.org/schema/1.0/subscribe', + 'template' => 'https://'.$domain.'/authorize_interaction?uri={uri}', + ], ], ]; diff --git a/app/Util/Lexer/RestrictedNames.php b/app/Util/Lexer/RestrictedNames.php index 9d88b0da1..0974f2a9c 100644 --- a/app/Util/Lexer/RestrictedNames.php +++ b/app/Util/Lexer/RestrictedNames.php @@ -83,6 +83,9 @@ class RestrictedNames 'admin', 'administrator', + // Federation + 'authorize_interaction', + // Static Assets 'assets', 'public', diff --git a/app/Util/Webfinger/Webfinger.php b/app/Util/Webfinger/Webfinger.php index c900358e6..3897fc162 100644 --- a/app/Util/Webfinger/Webfinger.php +++ b/app/Util/Webfinger/Webfinger.php @@ -5,8 +5,11 @@ namespace App\Util\Webfinger; class Webfinger { protected $user; + protected $subject; + protected $aliases; + protected $links; public function __construct($user) @@ -30,17 +33,17 @@ class Webfinger ]; $this->links = [ [ - 'rel' => 'http://webfinger.net/rel/profile-page', + 'rel' => 'http://webfinger.net/rel/profile-page', 'type' => 'text/html', 'href' => $user->url(), ], [ - 'rel' => 'http://schemas.google.com/g/2010#updates-from', + 'rel' => 'http://schemas.google.com/g/2010#updates-from', 'type' => 'application/atom+xml', 'href' => $user->permalink('.atom'), ], [ - 'rel' => 'self', + 'rel' => 'self', 'type' => 'application/activity+json', 'href' => $user->permalink(), ], @@ -49,6 +52,10 @@ class Webfinger 'type' => $avatarType, 'href' => $avatar, ], + [ + 'rel' => 'http://ostatus.org/schema/1.0/subscribe', + 'template' => 'https://'.config_cache('pixelfed.domain.app').'/authorize_interaction?uri={uri}', + ], ]; } @@ -57,7 +64,7 @@ class Webfinger return [ 'subject' => $this->subject, 'aliases' => $this->aliases, - 'links' => $this->links, + 'links' => $this->links, ]; } } diff --git a/routes/web.php b/routes/web.php index 00e9e201a..16d05b22a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -5,6 +5,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::redirect('/home', '/')->name('home'); Route::get('web/directory', 'LandingController@directoryRedirect'); Route::get('web/explore', 'LandingController@exploreRedirect'); + Route::get('authorize_interaction', 'AuthorizeInteractionController@get'); Auth::routes(); Route::get('auth/raw/mastodon/start', 'RemoteAuthController@startRedirect'); @@ -67,7 +68,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::get('lang/{locale}', 'SiteController@changeLocale'); Route::get('restored', 'AccountController@accountRestored'); - Route::get('verify-email', 'AccountController@verifyEmail'); + Route::get('verify-email', 'AccountController@verifyEmail')->name('account.verify_email'); Route::post('verify-email', 'AccountController@sendVerifyEmail'); Route::get('verify-email/request', 'InternalApiController@requestEmailVerification'); Route::post('verify-email/request', 'InternalApiController@requestEmailVerificationStore'); From 72cdf562f2dfff20e62474a37cae2509599de655 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 13 Aug 2024 00:02:41 -0600 Subject: [PATCH 5/5] Update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e30bb2634..aad5c9570 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Added - Implement Admin Domain Blocks API (Mastodon API Compatible) [ThisIsMissEm](https://github.com/ThisIsMissEm) ([#5021](https://github.com/pixelfed/pixelfed/pull/5021)) +- Authorize Interaction support (for handling remote interactions) ([4ca7c6c3](https://github.com/pixelfed/pixelfed/commit/4ca7c6c3)) ### Updates - Update ApiV1Controller, add support for notification filter types ([f61159a1](https://github.com/pixelfed/pixelfed/commit/f61159a1)) @@ -14,7 +15,7 @@ - Update instance config, update network cache feed max_hours_old falloff to 90 days instead of 6 hours to allow for less active instances to have more results ([c042d135](https://github.com/pixelfed/pixelfed/commit/c042d135)) - Update ApiV1Dot1Controller, add new single media status create endpoint ([b03f5cec](https://github.com/pixelfed/pixelfed/commit/b03f5cec)) - Update AdminSettings component, add link to Custom CSS settings ([958daac4](https://github.com/pixelfed/pixelfed/commit/958daac4)) -- ([](https://github.com/pixelfed/pixelfed/commit/)) +- Update ApiV1Controller, fix v1/instance stats, force cast to int ([dcd95d68](https://github.com/pixelfed/pixelfed/commit/dcd95d68)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.12.3 (2024-07-01)](https://github.com/pixelfed/pixelfed/compare/v0.12.2...v0.12.3)