logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

constants.ex (3159B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Constants do
  5. use Const
  6. const(as_public, do: "https://www.w3.org/ns/activitystreams#Public")
  7. const(object_internal_fields,
  8. do: [
  9. "reactions",
  10. "reaction_count",
  11. "likes",
  12. "like_count",
  13. "announcements",
  14. "announcement_count",
  15. "emoji",
  16. "context_id",
  17. "deleted_activity_id",
  18. "pleroma_internal",
  19. "generator",
  20. "rules",
  21. "language",
  22. "voters"
  23. ]
  24. )
  25. const(static_only_files,
  26. do:
  27. ~w(index.html robots.txt static static-fe finmoji emoji packs sounds images instance sw.js sw-pleroma.js favicon.png schemas doc embed.js embed.css)
  28. )
  29. const(status_updatable_fields,
  30. do: [
  31. "source",
  32. "tag",
  33. "updated",
  34. "emoji",
  35. "content",
  36. "contentMap",
  37. "summary",
  38. "sensitive",
  39. "attachment",
  40. "generator",
  41. "language"
  42. ]
  43. )
  44. const(status_object_types,
  45. do: [
  46. "Note",
  47. "Question",
  48. "Audio",
  49. "Video",
  50. "Event",
  51. "Article",
  52. "Page"
  53. ]
  54. )
  55. const(updatable_object_types,
  56. do: [
  57. "Note",
  58. "Question",
  59. "Audio",
  60. "Video",
  61. "Event",
  62. "Article",
  63. "Page"
  64. ]
  65. )
  66. const(actor_types,
  67. do: [
  68. "Application",
  69. "Group",
  70. "Organization",
  71. "Person",
  72. "Service"
  73. ]
  74. )
  75. const(allowed_user_actor_types,
  76. do: [
  77. "Person",
  78. "Service",
  79. "Group"
  80. ]
  81. )
  82. const(activity_types,
  83. do: [
  84. "Block",
  85. "Create",
  86. "Update",
  87. "Delete",
  88. "Follow",
  89. "Accept",
  90. "Reject",
  91. "Add",
  92. "Remove",
  93. "Like",
  94. "Dislike",
  95. "Announce",
  96. "Undo",
  97. "Flag",
  98. "EmojiReact",
  99. "Listen"
  100. ]
  101. )
  102. const(allowed_activity_types_from_strangers,
  103. do: [
  104. "Block",
  105. "Create",
  106. "Flag",
  107. "Follow",
  108. "Like",
  109. "Dislike",
  110. "EmojiReact",
  111. "Announce"
  112. ]
  113. )
  114. const(object_types,
  115. do: ~w[Event Question Answer Audio Video Image Article Note Page ChatMessage]
  116. )
  117. # basic regex, just there to weed out potential mistakes
  118. # https://datatracker.ietf.org/doc/html/rfc2045#section-5.1
  119. const(mime_regex,
  120. do: ~r/^[^[:cntrl:] ()<>@,;:\\"\/\[\]?=]+\/[^[:cntrl:] ()<>@,;:\\"\/\[\]?=]+(; .*)?$/
  121. )
  122. # List of allowed chars in the path segment of a URI
  123. # unreserved, sub-delims, ":", "@" and "/" allowed as the separator in path
  124. # https://datatracker.ietf.org/doc/html/rfc3986
  125. const(uri_path_allowed_reserved_chars,
  126. do: ~c"!$&'()*+,;=/:@"
  127. )
  128. const(upload_object_types, do: ["Document", "Image"])
  129. const(activity_json_canonical_mime_type,
  130. do: "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""
  131. )
  132. const(activity_json_mime_types,
  133. do: [
  134. "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"",
  135. "application/activity+json"
  136. ]
  137. )
  138. const(public_streams,
  139. do: ["public", "public:local", "public:media", "public:local:media"]
  140. )
  141. end