cfb4052180c131da50fa425c2cb4477b62faf523
[anni] / lib / pleroma / constants.ex
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
5 defmodule Pleroma.Constants do
6   use Const
7
8   const(as_public, do: "https://www.w3.org/ns/activitystreams#Public")
9
10   const(object_internal_fields,
11     do: [
12       "reactions",
13       "reaction_count",
14       "likes",
15       "like_count",
16       "announcements",
17       "announcement_count",
18       "emoji",
19       "context_id",
20       "deleted_activity_id",
21       "pleroma_internal",
22       "generator"
23     ]
24   )
25
26   const(static_only_files,
27     do:
28       ~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)
29   )
30
31   const(status_updatable_fields,
32     do: [
33       "source",
34       "tag",
35       "updated",
36       "emoji",
37       "content",
38       "summary",
39       "sensitive",
40       "attachment",
41       "generator"
42     ]
43   )
44
45   const(updatable_object_types,
46     do: [
47       "Note",
48       "Question",
49       "Audio",
50       "Video",
51       "Event",
52       "Article",
53       "Page"
54     ]
55   )
56
57   const(actor_types,
58     do: [
59       "Application",
60       "Group",
61       "Organization",
62       "Person",
63       "Service"
64     ]
65   )
66
67   # basic regex, just there to weed out potential mistakes
68   # https://datatracker.ietf.org/doc/html/rfc2045#section-5.1
69   const(mime_regex,
70     do: ~r/^[^[:cntrl:] ()<>@,;:\\"\/\[\]?=]+\/[^[:cntrl:] ()<>@,;:\\"\/\[\]?=]+(; .*)?$/
71   )
72 end