mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-18 19:13:17 +00:00
Add Notify App Gateway support
This commit is contained in:
parent
0ddab939ad
commit
33621dd680
3 changed files with 30 additions and 5 deletions
|
@ -26,6 +26,7 @@ use App\Services\FollowerService;
|
||||||
use App\Services\MediaBlocklistService;
|
use App\Services\MediaBlocklistService;
|
||||||
use App\Services\MediaPathService;
|
use App\Services\MediaPathService;
|
||||||
use App\Services\NetworkTimelineService;
|
use App\Services\NetworkTimelineService;
|
||||||
|
use App\Services\NotificationAppGatewayService;
|
||||||
use App\Services\ProfileStatusService;
|
use App\Services\ProfileStatusService;
|
||||||
use App\Services\PublicTimelineService;
|
use App\Services\PublicTimelineService;
|
||||||
use App\Services\StatusService;
|
use App\Services\StatusService;
|
||||||
|
@ -54,8 +55,8 @@ class ApiV1Dot1Controller extends Controller
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->fractal = new Fractal\Manager();
|
$this->fractal = new Fractal\Manager;
|
||||||
$this->fractal->setSerializer(new ArraySerializer());
|
$this->fractal->setSerializer(new ArraySerializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function json($res, $code = 200, $headers = [])
|
public function json($res, $code = 200, $headers = [])
|
||||||
|
@ -317,7 +318,7 @@ class ApiV1Dot1Controller extends Controller
|
||||||
if (config('pixelfed.bouncer.cloud_ips.ban_signups')) {
|
if (config('pixelfed.bouncer.cloud_ips.ban_signups')) {
|
||||||
abort_if(BouncerService::checkIp($request->ip()), 404);
|
abort_if(BouncerService::checkIp($request->ip()), 404);
|
||||||
}
|
}
|
||||||
$agent = new Agent();
|
$agent = new Agent;
|
||||||
$currentIp = $request->ip();
|
$currentIp = $request->ip();
|
||||||
|
|
||||||
$activity = AccountLog::whereUserId($user->id)
|
$activity = AccountLog::whereUserId($user->id)
|
||||||
|
@ -575,7 +576,7 @@ class ApiV1Dot1Controller extends Controller
|
||||||
|
|
||||||
$rtoken = Str::random(64);
|
$rtoken = Str::random(64);
|
||||||
|
|
||||||
$verify = new EmailVerification();
|
$verify = new EmailVerification;
|
||||||
$verify->user_id = $user->id;
|
$verify->user_id = $user->id;
|
||||||
$verify->email = $user->email;
|
$verify->email = $user->email;
|
||||||
$verify->user_token = $user->app_register_token;
|
$verify->user_token = $user->app_register_token;
|
||||||
|
@ -1203,7 +1204,7 @@ class ApiV1Dot1Controller extends Controller
|
||||||
abort(500, 'An error occured.');
|
abort(500, 'An error occured.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$media = new Media();
|
$media = new Media;
|
||||||
$media->status_id = $status->id;
|
$media->status_id = $status->id;
|
||||||
$media->profile_id = $profile->id;
|
$media->profile_id = $profile->id;
|
||||||
$media->user_id = $user->id;
|
$media->user_id = $user->id;
|
||||||
|
@ -1252,4 +1253,11 @@ class ApiV1Dot1Controller extends Controller
|
||||||
|
|
||||||
return $this->json($res);
|
return $this->json($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function nagState(Request $request)
|
||||||
|
{
|
||||||
|
abort_unless((bool) config_cache('pixelfed.oauth_enabled'), 404);
|
||||||
|
|
||||||
|
return NotificationAppGatewayService::config();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
11
app/Services/NotificationAppGatewayService.php
Normal file
11
app/Services/NotificationAppGatewayService.php
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
class NotificationAppGatewayService
|
||||||
|
{
|
||||||
|
public static function config()
|
||||||
|
{
|
||||||
|
return config('instance.notifications.nag');
|
||||||
|
}
|
||||||
|
}
|
|
@ -151,6 +151,11 @@ return [
|
||||||
'enabled' => env('INSTANCE_NOTIFY_AUTO_GC', false),
|
'enabled' => env('INSTANCE_NOTIFY_AUTO_GC', false),
|
||||||
'delete_after_days' => env('INSTANCE_NOTIFY_AUTO_GC_DEL_AFTER_DAYS', 365),
|
'delete_after_days' => env('INSTANCE_NOTIFY_AUTO_GC_DEL_AFTER_DAYS', 365),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'nag' => [
|
||||||
|
'enabled' => (bool) env('INSTANCE_NOTIFY_APP_GATEWAY', true),
|
||||||
|
'endpoint' => 'push.pixelfed.net',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'curated_registration' => [
|
'curated_registration' => [
|
||||||
|
@ -171,6 +176,7 @@ return [
|
||||||
'enabled' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_VERIFY', false),
|
'enabled' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_VERIFY', false),
|
||||||
'bundle' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_VERIFY_BUNDLE', false),
|
'bundle' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_VERIFY_BUNDLE', false),
|
||||||
'max_per_day' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_VERIFY_MPD', 10),
|
'max_per_day' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_VERIFY_MPD', 10),
|
||||||
|
'cc_addresses' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_VERIFY_CC'),
|
||||||
],
|
],
|
||||||
'on_user_response' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_USER_RESPONSE', false),
|
'on_user_response' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_USER_RESPONSE', false),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue