mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-12 17:44:31 +00:00
Merge pull request #5125 from pixelfed/staging
Add /api/v1/instance/peers API endpoint, disabled by default
This commit is contained in:
commit
d4e8ca3086
8 changed files with 327 additions and 205 deletions
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.12.1...dev)
|
## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.12.1...dev)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- New api/v1/instance/peers API endpoint, disabled by default ([4aad1c22](https://github.com/pixelfed/pixelfed/commit/4aad1c22))
|
||||||
|
|
||||||
### Updates
|
### Updates
|
||||||
- Update DirectMessageController, add 72 hour delay for new accounts before they can send a DM ([61d105fd](https://github.com/pixelfed/pixelfed/commit/61d105fd))
|
- Update DirectMessageController, add 72 hour delay for new accounts before they can send a DM ([61d105fd](https://github.com/pixelfed/pixelfed/commit/61d105fd))
|
||||||
- Update AdminCuratedRegisterController, increase message length from 1000 to 3000 ([9a5e3471](https://github.com/pixelfed/pixelfed/commit/9a5e3471))
|
- Update AdminCuratedRegisterController, increase message length from 1000 to 3000 ([9a5e3471](https://github.com/pixelfed/pixelfed/commit/9a5e3471))
|
||||||
|
@ -13,6 +16,8 @@
|
||||||
- Update CollectionsController, add new self route ([bc2495c6](https://github.com/pixelfed/pixelfed/commit/bc2495c6))
|
- Update CollectionsController, add new self route ([bc2495c6](https://github.com/pixelfed/pixelfed/commit/bc2495c6))
|
||||||
- Update FederationController, add webfinger support for actor uri. Fixes #5068 ([24194f7d](https://github.com/pixelfed/pixelfed/commit/24194f7d))
|
- Update FederationController, add webfinger support for actor uri. Fixes #5068 ([24194f7d](https://github.com/pixelfed/pixelfed/commit/24194f7d))
|
||||||
- Update FetchNodeinfoPipeline, set last_fetched_at timestamp ([a7fce91e](https://github.com/pixelfed/pixelfed/commit/a7fce91e))
|
- Update FetchNodeinfoPipeline, set last_fetched_at timestamp ([a7fce91e](https://github.com/pixelfed/pixelfed/commit/a7fce91e))
|
||||||
|
- Update task scheduler, add weekly instance scan to check nodeinfo for known instances ([dc6b9f46](https://github.com/pixelfed/pixelfed/commit/dc6b9f46))
|
||||||
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
|
|
||||||
|
|
47
app/Console/Commands/WeeklyInstanceScan.php
Normal file
47
app/Console/Commands/WeeklyInstanceScan.php
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Instance;
|
||||||
|
use App\Jobs\InstancePipeline\FetchNodeinfoPipeline;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
use function Laravel\Prompts\progress;
|
||||||
|
|
||||||
|
class WeeklyInstanceScan extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'app:weekly-instance-scan';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Scan instance nodeinfo';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
if ((bool) config_cache('federation.activitypub.enabled') == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$users = progress(
|
||||||
|
label: 'Updating instance stats...',
|
||||||
|
steps: Instance::all(),
|
||||||
|
callback: fn ($instance) => $this->updateInstanceStats($instance),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function updateInstanceStats($instance)
|
||||||
|
{
|
||||||
|
FetchNodeinfoPipeline::dispatch($instance)->onQueue('intbg');
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,7 +19,6 @@ class Kernel extends ConsoleKernel
|
||||||
/**
|
/**
|
||||||
* Define the application's command schedule.
|
* Define the application's command schedule.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -32,6 +31,7 @@ class Kernel extends ConsoleKernel
|
||||||
$schedule->command('gc:failedjobs')->dailyAt(3)->onOneServer();
|
$schedule->command('gc:failedjobs')->dailyAt(3)->onOneServer();
|
||||||
$schedule->command('gc:passwordreset')->dailyAt('09:41')->onOneServer();
|
$schedule->command('gc:passwordreset')->dailyAt('09:41')->onOneServer();
|
||||||
$schedule->command('gc:sessions')->twiceDaily(13, 23)->onOneServer();
|
$schedule->command('gc:sessions')->twiceDaily(13, 23)->onOneServer();
|
||||||
|
$schedule->command('app:weekly-instance-scan')->weeklyOn(2, '4:20')->onOneServer();
|
||||||
|
|
||||||
if ((bool) config_cache('pixelfed.cloud_storage') && (bool) config_cache('media.delete_local_after_cloud')) {
|
if ((bool) config_cache('pixelfed.cloud_storage') && (bool) config_cache('media.delete_local_after_cloud')) {
|
||||||
$schedule->command('media:s3gc')->hourlyAt(15);
|
$schedule->command('media:s3gc')->hourlyAt(15);
|
||||||
|
@ -60,7 +60,7 @@ class Kernel extends ConsoleKernel
|
||||||
*/
|
*/
|
||||||
protected function commands()
|
protected function commands()
|
||||||
{
|
{
|
||||||
$this->load(__DIR__ . '/Commands');
|
$this->load(__DIR__.'/Commands');
|
||||||
|
|
||||||
require base_path('routes/console.php');
|
require base_path('routes/console.php');
|
||||||
}
|
}
|
||||||
|
|
|
@ -4204,4 +4204,26 @@ class ApiV1Controller extends Controller
|
||||||
|
|
||||||
return $this->json([]);
|
return $this->json([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /api/v1/instance/peers
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function instancePeers(Request $request)
|
||||||
|
{
|
||||||
|
if ((bool) config('instance.show_peers') == false) {
|
||||||
|
return $this->json([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->json(
|
||||||
|
Cache::remember(InstanceService::CACHE_KEY_API_PEERS_LIST, now()->addHours(24), function () {
|
||||||
|
return Instance::whereNotNull('nodeinfo_last_fetched')
|
||||||
|
->whereBanned(false)
|
||||||
|
->where('nodeinfo_last_fetched', '>', now()->subDays(8))
|
||||||
|
->pluck('domain');
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,76 +2,84 @@
|
||||||
|
|
||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
use Cache;
|
|
||||||
use App\Instance;
|
use App\Instance;
|
||||||
use App\Util\Blurhash\Blurhash;
|
use App\Util\Blurhash\Blurhash;
|
||||||
use App\Services\ConfigCacheService;
|
use Cache;
|
||||||
|
|
||||||
class InstanceService
|
class InstanceService
|
||||||
{
|
{
|
||||||
const CACHE_KEY_BY_DOMAIN = 'pf:services:instance:by_domain:';
|
const CACHE_KEY_BY_DOMAIN = 'pf:services:instance:by_domain:';
|
||||||
const CACHE_KEY_BANNED_DOMAINS = 'instances:banned:domains';
|
|
||||||
const CACHE_KEY_UNLISTED_DOMAINS = 'instances:unlisted:domains';
|
|
||||||
const CACHE_KEY_NSFW_DOMAINS = 'instances:auto_cw:domains';
|
|
||||||
const CACHE_KEY_STATS = 'pf:services:instances:stats';
|
|
||||||
const CACHE_KEY_BANNER_BLURHASH = 'pf:services:instance:header-blurhash:v1';
|
|
||||||
|
|
||||||
public function __construct()
|
const CACHE_KEY_BANNED_DOMAINS = 'instances:banned:domains';
|
||||||
{
|
|
||||||
ini_set('memory_limit', config('pixelfed.memory_limit', '1024M'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getByDomain($domain)
|
const CACHE_KEY_UNLISTED_DOMAINS = 'instances:unlisted:domains';
|
||||||
{
|
|
||||||
return Cache::remember(self::CACHE_KEY_BY_DOMAIN.$domain, 3600, function() use($domain) {
|
|
||||||
return Instance::whereDomain($domain)->first();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getBannedDomains()
|
const CACHE_KEY_NSFW_DOMAINS = 'instances:auto_cw:domains';
|
||||||
{
|
|
||||||
return Cache::remember(self::CACHE_KEY_BANNED_DOMAINS, 1209600, function() {
|
|
||||||
return Instance::whereBanned(true)->pluck('domain')->toArray();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getUnlistedDomains()
|
const CACHE_KEY_STATS = 'pf:services:instances:stats';
|
||||||
{
|
|
||||||
return Cache::remember(self::CACHE_KEY_UNLISTED_DOMAINS, 1209600, function() {
|
|
||||||
return Instance::whereUnlisted(true)->pluck('domain')->toArray();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getNsfwDomains()
|
const CACHE_KEY_BANNER_BLURHASH = 'pf:services:instance:header-blurhash:v1';
|
||||||
{
|
|
||||||
return Cache::remember(self::CACHE_KEY_NSFW_DOMAINS, 1209600, function() {
|
|
||||||
return Instance::whereAutoCw(true)->pluck('domain')->toArray();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function software($domain)
|
const CACHE_KEY_API_PEERS_LIST = 'pf:services:instance:api:peers:list:v0';
|
||||||
{
|
|
||||||
$key = 'instances:software:' . strtolower($domain);
|
|
||||||
return Cache::remember($key, 86400, function() use($domain) {
|
|
||||||
$instance = Instance::whereDomain($domain)->first();
|
|
||||||
if(!$instance) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return $instance->software;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function stats()
|
public function __construct()
|
||||||
{
|
{
|
||||||
return Cache::remember(self::CACHE_KEY_STATS, 86400, function() {
|
ini_set('memory_limit', config('pixelfed.memory_limit', '1024M'));
|
||||||
return [
|
}
|
||||||
'total_count' => Instance::count(),
|
|
||||||
'new_count' => Instance::where('created_at', '>', now()->subDays(14))->count(),
|
public static function getByDomain($domain)
|
||||||
'banned_count' => Instance::whereBanned(true)->count(),
|
{
|
||||||
'nsfw_count' => Instance::whereAutoCw(true)->count()
|
return Cache::remember(self::CACHE_KEY_BY_DOMAIN.$domain, 3600, function () use ($domain) {
|
||||||
];
|
return Instance::whereDomain($domain)->first();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getBannedDomains()
|
||||||
|
{
|
||||||
|
return Cache::remember(self::CACHE_KEY_BANNED_DOMAINS, 1209600, function () {
|
||||||
|
return Instance::whereBanned(true)->pluck('domain')->toArray();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getUnlistedDomains()
|
||||||
|
{
|
||||||
|
return Cache::remember(self::CACHE_KEY_UNLISTED_DOMAINS, 1209600, function () {
|
||||||
|
return Instance::whereUnlisted(true)->pluck('domain')->toArray();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNsfwDomains()
|
||||||
|
{
|
||||||
|
return Cache::remember(self::CACHE_KEY_NSFW_DOMAINS, 1209600, function () {
|
||||||
|
return Instance::whereAutoCw(true)->pluck('domain')->toArray();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function software($domain)
|
||||||
|
{
|
||||||
|
$key = 'instances:software:'.strtolower($domain);
|
||||||
|
|
||||||
|
return Cache::remember($key, 86400, function () use ($domain) {
|
||||||
|
$instance = Instance::whereDomain($domain)->first();
|
||||||
|
if (! $instance) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $instance->software;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function stats()
|
||||||
|
{
|
||||||
|
return Cache::remember(self::CACHE_KEY_STATS, 86400, function () {
|
||||||
|
return [
|
||||||
|
'total_count' => Instance::count(),
|
||||||
|
'new_count' => Instance::where('created_at', '>', now()->subDays(14))->count(),
|
||||||
|
'banned_count' => Instance::whereBanned(true)->count(),
|
||||||
|
'nsfw_count' => Instance::whereAutoCw(true)->count(),
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public static function refresh()
|
public static function refresh()
|
||||||
{
|
{
|
||||||
|
@ -79,6 +87,7 @@ class InstanceService
|
||||||
Cache::forget(self::CACHE_KEY_UNLISTED_DOMAINS);
|
Cache::forget(self::CACHE_KEY_UNLISTED_DOMAINS);
|
||||||
Cache::forget(self::CACHE_KEY_NSFW_DOMAINS);
|
Cache::forget(self::CACHE_KEY_NSFW_DOMAINS);
|
||||||
Cache::forget(self::CACHE_KEY_STATS);
|
Cache::forget(self::CACHE_KEY_STATS);
|
||||||
|
Cache::forget(self::CACHE_KEY_API_PEERS_LIST);
|
||||||
|
|
||||||
self::getBannedDomains();
|
self::getBannedDomains();
|
||||||
self::getUnlistedDomains();
|
self::getUnlistedDomains();
|
||||||
|
@ -89,50 +98,50 @@ class InstanceService
|
||||||
|
|
||||||
public static function headerBlurhash()
|
public static function headerBlurhash()
|
||||||
{
|
{
|
||||||
return Cache::rememberForever(self::CACHE_KEY_BANNER_BLURHASH, function() {
|
return Cache::rememberForever(self::CACHE_KEY_BANNER_BLURHASH, function () {
|
||||||
if(str_ends_with(config_cache('app.banner_image'), 'headers/default.jpg')) {
|
if (str_ends_with(config_cache('app.banner_image'), 'headers/default.jpg')) {
|
||||||
return 'UzJR]l{wHZRjM}R%XRkCH?X9xaWEjZj]kAjt';
|
return 'UzJR]l{wHZRjM}R%XRkCH?X9xaWEjZj]kAjt';
|
||||||
}
|
}
|
||||||
$cached = config_cache('instance.banner.blurhash');
|
$cached = config_cache('instance.banner.blurhash');
|
||||||
|
|
||||||
if($cached) {
|
if ($cached) {
|
||||||
return $cached;
|
return $cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = config_cache('app.banner_image') ?? url(Storage::url('public/headers/default.jpg'));
|
$file = config_cache('app.banner_image') ?? url(Storage::url('public/headers/default.jpg'));
|
||||||
|
|
||||||
$image = imagecreatefromstring(file_get_contents($file));
|
$image = imagecreatefromstring(file_get_contents($file));
|
||||||
if(!$image) {
|
if (! $image) {
|
||||||
return 'UzJR]l{wHZRjM}R%XRkCH?X9xaWEjZj]kAjt';
|
return 'UzJR]l{wHZRjM}R%XRkCH?X9xaWEjZj]kAjt';
|
||||||
}
|
}
|
||||||
$width = imagesx($image);
|
$width = imagesx($image);
|
||||||
$height = imagesy($image);
|
$height = imagesy($image);
|
||||||
|
|
||||||
$pixels = [];
|
$pixels = [];
|
||||||
for ($y = 0; $y < $height; ++$y) {
|
for ($y = 0; $y < $height; $y++) {
|
||||||
$row = [];
|
$row = [];
|
||||||
for ($x = 0; $x < $width; ++$x) {
|
for ($x = 0; $x < $width; $x++) {
|
||||||
$index = imagecolorat($image, $x, $y);
|
$index = imagecolorat($image, $x, $y);
|
||||||
$colors = imagecolorsforindex($image, $index);
|
$colors = imagecolorsforindex($image, $index);
|
||||||
|
|
||||||
$row[] = [$colors['red'], $colors['green'], $colors['blue']];
|
$row[] = [$colors['red'], $colors['green'], $colors['blue']];
|
||||||
}
|
}
|
||||||
$pixels[] = $row;
|
$pixels[] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free the allocated GdImage object from memory:
|
// Free the allocated GdImage object from memory:
|
||||||
imagedestroy($image);
|
imagedestroy($image);
|
||||||
|
|
||||||
$components_x = 4;
|
$components_x = 4;
|
||||||
$components_y = 4;
|
$components_y = 4;
|
||||||
$blurhash = Blurhash::encode($pixels, $components_x, $components_y);
|
$blurhash = Blurhash::encode($pixels, $components_x, $components_y);
|
||||||
if(strlen($blurhash) > 191) {
|
if (strlen($blurhash) > 191) {
|
||||||
return 'UzJR]l{wHZRjM}R%XRkCH?X9xaWEjZj]kAjt';
|
return 'UzJR]l{wHZRjM}R%XRkCH?X9xaWEjZj]kAjt';
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigCacheService::put('instance.banner.blurhash', $blurhash);
|
ConfigCacheService::put('instance.banner.blurhash', $blurhash);
|
||||||
|
|
||||||
return $blurhash;
|
return $blurhash;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,136 +1,136 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'force_https_urls' => env('FORCE_HTTPS_URLS', true),
|
'force_https_urls' => env('FORCE_HTTPS_URLS', true),
|
||||||
|
|
||||||
'description' => env('INSTANCE_DESCRIPTION', 'Pixelfed - Photo sharing for everyone'),
|
'description' => env('INSTANCE_DESCRIPTION', 'Pixelfed - Photo sharing for everyone'),
|
||||||
|
|
||||||
'contact' => [
|
'contact' => [
|
||||||
'enabled' => env('INSTANCE_CONTACT_FORM', false),
|
'enabled' => env('INSTANCE_CONTACT_FORM', false),
|
||||||
'max_per_day' => env('INSTANCE_CONTACT_MAX_PER_DAY', 1),
|
'max_per_day' => env('INSTANCE_CONTACT_MAX_PER_DAY', 1),
|
||||||
],
|
],
|
||||||
|
|
||||||
'discover' => [
|
'discover' => [
|
||||||
'public' => env('INSTANCE_DISCOVER_PUBLIC', false),
|
'public' => env('INSTANCE_DISCOVER_PUBLIC', false),
|
||||||
'loops' => [
|
'loops' => [
|
||||||
'enabled' => env('EXP_LOOPS', false),
|
'enabled' => env('EXP_LOOPS', false),
|
||||||
],
|
],
|
||||||
'tags' => [
|
'tags' => [
|
||||||
'is_public' => env('INSTANCE_PUBLIC_HASHTAGS', false)
|
'is_public' => env('INSTANCE_PUBLIC_HASHTAGS', false),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'email' => env('INSTANCE_CONTACT_EMAIL'),
|
'email' => env('INSTANCE_CONTACT_EMAIL'),
|
||||||
|
|
||||||
'timeline' => [
|
'timeline' => [
|
||||||
'home' => [
|
'home' => [
|
||||||
'cached' => env('PF_HOME_TIMELINE_CACHE', false),
|
'cached' => env('PF_HOME_TIMELINE_CACHE', false),
|
||||||
'cache_ttl' => env('PF_HOME_TIMELINE_CACHE_TTL', 900)
|
'cache_ttl' => env('PF_HOME_TIMELINE_CACHE_TTL', 900),
|
||||||
],
|
],
|
||||||
|
|
||||||
'local' => [
|
'local' => [
|
||||||
'cached' => env('INSTANCE_PUBLIC_TIMELINE_CACHED', false),
|
'cached' => env('INSTANCE_PUBLIC_TIMELINE_CACHED', false),
|
||||||
'is_public' => env('INSTANCE_PUBLIC_LOCAL_TIMELINE', false)
|
'is_public' => env('INSTANCE_PUBLIC_LOCAL_TIMELINE', false),
|
||||||
],
|
],
|
||||||
|
|
||||||
'network' => [
|
'network' => [
|
||||||
'cached' => env('PF_NETWORK_TIMELINE') ? env('INSTANCE_NETWORK_TIMELINE_CACHED', false) : false,
|
'cached' => env('PF_NETWORK_TIMELINE') ? env('INSTANCE_NETWORK_TIMELINE_CACHED', false) : false,
|
||||||
'cache_dropoff' => env('INSTANCE_NETWORK_TIMELINE_CACHE_DROPOFF', 100),
|
'cache_dropoff' => env('INSTANCE_NETWORK_TIMELINE_CACHE_DROPOFF', 100),
|
||||||
'max_hours_old' => env('INSTANCE_NETWORK_TIMELINE_CACHE_MAX_HOUR_INGEST', 6)
|
'max_hours_old' => env('INSTANCE_NETWORK_TIMELINE_CACHE_MAX_HOUR_INGEST', 6),
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'page' => [
|
'page' => [
|
||||||
'404' => [
|
'404' => [
|
||||||
'header' => env('PAGE_404_HEADER', 'Sorry, this page isn\'t available.'),
|
'header' => env('PAGE_404_HEADER', 'Sorry, this page isn\'t available.'),
|
||||||
'body' => env('PAGE_404_BODY', 'The link you followed may be broken, or the page may have been removed. <a href="/">Go back to Pixelfed.</a>')
|
'body' => env('PAGE_404_BODY', 'The link you followed may be broken, or the page may have been removed. <a href="/">Go back to Pixelfed.</a>'),
|
||||||
],
|
],
|
||||||
'503' => [
|
'503' => [
|
||||||
'header' => env('PAGE_503_HEADER', 'Service Unavailable'),
|
'header' => env('PAGE_503_HEADER', 'Service Unavailable'),
|
||||||
'body' => env('PAGE_503_BODY', 'Our service is in maintenance mode, please try again later.')
|
'body' => env('PAGE_503_BODY', 'Our service is in maintenance mode, please try again later.'),
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'username' => [
|
'username' => [
|
||||||
'banned' => env('BANNED_USERNAMES'),
|
'banned' => env('BANNED_USERNAMES'),
|
||||||
'remote' => [
|
'remote' => [
|
||||||
'formats' => ['@', 'from', 'custom'],
|
'formats' => ['@', 'from', 'custom'],
|
||||||
'format' => in_array(env('USERNAME_REMOTE_FORMAT', '@'), ['@','from','custom']) ? env('USERNAME_REMOTE_FORMAT', '@') : '@',
|
'format' => in_array(env('USERNAME_REMOTE_FORMAT', '@'), ['@', 'from', 'custom']) ? env('USERNAME_REMOTE_FORMAT', '@') : '@',
|
||||||
'custom' => env('USERNAME_REMOTE_CUSTOM_TEXT', null)
|
'custom' => env('USERNAME_REMOTE_CUSTOM_TEXT', null),
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'polls' => [
|
'polls' => [
|
||||||
'enabled' => false
|
'enabled' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
'stories' => [
|
'stories' => [
|
||||||
'enabled' => env('STORIES_ENABLED', false),
|
'enabled' => env('STORIES_ENABLED', false),
|
||||||
],
|
],
|
||||||
|
|
||||||
'restricted' => [
|
'restricted' => [
|
||||||
'enabled' => env('RESTRICTED_INSTANCE', false),
|
'enabled' => env('RESTRICTED_INSTANCE', false),
|
||||||
'level' => 1
|
'level' => 1,
|
||||||
],
|
],
|
||||||
|
|
||||||
'oauth' => [
|
'oauth' => [
|
||||||
'token_expiration' => env('OAUTH_TOKEN_DAYS', 365),
|
'token_expiration' => env('OAUTH_TOKEN_DAYS', 365),
|
||||||
'refresh_expiration' => env('OAUTH_REFRESH_DAYS', 400),
|
'refresh_expiration' => env('OAUTH_REFRESH_DAYS', 400),
|
||||||
'pat' => [
|
'pat' => [
|
||||||
'enabled' => env('OAUTH_PAT_ENABLED', false),
|
'enabled' => env('OAUTH_PAT_ENABLED', false),
|
||||||
'id' => env('OAUTH_PAT_ID'),
|
'id' => env('OAUTH_PAT_ID'),
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'label' => [
|
'label' => [
|
||||||
'covid' => [
|
'covid' => [
|
||||||
'enabled' => env('ENABLE_COVID_LABEL', true),
|
'enabled' => env('ENABLE_COVID_LABEL', true),
|
||||||
'url' => env('COVID_LABEL_URL', 'https://www.who.int/emergencies/diseases/novel-coronavirus-2019/advice-for-public'),
|
'url' => env('COVID_LABEL_URL', 'https://www.who.int/emergencies/diseases/novel-coronavirus-2019/advice-for-public'),
|
||||||
'org' => env('COVID_LABEL_ORG', 'visit the WHO website')
|
'org' => env('COVID_LABEL_ORG', 'visit the WHO website'),
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'enable_cc' => env('ENABLE_CONFIG_CACHE', true),
|
'enable_cc' => env('ENABLE_CONFIG_CACHE', true),
|
||||||
|
|
||||||
'has_legal_notice' => env('INSTANCE_LEGAL_NOTICE', false),
|
'has_legal_notice' => env('INSTANCE_LEGAL_NOTICE', false),
|
||||||
|
|
||||||
'embed' => [
|
'embed' => [
|
||||||
'profile' => env('INSTANCE_PROFILE_EMBEDS', true),
|
'profile' => env('INSTANCE_PROFILE_EMBEDS', true),
|
||||||
'post' => env('INSTANCE_POST_EMBEDS', true),
|
'post' => env('INSTANCE_POST_EMBEDS', true),
|
||||||
],
|
],
|
||||||
|
|
||||||
'hide_nsfw_on_public_feeds' => env('PF_HIDE_NSFW_ON_PUBLIC_FEEDS', false),
|
'hide_nsfw_on_public_feeds' => env('PF_HIDE_NSFW_ON_PUBLIC_FEEDS', false),
|
||||||
|
|
||||||
'avatar' => [
|
'avatar' => [
|
||||||
'local_to_cloud' => env('PF_LOCAL_AVATAR_TO_CLOUD', false)
|
'local_to_cloud' => env('PF_LOCAL_AVATAR_TO_CLOUD', false),
|
||||||
],
|
],
|
||||||
|
|
||||||
'admin_invites' => [
|
'admin_invites' => [
|
||||||
'enabled' => env('PF_ADMIN_INVITES_ENABLED', true)
|
'enabled' => env('PF_ADMIN_INVITES_ENABLED', true),
|
||||||
],
|
],
|
||||||
|
|
||||||
'user_filters' => [
|
'user_filters' => [
|
||||||
'max_user_blocks' => env('PF_MAX_USER_BLOCKS', 50),
|
'max_user_blocks' => env('PF_MAX_USER_BLOCKS', 50),
|
||||||
'max_user_mutes' => env('PF_MAX_USER_MUTES', 50),
|
'max_user_mutes' => env('PF_MAX_USER_MUTES', 50),
|
||||||
'max_domain_blocks' => env('PF_MAX_DOMAIN_BLOCKS', 50),
|
'max_domain_blocks' => env('PF_MAX_DOMAIN_BLOCKS', 50),
|
||||||
],
|
],
|
||||||
|
|
||||||
'reports' => [
|
'reports' => [
|
||||||
'email' => [
|
'email' => [
|
||||||
'enabled' => env('INSTANCE_REPORTS_EMAIL_ENABLED', false),
|
'enabled' => env('INSTANCE_REPORTS_EMAIL_ENABLED', false),
|
||||||
'to' => env('INSTANCE_REPORTS_EMAIL_ADDRESSES'),
|
'to' => env('INSTANCE_REPORTS_EMAIL_ADDRESSES'),
|
||||||
'autospam' => env('INSTANCE_REPORTS_EMAIL_AUTOSPAM', false)
|
'autospam' => env('INSTANCE_REPORTS_EMAIL_AUTOSPAM', false),
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'landing' => [
|
'landing' => [
|
||||||
'show_directory' => env('INSTANCE_LANDING_SHOW_DIRECTORY', true),
|
'show_directory' => env('INSTANCE_LANDING_SHOW_DIRECTORY', true),
|
||||||
'show_explore' => env('INSTANCE_LANDING_SHOW_EXPLORE', true),
|
'show_explore' => env('INSTANCE_LANDING_SHOW_EXPLORE', true),
|
||||||
],
|
],
|
||||||
|
|
||||||
'banner' => [
|
'banner' => [
|
||||||
'blurhash' => env('INSTANCE_BANNER_BLURHASH', 'UzJR]l{wHZRjM}R%XRkCH?X9xaWEjZj]kAjt')
|
'blurhash' => env('INSTANCE_BANNER_BLURHASH', 'UzJR]l{wHZRjM}R%XRkCH?X9xaWEjZj]kAjt'),
|
||||||
],
|
],
|
||||||
|
|
||||||
'parental_controls' => [
|
'parental_controls' => [
|
||||||
'enabled' => env('INSTANCE_PARENTAL_CONTROLS', false),
|
'enabled' => env('INSTANCE_PARENTAL_CONTROLS', false),
|
||||||
|
@ -143,14 +143,14 @@ return [
|
||||||
],
|
],
|
||||||
|
|
||||||
'software-update' => [
|
'software-update' => [
|
||||||
'disable_failed_warning' => env('INSTANCE_SOFTWARE_UPDATE_DISABLE_FAILED_WARNING', false)
|
'disable_failed_warning' => env('INSTANCE_SOFTWARE_UPDATE_DISABLE_FAILED_WARNING', false),
|
||||||
],
|
],
|
||||||
|
|
||||||
'notifications' => [
|
'notifications' => [
|
||||||
'gc' => [
|
'gc' => [
|
||||||
'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),
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'curated_registration' => [
|
'curated_registration' => [
|
||||||
|
@ -173,7 +173,9 @@ return [
|
||||||
'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),
|
||||||
],
|
],
|
||||||
'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),
|
||||||
]
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'show_peers' => env('INSTANCE_SHOW_PEERS', false),
|
||||||
];
|
];
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('instances', function (Blueprint $table) {
|
||||||
|
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||||
|
$indexesFound = $schemaManager->listTableIndexes('instances');
|
||||||
|
if (! array_key_exists('instances_nodeinfo_last_fetched_index', $indexesFound)) {
|
||||||
|
$table->index('nodeinfo_last_fetched');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('instances', function (Blueprint $table) {
|
||||||
|
$schemaManager = Schema::getConnection()->getDoctrineSchemaManager();
|
||||||
|
$indexesFound = $schemaManager->listTableIndexes('instances');
|
||||||
|
if (array_key_exists('instances_nodeinfo_last_fetched_index', $indexesFound)) {
|
||||||
|
$table->dropIndex('instances_nodeinfo_last_fetched_index');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
|
@ -26,6 +26,7 @@ Route::group(['prefix' => 'api'], function() use($middleware) {
|
||||||
Route::post('apps', 'Api\ApiV1Controller@apps');
|
Route::post('apps', 'Api\ApiV1Controller@apps');
|
||||||
Route::get('apps/verify_credentials', 'Api\ApiV1Controller@getApp')->middleware($middleware);
|
Route::get('apps/verify_credentials', 'Api\ApiV1Controller@getApp')->middleware($middleware);
|
||||||
Route::get('instance', 'Api\ApiV1Controller@instance');
|
Route::get('instance', 'Api\ApiV1Controller@instance');
|
||||||
|
Route::get('instance/peers', 'Api\ApiV1Controller@instancePeers');
|
||||||
Route::get('bookmarks', 'Api\ApiV1Controller@bookmarks')->middleware($middleware);
|
Route::get('bookmarks', 'Api\ApiV1Controller@bookmarks')->middleware($middleware);
|
||||||
|
|
||||||
Route::get('accounts/verify_credentials', 'Api\ApiV1Controller@verifyCredentials')->middleware($middleware);
|
Route::get('accounts/verify_credentials', 'Api\ApiV1Controller@verifyCredentials')->middleware($middleware);
|
||||||
|
|
Loading…
Reference in a new issue