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