mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update Config util, add hls attributes
This commit is contained in:
parent
6cf4363c50
commit
5c358010b0
1 changed files with 85 additions and 71 deletions
|
@ -7,86 +7,100 @@ use Illuminate\Support\Str;
|
||||||
|
|
||||||
class Config {
|
class Config {
|
||||||
|
|
||||||
const CACHE_KEY = 'api:site:configuration:_v0.8';
|
const CACHE_KEY = 'api:site:configuration:_v0.8';
|
||||||
|
|
||||||
public static function get() {
|
public static function get() {
|
||||||
return Cache::remember(self::CACHE_KEY, 900, function() {
|
return Cache::remember(self::CACHE_KEY, 900, function() {
|
||||||
return [
|
$hls = [
|
||||||
'version' => config('pixelfed.version'),
|
'enabled' => config('media.hls.enabled'),
|
||||||
'open_registration' => (bool) config_cache('pixelfed.open_registration'),
|
];
|
||||||
'uploader' => [
|
if(config('media.hls.enabled')) {
|
||||||
'max_photo_size' => (int) config('pixelfed.max_photo_size'),
|
$hls = [
|
||||||
'max_caption_length' => (int) config('pixelfed.max_caption_length'),
|
'enabled' => true,
|
||||||
'max_altext_length' => (int) config('pixelfed.max_altext_length', 150),
|
'debug' => (bool) config('media.hls.debug'),
|
||||||
'album_limit' => (int) config_cache('pixelfed.max_album_length'),
|
'p2p' => (bool) config('media.hls.p2p'),
|
||||||
'image_quality' => (int) config_cache('pixelfed.image_quality'),
|
'p2p_debug' => (bool) config('media.hls.p2p_debug'),
|
||||||
|
'tracker' => config('media.hls.tracker'),
|
||||||
|
'ice' => config('media.hls.ice')
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
'version' => config('pixelfed.version'),
|
||||||
|
'open_registration' => (bool) config_cache('pixelfed.open_registration'),
|
||||||
|
'uploader' => [
|
||||||
|
'max_photo_size' => (int) config('pixelfed.max_photo_size'),
|
||||||
|
'max_caption_length' => (int) config('pixelfed.max_caption_length'),
|
||||||
|
'max_altext_length' => (int) config('pixelfed.max_altext_length', 150),
|
||||||
|
'album_limit' => (int) config_cache('pixelfed.max_album_length'),
|
||||||
|
'image_quality' => (int) config_cache('pixelfed.image_quality'),
|
||||||
|
|
||||||
'max_collection_length' => (int) config('pixelfed.max_collection_length', 18),
|
'max_collection_length' => (int) config('pixelfed.max_collection_length', 18),
|
||||||
|
|
||||||
'optimize_image' => (bool) config('pixelfed.optimize_image'),
|
'optimize_image' => (bool) config('pixelfed.optimize_image'),
|
||||||
'optimize_video' => (bool) config('pixelfed.optimize_video'),
|
'optimize_video' => (bool) config('pixelfed.optimize_video'),
|
||||||
|
|
||||||
'media_types' => config_cache('pixelfed.media_types'),
|
'media_types' => config_cache('pixelfed.media_types'),
|
||||||
'mime_types' => config_cache('pixelfed.media_types') ? explode(',', config_cache('pixelfed.media_types')) : [],
|
'mime_types' => config_cache('pixelfed.media_types') ? explode(',', config_cache('pixelfed.media_types')) : [],
|
||||||
'enforce_account_limit' => (bool) config_cache('pixelfed.enforce_account_limit')
|
'enforce_account_limit' => (bool) config_cache('pixelfed.enforce_account_limit')
|
||||||
],
|
],
|
||||||
|
|
||||||
'activitypub' => [
|
'activitypub' => [
|
||||||
'enabled' => (bool) config_cache('federation.activitypub.enabled'),
|
'enabled' => (bool) config_cache('federation.activitypub.enabled'),
|
||||||
'remote_follow' => config('federation.activitypub.remoteFollow')
|
'remote_follow' => config('federation.activitypub.remoteFollow')
|
||||||
],
|
],
|
||||||
|
|
||||||
'ab' => config('exp'),
|
'ab' => config('exp'),
|
||||||
|
|
||||||
'site' => [
|
'site' => [
|
||||||
'name' => config_cache('app.name'),
|
'name' => config_cache('app.name'),
|
||||||
'domain' => config('pixelfed.domain.app'),
|
'domain' => config('pixelfed.domain.app'),
|
||||||
'url' => config('app.url'),
|
'url' => config('app.url'),
|
||||||
'description' => config_cache('app.short_description')
|
'description' => config_cache('app.short_description')
|
||||||
],
|
],
|
||||||
|
|
||||||
'account' => [
|
'account' => [
|
||||||
'max_avatar_size' => config('pixelfed.max_avatar_size'),
|
'max_avatar_size' => config('pixelfed.max_avatar_size'),
|
||||||
'max_bio_length' => config('pixelfed.max_bio_length'),
|
'max_bio_length' => config('pixelfed.max_bio_length'),
|
||||||
'max_name_length' => config('pixelfed.max_name_length'),
|
'max_name_length' => config('pixelfed.max_name_length'),
|
||||||
'min_password_length' => config('pixelfed.min_password_length'),
|
'min_password_length' => config('pixelfed.min_password_length'),
|
||||||
'max_account_size' => config('pixelfed.max_account_size')
|
'max_account_size' => config('pixelfed.max_account_size')
|
||||||
],
|
],
|
||||||
|
|
||||||
'username' => [
|
'username' => [
|
||||||
'remote' => [
|
'remote' => [
|
||||||
'formats' => config('instance.username.remote.formats'),
|
'formats' => config('instance.username.remote.formats'),
|
||||||
'format' => config('instance.username.remote.format'),
|
'format' => config('instance.username.remote.format'),
|
||||||
'custom' => config('instance.username.remote.custom')
|
'custom' => config('instance.username.remote.custom')
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
'features' => [
|
'features' => [
|
||||||
'timelines' => [
|
'timelines' => [
|
||||||
'local' => true,
|
'local' => true,
|
||||||
'network' => (bool) config('federation.network_timeline'),
|
'network' => (bool) config('federation.network_timeline'),
|
||||||
],
|
],
|
||||||
'mobile_apis' => (bool) config_cache('pixelfed.oauth_enabled'),
|
'mobile_apis' => (bool) config_cache('pixelfed.oauth_enabled'),
|
||||||
'stories' => (bool) config_cache('instance.stories.enabled'),
|
'stories' => (bool) config_cache('instance.stories.enabled'),
|
||||||
'video' => Str::contains(config_cache('pixelfed.media_types'), 'video/mp4'),
|
'video' => Str::contains(config_cache('pixelfed.media_types'), 'video/mp4'),
|
||||||
'import' => [
|
'import' => [
|
||||||
'instagram' => (bool) config_cache('pixelfed.import.instagram.enabled'),
|
'instagram' => (bool) config_cache('pixelfed.import.instagram.enabled'),
|
||||||
'mastodon' => false,
|
'mastodon' => false,
|
||||||
'pixelfed' => false
|
'pixelfed' => false
|
||||||
],
|
],
|
||||||
'label' => [
|
'label' => [
|
||||||
'covid' => [
|
'covid' => [
|
||||||
'enabled' => (bool) config('instance.label.covid.enabled'),
|
'enabled' => (bool) config('instance.label.covid.enabled'),
|
||||||
'org' => config('instance.label.covid.org'),
|
'org' => config('instance.label.covid.org'),
|
||||||
'url' => config('instance.label.covid.url'),
|
'url' => config('instance.label.covid.url'),
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
]
|
'hls' => $hls
|
||||||
];
|
]
|
||||||
});
|
];
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public static function json() {
|
public static function json() {
|
||||||
return json_encode(self::get(), JSON_FORCE_OBJECT);
|
return json_encode(self::get(), JSON_FORCE_OBJECT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue