Config.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace App\Util\Site;
  3. use Cache;
  4. use Illuminate\Support\Str;
  5. class Config {
  6. public static function get() {
  7. return Cache::remember('api:site:configuration:_v0.2', now()->addHours(30), function() {
  8. return [
  9. 'open_registration' => config('pixelfed.open_registration'),
  10. 'uploader' => [
  11. 'max_photo_size' => config('pixelfed.max_photo_size'),
  12. 'max_caption_length' => config('pixelfed.max_caption_length'),
  13. 'album_limit' => config('pixelfed.max_album_length'),
  14. 'image_quality' => config('pixelfed.image_quality'),
  15. 'max_collection_length' => config('pixelfed.max_collection_length', 18),
  16. 'optimize_image' => config('pixelfed.optimize_image'),
  17. 'optimize_video' => config('pixelfed.optimize_video'),
  18. 'media_types' => config('pixelfed.media_types'),
  19. 'enforce_account_limit' => config('pixelfed.enforce_account_limit')
  20. ],
  21. 'activitypub' => [
  22. 'enabled' => config('federation.activitypub.enabled'),
  23. 'remote_follow' => config('federation.activitypub.remoteFollow')
  24. ],
  25. 'ab' => [
  26. 'lc' => config('exp.lc'),
  27. 'rec' => config('exp.rec'),
  28. 'loops' => config('exp.loops'),
  29. 'top' => config('exp.top')
  30. ],
  31. 'site' => [
  32. 'name' => config('app.name', 'pixelfed'),
  33. 'domain' => config('pixelfed.domain.app'),
  34. 'url' => config('app.url'),
  35. 'description' => config('instance.description')
  36. ],
  37. 'username' => [
  38. 'remote' => [
  39. 'formats' => config('instance.username.remote.formats'),
  40. 'format' => config('instance.username.remote.format'),
  41. 'custom' => config('instance.username.remote.custom')
  42. ]
  43. ],
  44. 'features' => [
  45. 'mobile_apis' => config('pixelfed.oauth_enabled'),
  46. 'circles' => false,
  47. 'stories' => config('instance.stories.enabled'),
  48. 'video' => Str::contains(config('pixelfed.media_types'), 'video/mp4'),
  49. 'import' => [
  50. 'instagram' => config('pixelfed.import.instagram.enabled'),
  51. 'mastodon' => false,
  52. 'pixelfed' => false
  53. ],
  54. 'label' => [
  55. 'covid' => [
  56. 'enabled' => config('instance.label.covid.enabled'),
  57. 'org' => config('instance.label.covid.org'),
  58. 'url' => config('instance.label.covid.url'),
  59. ]
  60. ]
  61. ]
  62. ];
  63. });
  64. }
  65. public static function json() {
  66. return json_encode(self::get(), JSON_FORCE_OBJECT);
  67. }
  68. }