mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update config() to config_cache()
This commit is contained in:
parent
27b722e7a7
commit
53134208fe
9 changed files with 889 additions and 884 deletions
|
@ -79,7 +79,7 @@ class FederationController extends Controller
|
|||
|
||||
public function userOutbox(Request $request, $username)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config('federation.activitypub.outbox'), 404);
|
||||
|
||||
$profile = Profile::whereNull('domain')
|
||||
|
@ -99,7 +99,7 @@ class FederationController extends Controller
|
|||
|
||||
public function userInbox(Request $request, $username)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config('federation.activitypub.inbox'), 404);
|
||||
|
||||
$headers = $request->headers->all();
|
||||
|
@ -110,7 +110,7 @@ class FederationController extends Controller
|
|||
|
||||
public function sharedInbox(Request $request)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config('federation.activitypub.sharedInbox'), 404);
|
||||
|
||||
$headers = $request->headers->all();
|
||||
|
@ -121,7 +121,7 @@ class FederationController extends Controller
|
|||
|
||||
public function userFollowing(Request $request, $username)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
|
||||
$profile = Profile::whereNull('remote_url')
|
||||
->whereUsername($username)
|
||||
|
@ -144,7 +144,7 @@ class FederationController extends Controller
|
|||
|
||||
public function userFollowers(Request $request, $username)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
|
||||
$profile = Profile::whereNull('remote_url')
|
||||
->whereUsername($username)
|
||||
|
|
|
@ -27,7 +27,7 @@ class ProfileController extends Controller
|
|||
->whereUsername($username)
|
||||
->firstOrFail();
|
||||
|
||||
if($request->wantsJson() && config('federation.activitypub.enabled')) {
|
||||
if($request->wantsJson() && config_cache('federation.activitypub.enabled')) {
|
||||
return $this->showActivityPub($request, $user);
|
||||
}
|
||||
return $this->buildProfile($request, $user);
|
||||
|
@ -114,7 +114,7 @@ class ProfileController extends Controller
|
|||
{
|
||||
$user = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
||||
|
||||
if ($request->wantsJson() && config('federation.activitypub.enabled')) {
|
||||
if ($request->wantsJson() && config_cache('federation.activitypub.enabled')) {
|
||||
return $this->showActivityPub($request, $user);
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ class ProfileController extends Controller
|
|||
|
||||
public function showActivityPub(Request $request, $user)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
abort_if($user->domain, 404);
|
||||
|
||||
$fractal = new Fractal\Manager();
|
||||
|
|
|
@ -84,7 +84,7 @@ class SearchController extends Controller
|
|||
$hash = hash('sha256', $tag);
|
||||
if( Helpers::validateUrl($tag) != false &&
|
||||
Helpers::validateLocalUrl($tag) != true &&
|
||||
config('federation.activitypub.enabled') == true &&
|
||||
config_cache('federation.activitypub.enabled') == true &&
|
||||
config('federation.activitypub.remoteFollow') == true
|
||||
) {
|
||||
$remote = Helpers::fetchFromUrl($tag);
|
||||
|
@ -203,7 +203,7 @@ class SearchController extends Controller
|
|||
$ttl = now()->addHours(2);
|
||||
if( Helpers::validateUrl($tag) != false &&
|
||||
Helpers::validateLocalUrl($tag) != true &&
|
||||
config('federation.activitypub.enabled') == true &&
|
||||
config_cache('federation.activitypub.enabled') == true &&
|
||||
config('federation.activitypub.remoteFollow') == true
|
||||
) {
|
||||
$remote = Helpers::fetchFromUrl($tag);
|
||||
|
|
|
@ -70,11 +70,16 @@ class StatusController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
if ($request->wantsJson() && config('federation.activitypub.enabled')) {
|
||||
if ($request->wantsJson() && config_cache('federation.activitypub.enabled')) {
|
||||
return $this->showActivityPub($request, $status);
|
||||
}
|
||||
|
||||
$template = $status->in_reply_to_id ? 'status.reply' : 'status.show';
|
||||
// $template = $status->type === 'video' &&
|
||||
// $request->has('video_beta') &&
|
||||
// $request->video_beta == 1 &&
|
||||
// $request->user() ?
|
||||
// 'status.show_video' : 'status.show';
|
||||
|
||||
return view($template, compact('user', 'status'));
|
||||
}
|
||||
|
@ -340,7 +345,7 @@ class StatusController extends Controller
|
|||
|
||||
public static function mimeTypeCheck($mimes)
|
||||
{
|
||||
$allowed = explode(',', config('pixelfed.media_types'));
|
||||
$allowed = explode(',', config_cache('pixelfed.media_types'));
|
||||
$count = count($mimes);
|
||||
$photos = 0;
|
||||
$videos = 0;
|
||||
|
|
|
@ -94,7 +94,7 @@ class SharePipeline implements ShouldQueue
|
|||
|
||||
public function remoteAnnounceDeliver()
|
||||
{
|
||||
if(config('federation.activitypub.enabled') == false) {
|
||||
if(config_cache('federation.activitypub.enabled') == false) {
|
||||
return true;
|
||||
}
|
||||
$status = $this->status;
|
||||
|
|
|
@ -11,6 +11,7 @@ use App\{
|
|||
Status,
|
||||
StatusHashtag,
|
||||
};
|
||||
use App\Models\StatusVideo;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
@ -72,7 +73,7 @@ class StatusDelete implements ShouldQueue
|
|||
$profile->status_count = ($count - 1);
|
||||
$profile->save();
|
||||
|
||||
if(config('federation.activitypub.enabled') == true) {
|
||||
if(config_cache('federation.activitypub.enabled') == true) {
|
||||
$this->fanoutDelete($status);
|
||||
} else {
|
||||
$this->unlinkRemoveMedia($status);
|
||||
|
@ -110,7 +111,6 @@ class StatusDelete implements ShouldQueue
|
|||
Report::whereObjectType('App\Status')
|
||||
->whereObjectId($status->id)
|
||||
->delete();
|
||||
|
||||
MediaTag::where('status_id', $status->id)
|
||||
->cursor()
|
||||
->each(function($tag) {
|
||||
|
@ -119,7 +119,7 @@ class StatusDelete implements ShouldQueue
|
|||
->forceDelete();
|
||||
$tag->delete();
|
||||
});
|
||||
|
||||
StatusVideo::whereStatusId($status->id)->delete();
|
||||
AccountInterstitial::where('item_type', 'App\Status')
|
||||
->where('item_id', $status->id)
|
||||
->delete();
|
||||
|
|
|
@ -159,7 +159,7 @@ class StatusEntityLexer implements ShouldQueue
|
|||
PublicTimelineService::add($status->id);
|
||||
}
|
||||
|
||||
if(config('federation.activitypub.enabled') == true && config('app.env') == 'production') {
|
||||
if(config_cache('federation.activitypub.enabled') == true && config('app.env') == 'production') {
|
||||
StatusActivityPubDeliver::dispatch($this->status);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class Outbox {
|
|||
|
||||
public static function get($profile)
|
||||
{
|
||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
||||
abort_if(!config('federation.activitypub.outbox'), 404);
|
||||
|
||||
if($profile->status != null) {
|
||||
|
|
|
@ -27,7 +27,7 @@ class Config {
|
|||
],
|
||||
|
||||
'activitypub' => [
|
||||
'enabled' => config('federation.activitypub.enabled'),
|
||||
'enabled' => config_cache('federation.activitypub.enabled'),
|
||||
'remote_follow' => config('federation.activitypub.remoteFollow')
|
||||
],
|
||||
|
||||
|
|
Loading…
Reference in a new issue