diff --git a/CHANGELOG.md b/CHANGELOG.md index fd857a64e..d7ee1304e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.10.7...dev) ### Added - Added ```BANNED_USERNAMES``` .env var, an optional comma separated string to ban specific usernames from being used ([6cdd64c6](https://github.com/pixelfed/pixelfed/commit/6cdd64c6)) +- Added RestrictedAccess middleware for Restricted Mode ([17c1a83d](https://github.com/pixelfed/pixelfed/commit/17c1a83d)) ### Fixed - Fixed Story Compose bug affecting postgres instances ([#1918](https://github.com/pixelfed/pixelfed/pull/1918)) @@ -19,6 +20,8 @@ - Updated admin reports, fixed 404 bug ([dbd5c4cf](https://github.com/pixelfed/pixelfed/commit/dbd5c4cf)) - Updated AdminController, abstracted dashboard stats to AdminStatsService ([41abe9d2](https://github.com/pixelfed/pixelfed/commit/41abe9d2)) - Updated StoryCompose component, added upload progress page ([2de3c56f](https://github.com/pixelfed/pixelfed/commit/2de3c56f)) +- Updated instance config, cleanup and add restricted mode ([3be32597](https://github.com/pixelfed/pixelfed/commit/3be32597)) +- Update RelationshipSettings Controller, fixes #1605 ([4d2da2f1](https://github.com/pixelfed/pixelfed/commit/4d2da2f1)) ### Changed diff --git a/app/Http/Controllers/Settings/RelationshipSettings.php b/app/Http/Controllers/Settings/RelationshipSettings.php index a2f1cfea1..1933ce1d4 100644 --- a/app/Http/Controllers/Settings/RelationshipSettings.php +++ b/app/Http/Controllers/Settings/RelationshipSettings.php @@ -22,7 +22,7 @@ trait RelationshipSettings 'mode' => 'nullable|string|in:following,followers,hashtags' ]); - $mode = $request->input('mode'); + $mode = $request->input('mode') ?? 'followers'; $profile = Auth::user()->profile; switch ($mode) { @@ -37,10 +37,6 @@ trait RelationshipSettings case 'hashtags': $data = $profile->hashtagFollowing()->with('hashtag')->simplePaginate(10); break; - - default: - $data = []; - break; } return view('settings.relationships.home', compact('profile', 'mode', 'data')); diff --git a/app/Http/Middleware/RestrictedAccess.php b/app/Http/Middleware/RestrictedAccess.php new file mode 100644 index 000000000..b88c838be --- /dev/null +++ b/app/Http/Middleware/RestrictedAccess.php @@ -0,0 +1,32 @@ +check()) { + $p = ['login', 'password*', 'loginAs*']; + if(!$request->is($p)) { + return redirect('/login'); + } + } + } + + return $next($request); + } +} diff --git a/config/instance.php b/config/instance.php index 28916f92b..de58147fa 100644 --- a/config/instance.php +++ b/config/instance.php @@ -3,10 +3,6 @@ return [ 'description' => env('INSTANCE_DESCRIPTION', null), - 'announcement' => [ - 'enabled' => env('INSTANCE_ANNOUNCEMENT_ENABLED', false), - 'message' => env('INSTANCE_ANNOUNCEMENT_MESSAGE', 'Example announcement message.
Something else here') - ], 'contact' => [ 'enabled' => env('INSTANCE_CONTACT_FORM', false), @@ -15,7 +11,7 @@ return [ 'discover' => [ 'loops' => [ - 'enabled' => false + 'enabled' => env('EXP_LOOPS', false), ], 'tags' => [ 'is_public' => env('INSTANCE_PUBLIC_HASHTAGS', false) @@ -51,5 +47,10 @@ return [ 'stories' => [ 'enabled' => env('STORIES_ENABLED', false), + ], + + 'restricted' => [ + 'enabled' => env('RESTRICTED_INSTANCE', false), + 'level' => 1 ] ]; \ No newline at end of file diff --git a/resources/views/settings/template.blade.php b/resources/views/settings/template.blade.php index ea84bad3c..59cd3f8d5 100644 --- a/resources/views/settings/template.blade.php +++ b/resources/views/settings/template.blade.php @@ -21,7 +21,7 @@
-
+
@include('settings.partial.sidebar')