Update config() to config_cache()

This commit is contained in:
Daniel Supernault 2021-05-11 18:30:32 -06:00
parent 3e52458889
commit 1c2baa8f2c
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
3 changed files with 15 additions and 15 deletions

View file

@ -234,7 +234,7 @@ class ProfileController extends Controller
public function stories(Request $request, $username)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
$pid = $profile->id;
$authed = Auth::user()->profile;

View file

@ -21,7 +21,7 @@ class StoryController extends Controller
{
public function apiV1Add(Request $request)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$this->validate($request, [
'file' => function() {
@ -102,7 +102,7 @@ class StoryController extends Controller
public function cropPhoto(Request $request)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$this->validate($request, [
'media_id' => 'required|integer|min:1',
@ -144,7 +144,7 @@ class StoryController extends Controller
public function publishStory(Request $request)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$this->validate($request, [
'media_id' => 'required',
@ -169,7 +169,7 @@ class StoryController extends Controller
public function apiV1Delete(Request $request, $id)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$user = $request->user();
@ -190,7 +190,7 @@ class StoryController extends Controller
public function apiV1Recent(Request $request)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$profile = $request->user()->profile;
$following = $profile->following->pluck('id')->toArray();
@ -232,7 +232,7 @@ class StoryController extends Controller
public function apiV1Fetch(Request $request, $id)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$authed = $request->user()->profile;
$profile = Profile::findOrFail($id);
@ -270,7 +270,7 @@ class StoryController extends Controller
public function apiV1Item(Request $request, $id)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$authed = $request->user()->profile;
$story = Story::with('profile')
@ -304,7 +304,7 @@ class StoryController extends Controller
public function apiV1Profile(Request $request, $id)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$authed = $request->user()->profile;
$profile = Profile::findOrFail($id);
@ -355,7 +355,7 @@ class StoryController extends Controller
public function apiV1Viewed(Request $request)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$this->validate($request, [
'id' => 'required|integer|min:1|exists:stories',
@ -391,7 +391,7 @@ class StoryController extends Controller
public function apiV1Exists(Request $request, $id)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$res = (bool) Story::whereProfileId($id)
->whereActive(true)
@ -403,7 +403,7 @@ class StoryController extends Controller
public function apiV1Me(Request $request)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$profile = $request->user()->profile;
$stories = Story::whereProfileId($profile->id)
@ -441,14 +441,14 @@ class StoryController extends Controller
public function compose(Request $request)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
return view('stories.compose');
}
public function iRedirect(Request $request)
{
abort_if(!config('instance.stories.enabled') || !$request->user(), 404);
abort_if(!config_cache('instance.stories.enabled') || !$request->user(), 404);
$user = $request->user();
abort_if(!$user, 404);

View file

@ -56,7 +56,7 @@ class Config {
'features' => [
'mobile_apis' => config_cache('pixelfed.oauth_enabled'),
'circles' => false,
'stories' => config('instance.stories.enabled'),
'stories' => config_cache('instance.stories.enabled'),
'video' => Str::contains(config_cache('pixelfed.media_types'), 'video/mp4'),
'import' => [
'instagram' => config('pixelfed.import.instagram.enabled'),