From 1404ac6e6f4195e2698e3a21e44348d633d3a804 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 5 Feb 2021 21:09:03 -0700 Subject: [PATCH] Update Discover, allow public discover access --- app/Http/Controllers/DiscoverController.php | 4 +++- config/instance.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/DiscoverController.php b/app/Http/Controllers/DiscoverController.php index 25386f702..87db73ba3 100644 --- a/app/Http/Controllers/DiscoverController.php +++ b/app/Http/Controllers/DiscoverController.php @@ -37,7 +37,7 @@ class DiscoverController extends Controller public function home(Request $request) { - abort_if(!Auth::check(), 403); + abort_if(!Auth::check() && config('instance.discover.public') == false, 403); return view('discover.home'); } @@ -113,6 +113,8 @@ class DiscoverController extends Controller public function trendingApi(Request $request) { + abort_if(config('instance.discover.public') == false && !Auth::check(), 403); + $this->validate($request, [ 'range' => 'nullable|string|in:daily,monthly' ]); diff --git a/config/instance.php b/config/instance.php index 39a622351..1fa95229f 100644 --- a/config/instance.php +++ b/config/instance.php @@ -10,6 +10,7 @@ return [ ], 'discover' => [ + 'public' => env('INSTANCE_DISCOVER_PUBLIC', false), 'loops' => [ 'enabled' => env('EXP_LOOPS', false), ],