pixelfed/app/Util/Site/Config.php

75 lines
2.1 KiB
PHP
Raw Normal View History

2019-08-02 08:14:30 +00:00
<?php
namespace App\Util\Site;
use Cache;
2019-12-18 03:56:09 +00:00
use Illuminate\Support\Str;
2019-08-02 08:14:30 +00:00
class Config {
public static function get() {
2021-01-17 08:36:03 +00:00
return Cache::remember('api:site:configuration:_v0.1', now()->addHours(30), function() {
2019-08-02 08:14:30 +00:00
return [
2020-02-18 07:41:08 +00:00
'open_registration' => config('pixelfed.open_registration'),
2019-08-02 08:14:30 +00:00
'uploader' => [
'max_photo_size' => config('pixelfed.max_photo_size'),
'max_caption_length' => config('pixelfed.max_caption_length'),
'album_limit' => config('pixelfed.max_album_length'),
'image_quality' => config('pixelfed.image_quality'),
2020-12-10 08:02:56 +00:00
'max_collection_length' => config('pixelfed.max_collection_length', 18),
2019-08-02 08:14:30 +00:00
'optimize_image' => config('pixelfed.optimize_image'),
'optimize_video' => config('pixelfed.optimize_video'),
'media_types' => config('pixelfed.media_types'),
'enforce_account_limit' => config('pixelfed.enforce_account_limit')
],
'activitypub' => [
'enabled' => config('federation.activitypub.enabled'),
'remote_follow' => config('federation.activitypub.remoteFollow')
],
'ab' => [
'lc' => config('exp.lc'),
'rec' => config('exp.rec'),
2021-01-17 08:36:03 +00:00
'loops' => config('exp.loops'),
'top' => config('exp.top')
2019-08-02 08:14:30 +00:00
],
'site' => [
2020-02-18 07:41:08 +00:00
'name' => config('app.name', 'pixelfed'),
2019-08-02 08:14:30 +00:00
'domain' => config('pixelfed.domain.app'),
2019-12-18 03:56:09 +00:00
'url' => config('app.url'),
'description' => config('instance.description')
2019-11-03 03:12:44 +00:00
],
'username' => [
'remote' => [
'formats' => config('instance.username.remote.formats'),
'format' => config('instance.username.remote.format'),
'custom' => config('instance.username.remote.custom')
]
2019-12-18 03:56:09 +00:00
],
'features' => [
'mobile_apis' => config('pixelfed.oauth_enabled'),
'circles' => false,
2020-01-01 03:16:21 +00:00
'stories' => config('instance.stories.enabled'),
2019-12-18 03:56:09 +00:00
'video' => Str::contains(config('pixelfed.media_types'), 'video/mp4'),
'import' => [
'instagram' => config('pixelfed.import.instagram.enabled'),
'mastodon' => false,
'pixelfed' => false
]
2019-08-02 08:14:30 +00:00
]
];
});
}
public static function json() {
return json_encode(self::get(), JSON_FORCE_OBJECT);
}
}