From 59c70239f87c630d36d51017b02dfa71b9009b39 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 22 Feb 2024 03:39:13 -0700 Subject: [PATCH 1/3] Update Directory logic, add curated onboarding support --- .../Admin/AdminDirectoryController.php | 11 +++++--- .../PixelfedDirectoryController.php | 9 ++++--- .../components/admin/AdminDirectory.vue | 25 ++++++++++++++----- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/Admin/AdminDirectoryController.php b/app/Http/Controllers/Admin/AdminDirectoryController.php index 1e4db7d2d..8d3e4b7fc 100644 --- a/app/Http/Controllers/Admin/AdminDirectoryController.php +++ b/app/Http/Controllers/Admin/AdminDirectoryController.php @@ -75,6 +75,7 @@ trait AdminDirectoryController } $res['community_guidelines'] = config_cache('app.rules') ? json_decode(config_cache('app.rules'), true) : []; + $res['curated_onboarding'] = (bool) config_cache('instance.curated_registration.enabled'); $res['open_registration'] = (bool) config_cache('pixelfed.open_registration'); $res['oauth_enabled'] = (bool) config_cache('pixelfed.oauth_enabled') && file_exists(storage_path('oauth-public.key')) && file_exists(storage_path('oauth-private.key')); @@ -124,7 +125,7 @@ trait AdminDirectoryController $res['requirements_validator'] = $validator->errors(); - $res['is_eligible'] = $res['open_registration'] && + $res['is_eligible'] = ($res['open_registration'] || $res['curated_onboarding']) && $res['oauth_enabled'] && $res['activitypub_enabled'] && count($res['requirements_validator']) === 0 && @@ -227,7 +228,7 @@ trait AdminDirectoryController ->each(function($name) { Storage::delete($name); }); - $path = $request->file('banner_image')->store('public/headers'); + $path = $request->file('banner_image')->storePublicly('public/headers'); $res['banner_image'] = $path; ConfigCacheService::put('app.banner_image', url(Storage::url($path))); @@ -249,7 +250,8 @@ trait AdminDirectoryController { $reqs = []; $reqs['feature_config'] = [ - 'open_registration' => config_cache('pixelfed.open_registration'), + 'open_registration' => (bool) config_cache('pixelfed.open_registration'), + 'curated_onboarding' => (bool) config_cache('instance.curated_registration.enabled'), 'activitypub_enabled' => config_cache('federation.activitypub.enabled'), 'oauth_enabled' => config_cache('pixelfed.oauth_enabled'), 'media_types' => Str::of(config_cache('pixelfed.media_types'))->explode(','), @@ -265,7 +267,8 @@ trait AdminDirectoryController ]; $validator = Validator::make($reqs['feature_config'], [ - 'open_registration' => 'required|accepted', + 'open_registration' => 'required_unless:curated_onboarding,true', + 'curated_onboarding' => 'required_unless:open_registration,true', 'activitypub_enabled' => 'required|accepted', 'oauth_enabled' => 'required|accepted', 'media_types' => [ diff --git a/app/Http/Controllers/PixelfedDirectoryController.php b/app/Http/Controllers/PixelfedDirectoryController.php index 6290cd398..cfe3f690a 100644 --- a/app/Http/Controllers/PixelfedDirectoryController.php +++ b/app/Http/Controllers/PixelfedDirectoryController.php @@ -78,10 +78,11 @@ class PixelfedDirectoryController extends Controller $res['community_guidelines'] = json_decode($guidelines->v, true); } - $openRegistration = ConfigCache::whereK('pixelfed.open_registration')->first(); - if($openRegistration) { - $res['open_registration'] = (bool) $openRegistration; - } + $openRegistration = (bool) config_cache('pixelfed.open_registration'); + $res['open_registration'] = $openRegistration; + + $curatedOnboarding = (bool) config_cache('instance.curated_registration.enabled'); + $res['curated_onboarding'] = $curatedOnboarding; $oauthEnabled = ConfigCache::whereK('pixelfed.oauth_enabled')->first(); if($oauthEnabled) { diff --git a/resources/assets/components/admin/AdminDirectory.vue b/resources/assets/components/admin/AdminDirectory.vue index 0676b4057..53eade198 100644 --- a/resources/assets/components/admin/AdminDirectory.vue +++ b/resources/assets/components/admin/AdminDirectory.vue @@ -109,12 +109,20 @@
- - - {{ requirements.open_registration ? 'Open' : 'Closed' }} account registration - + +
@@ -895,6 +903,7 @@ activitypub_enabled: undefined, open_registration: undefined, oauth_enabled: undefined, + curated_onboarding: undefined, }, feature_config: [], requirements_validator: [], @@ -951,6 +960,10 @@ this.requirements.open_registration = res.data.open_registration; } + if(res.data.curated_onboarding) { + this.requirements.curated_onboarding = res.data.curated_onboarding; + } + if(res.data.oauth_enabled) { this.requirements.oauth_enabled = res.data.oauth_enabled; } From b0ecdc8162244e7754183ab97f71532e4b096a9e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 22 Feb 2024 03:50:56 -0700 Subject: [PATCH 2/3] Update compiled assets --- public/js/admin.js | Bin 216055 -> 216502 bytes public/mix-manifest.json | Bin 5243 -> 5243 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/public/js/admin.js b/public/js/admin.js index e21b77485fd1f936510d2fd39008db70940fdf4f..3e112c876b02e0f4981f59051021a447902387ac 100644 GIT binary patch delta 614 zcmex9op;-8-VGO6_?#SE$lwXoxQdy8{ zTRHgxpVVakQW55SjmpW4{9=<|@rejJ>!oBC7vv;X`X%P3+Li)k90bHCcbCR8I#1rn zUnN+nX{Ax37atEcCqCY`auL!;@19?Tlk zc@>zfr(f`5l-h3K&&b8Au4rIuYfI2y_R|&97$v3$d}I`#{$U*>>vZ2ZMvm!*NsP6V zCp=+ccZLMwbYN(EPyf)##K~v{(x5zjUos=l^o$tB%OFwK=?;91Y|{^o+HU>Y-V9#xxL(pnT4GN#GcH!Nq)M37c(a-(7%=z(*4-VGO6_$xIut83Fr^O8$4^Yav(C*NnOV|3me$C}E?Td7x2lwXoxQdy8{ z>pb}apVVY=ei7z;4d=;>{9=<|@rejl>ZN2B7vv;X`X%P3+Li)k90bHC|0|7Utem`& zze>Y+{%y*`bRZ*rWy&~&MI#<X_qt0&Jel%1TvhHbl*8Z##gW94)gE#?5m%I#CNnCD3H8ycCI wnriA~+9qlkT3T98H*{s5zx}=ob2J+(SZex4Z)SCbVX|eac~Vk}L7I_~p_%dK#jH2@08lXw A4gdfE delta 45 zcmeyZ@mpg Date: Thu, 22 Feb 2024 03:51:10 -0700 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f186d633d..b38fb1b58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Update api v1/v2 instance endpoints, bump mastoapi version from 2.7.2 to 3.5.3 ([545f7d5e](https://github.com/pixelfed/pixelfed/commit/545f7d5e)) - Update ApiV1Controller, implement better limit logic to gracefully handle requests with limits that exceed the max ([1f74a95d](https://github.com/pixelfed/pixelfed/commit/1f74a95d)) - Update AdminCuratedRegisterController, show oldest applications first ([c4dde641](https://github.com/pixelfed/pixelfed/commit/c4dde641)) +- Update Directory logic, add curated onboarding support ([59c70239](https://github.com/pixelfed/pixelfed/commit/59c70239)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.12 (2024-02-16)](https://github.com/pixelfed/pixelfed/compare/v0.11.11...v0.11.12)