instance.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <?php
  2. return [
  3. 'force_https_urls' => env('FORCE_HTTPS_URLS', true),
  4. 'description' => env('INSTANCE_DESCRIPTION', 'Pixelfed - Photo sharing for everyone'),
  5. 'contact' => [
  6. 'enabled' => env('INSTANCE_CONTACT_FORM', false),
  7. 'max_per_day' => env('INSTANCE_CONTACT_MAX_PER_DAY', 1),
  8. ],
  9. 'discover' => [
  10. 'public' => env('INSTANCE_DISCOVER_PUBLIC', false),
  11. 'loops' => [
  12. 'enabled' => env('EXP_LOOPS', false),
  13. ],
  14. 'tags' => [
  15. 'is_public' => env('INSTANCE_PUBLIC_HASHTAGS', false),
  16. ],
  17. 'beagle_api' => env('PF_INSTANCE_USE_BEAGLE_API', true),
  18. ],
  19. 'email' => env('INSTANCE_CONTACT_EMAIL'),
  20. 'timeline' => [
  21. 'home' => [
  22. 'cached' => env('PF_HOME_TIMELINE_CACHE', false),
  23. 'cache_ttl' => env('PF_HOME_TIMELINE_CACHE_TTL', 900),
  24. ],
  25. 'local' => [
  26. 'cached' => env('INSTANCE_PUBLIC_TIMELINE_CACHED', false),
  27. 'is_public' => env('INSTANCE_PUBLIC_LOCAL_TIMELINE', false),
  28. ],
  29. 'network' => [
  30. 'cached' => env('PF_NETWORK_TIMELINE') ? env('INSTANCE_NETWORK_TIMELINE_CACHED', false) : false,
  31. 'cache_dropoff' => env('INSTANCE_NETWORK_TIMELINE_CACHE_DROPOFF', 100),
  32. 'max_hours_old' => env('INSTANCE_NETWORK_TIMELINE_CACHE_MAX_HOUR_INGEST', 2160),
  33. ],
  34. ],
  35. 'page' => [
  36. '404' => [
  37. 'header' => env('PAGE_404_HEADER', 'Sorry, this page isn\'t available.'),
  38. '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>'),
  39. ],
  40. '503' => [
  41. 'header' => env('PAGE_503_HEADER', 'Service Unavailable'),
  42. 'body' => env('PAGE_503_BODY', 'Our service is in maintenance mode, please try again later.'),
  43. ],
  44. ],
  45. 'username' => [
  46. 'banned' => env('BANNED_USERNAMES'),
  47. 'remote' => [
  48. 'formats' => ['@', 'from', 'custom'],
  49. 'format' => in_array(env('USERNAME_REMOTE_FORMAT', '@'), ['@', 'from', 'custom']) ? env('USERNAME_REMOTE_FORMAT', '@') : '@',
  50. 'custom' => env('USERNAME_REMOTE_CUSTOM_TEXT', null),
  51. ],
  52. ],
  53. 'polls' => [
  54. 'enabled' => false,
  55. ],
  56. 'stories' => [
  57. 'enabled' => env('STORIES_ENABLED', false),
  58. ],
  59. 'restricted' => [
  60. 'enabled' => env('RESTRICTED_INSTANCE', false),
  61. 'level' => 1,
  62. ],
  63. 'oauth' => [
  64. 'token_expiration' => env('OAUTH_TOKEN_DAYS', 365),
  65. 'refresh_expiration' => env('OAUTH_REFRESH_DAYS', 400),
  66. 'pat' => [
  67. 'enabled' => env('OAUTH_PAT_ENABLED', false),
  68. 'id' => env('OAUTH_PAT_ID'),
  69. ],
  70. ],
  71. 'label' => [
  72. 'covid' => [
  73. 'enabled' => env('ENABLE_COVID_LABEL', true),
  74. 'url' => env('COVID_LABEL_URL', 'https://www.who.int/emergencies/diseases/novel-coronavirus-2019/advice-for-public'),
  75. 'org' => env('COVID_LABEL_ORG', 'visit the WHO website'),
  76. ],
  77. ],
  78. 'enable_cc' => env('ENABLE_CONFIG_CACHE', true),
  79. 'has_legal_notice' => env('INSTANCE_LEGAL_NOTICE', false),
  80. 'embed' => [
  81. 'profile' => env('INSTANCE_PROFILE_EMBEDS', true),
  82. 'post' => env('INSTANCE_POST_EMBEDS', true),
  83. ],
  84. 'hide_nsfw_on_public_feeds' => env('PF_HIDE_NSFW_ON_PUBLIC_FEEDS', false),
  85. 'avatar' => [
  86. 'local_to_cloud' => env('PF_LOCAL_AVATAR_TO_CLOUD', false),
  87. ],
  88. 'admin_invites' => [
  89. 'enabled' => env('PF_ADMIN_INVITES_ENABLED', true),
  90. ],
  91. 'user_filters' => [
  92. 'max_user_blocks' => env('PF_MAX_USER_BLOCKS', 50),
  93. 'max_user_mutes' => env('PF_MAX_USER_MUTES', 50),
  94. 'max_domain_blocks' => env('PF_MAX_DOMAIN_BLOCKS', 50),
  95. ],
  96. 'reports' => [
  97. 'email' => [
  98. 'enabled' => env('INSTANCE_REPORTS_EMAIL_ENABLED', false),
  99. 'to' => env('INSTANCE_REPORTS_EMAIL_ADDRESSES'),
  100. 'autospam' => env('INSTANCE_REPORTS_EMAIL_AUTOSPAM', false),
  101. ],
  102. ],
  103. 'landing' => [
  104. 'show_directory' => env('INSTANCE_LANDING_SHOW_DIRECTORY', true),
  105. 'show_explore' => env('INSTANCE_LANDING_SHOW_EXPLORE', true),
  106. ],
  107. 'banner' => [
  108. 'blurhash' => env('INSTANCE_BANNER_BLURHASH', 'UzJR]l{wHZRjM}R%XRkCH?X9xaWEjZj]kAjt'),
  109. ],
  110. 'parental_controls' => [
  111. 'enabled' => env('INSTANCE_PARENTAL_CONTROLS', false),
  112. 'limits' => [
  113. 'respect_open_registration' => env('INSTANCE_PARENTAL_CONTROLS_RESPECT_OPENREG', true),
  114. 'max_children' => env('INSTANCE_PARENTAL_CONTROLS_MAX_CHILDREN', 1),
  115. 'auto_verify_email' => true,
  116. ],
  117. ],
  118. 'software-update' => [
  119. 'disable_failed_warning' => env('INSTANCE_SOFTWARE_UPDATE_DISABLE_FAILED_WARNING', false),
  120. ],
  121. 'notifications' => [
  122. 'gc' => [
  123. 'enabled' => env('INSTANCE_NOTIFY_AUTO_GC', false),
  124. 'delete_after_days' => env('INSTANCE_NOTIFY_AUTO_GC_DEL_AFTER_DAYS', 365),
  125. ],
  126. 'nag' => [
  127. 'enabled' => (bool) env('INSTANCE_NOTIFY_APP_GATEWAY', true),
  128. 'api_key' => env('PIXELFED_PUSHGATEWAY_KEY', false),
  129. 'endpoint' => 'push.pixelfed.net',
  130. ],
  131. ],
  132. 'curated_registration' => [
  133. 'enabled' => env('INSTANCE_CUR_REG', false),
  134. 'resend_confirmation_limit' => env('INSTANCE_CUR_REG_RESEND_LIMIT', 5),
  135. 'captcha_enabled' => env('INSTANCE_CUR_REG_CAPTCHA', env('CAPTCHA_ENABLED', false)),
  136. 'state' => [
  137. 'fallback_on_closed_reg' => true,
  138. 'only_enabled_on_closed_reg' => env('INSTANCE_CUR_REG_STATE_ONLY_ON_CLOSED', true),
  139. ],
  140. 'notify' => [
  141. 'admin' => [
  142. 'on_verify_email' => [
  143. 'enabled' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_VERIFY', false),
  144. 'bundle' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_VERIFY_BUNDLE', false),
  145. 'max_per_day' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_VERIFY_MPD', 10),
  146. 'cc_addresses' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_VERIFY_CC'),
  147. ],
  148. 'on_user_response' => env('INSTANCE_CUR_REG_NOTIFY_ADMIN_ON_USER_RESPONSE', false),
  149. ],
  150. ],
  151. ],
  152. 'show_peers' => env('INSTANCE_SHOW_PEERS', false),
  153. 'allow_new_account_dms' => env('INSTANCE_ALLOW_NEW_DMS', true),
  154. 'total_count_estimate' => env('INSTANCE_TOTAL_POSTS_COUNT_ESTIMATE', false),
  155. 'custom_filters' => [
  156. /*
  157. * The maximum number of characters from a status that will be scanned
  158. * for filter matching. Scanning too many characters can hurt performance,
  159. * so this limit ensures that only the most relevant portion of a status is processed.
  160. *
  161. * For remote statuses, you might want to increase this value if you expect
  162. * important content to appear later in long posts.
  163. */
  164. 'max_content_scan_limit' => env('PF_CF_CONTENT_SCAN_LIMIT', 2500),
  165. /*
  166. * The maximum number of filters a single user can create.
  167. * Limiting the number of filters per user helps prevent abuse and
  168. * ensures that the filtering system remains performant.
  169. */
  170. 'max_filters_per_user' => env('PF_CF_MAX_FILTERS_PER_USER', 20),
  171. /*
  172. * The maximum number of keywords that can be associated with a single filter.
  173. * This limit helps control the complexity of the generated regular expressions
  174. * and protects against potential performance issues during content scanning.
  175. */
  176. 'max_keywords_per_filter' => env('PF_CF_MAX_KEYWORDS_PER_FILTER', 10),
  177. /*
  178. * The maximum length allowed for each keyword in a filter.
  179. * Limiting keyword length not only curtails the size of the regex patterns created,
  180. * but also guards against potential abuse where excessively long keywords might
  181. * negatively impact matching performance or lead to unintended behavior.
  182. */
  183. 'max_keyword_length' => env('PF_CF_MAX_KEYWORD_LENGTH', 40),
  184. /*
  185. * The maximum allowed length for the combined regex pattern.
  186. * When constructing a regex that matches multiple filter keywords, each keyword
  187. * (after escaping and adding boundaries) contributes to the total pattern length.
  188. *
  189. * This value is set to 10000 by default. If you increase either the number of keywords
  190. * per filter or the maximum length allowed for each keyword, consider increasing this
  191. * limit accordingly so that the final regex pattern can accommodate the additional length
  192. * without being truncated or causing performance issues.
  193. */
  194. 'max_pattern_length' => env('PF_CF_MAX_PATTERN_LENGTH', 10000),
  195. /*
  196. * The maximum number of keyword matches to report for a given status.
  197. * When a filter is applied to a status, the matching process may find multiple occurrences
  198. * of a keyword. This value limits the number of matches that are reported back,
  199. * which helps manage output volume and processing overhead.
  200. *
  201. * The default is set to 10, but you can adjust this value through your environment configuration.
  202. */
  203. 'max_reported_matches' => env('PF_CF_MAX_REPORTED_MATCHES', 10),
  204. /*
  205. * The maximum number of filter creation operations allowed per hour for a non-admin user.
  206. * This rate limit prevents abuse by restricting how many filters a normal user can create
  207. * within one hour. Admin users are exempt from this limit.
  208. *
  209. * Default is 20 creations per hour.
  210. */
  211. 'max_create_per_hour' => env('PF_CF_MAX_CREATE_PER_HOUR', 20),
  212. /*
  213. * The maximum number of filter update operations allowed per hour for a non-admin user.
  214. * This rate limit is designed to prevent abuse by limiting how many times a normal user
  215. * can update their filters within one hour. Admin users are not subject to these limits.
  216. *
  217. * Default is 40 updates per hour.
  218. */
  219. 'max_updates_per_hour' => env('PF_CF_MAX_UPDATES_PER_HOUR', 40),
  220. ],
  221. ];