Update landing settings, use config_cache

This commit is contained in:
Daniel Supernault 2024-03-12 02:05:22 -06:00
parent d670de175e
commit 40478f258a
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
2 changed files with 21 additions and 22 deletions

View file

@ -2,10 +2,9 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Profile;
use App\Services\AccountService;
use App\Http\Resources\DirectoryProfile;
use App\Profile;
use Illuminate\Http\Request;
class LandingController extends Controller
{
@ -15,7 +14,7 @@ class LandingController extends Controller
return redirect('/');
}
abort_if(config_cache('instance.landing.show_directory') == false, 404);
abort_if((bool) config_cache('instance.landing.show_directory') == false, 404);
return view('site.index');
}
@ -26,14 +25,14 @@ class LandingController extends Controller
return redirect('/');
}
abort_if(config_cache('instance.landing.show_explore') == false, 404);
abort_if((bool) config_cache('instance.landing.show_explore') == false, 404);
return view('site.index');
}
public function getDirectoryApi(Request $request)
{
abort_if(config_cache('instance.landing.show_directory') == false, 404);
abort_if((bool) config_cache('instance.landing.show_directory') == false, 404);
return DirectoryProfile::collection(
Profile::whereNull('domain')

View file

@ -53,8 +53,8 @@ class LandingService
'name' => config_cache('app.name'),
'url' => config_cache('app.url'),
'domain' => config('pixelfed.domain.app'),
'show_directory' => config_cache('instance.landing.show_directory'),
'show_explore_feed' => config_cache('instance.landing.show_explore'),
'show_directory' => (bool) config_cache('instance.landing.show_directory'),
'show_explore_feed' => (bool) config_cache('instance.landing.show_explore'),
'open_registration' => (bool) $openReg,
'curated_onboarding' => (bool) config_cache('instance.curated_registration.enabled'),
'version' => config('pixelfed.version'),