fork
Configure Feed
Select the types of activity you want to include in your feed.
Live video on the AT Protocol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1package atproto
2
3import (
4 "strings"
5
6 comatproto "github.com/bluesky-social/indigo/api/atproto"
7)
8
9const (
10 // from com.atproto.label.defs
11 LabelHide = "!hide"
12 LabelNoPromote = "!no-promote"
13 LabelWarn = "!warn"
14 LabelNoUnauthenticated = "!no-unauthenticated"
15 LabelDMCAViolation = "dmca-violation"
16 LabelDoxxing = "doxxing"
17 LabelPorn = "porn"
18 LabelSexual = "sexual"
19 LabelNudity = "nudity"
20 LabelNSFL = "nsfl"
21 LabelGore = "gore"
22
23 // referenced in https://atproto.com/specs/label
24 LabelTakedown = "!takedown"
25 LabelSuspend = "!suspend"
26
27 // borrowed from moderation.bsky.app
28 LabelSexualFigurative = "sexual-figurative"
29 LabelGraphicMedia = "graphic-media"
30 LabelSelfHarm = "self-harm"
31 LabelSensitive = "sensitive"
32 LabelExtremist = "extremist"
33 LabelIntolerant = "intolerant"
34 LabelThreat = "threat"
35 LabelRude = "rude"
36 LabelIllicit = "illicit"
37 LabelSecurity = "security"
38 LabelUnsafeLink = "unsafe-link"
39 LabelImpersonation = "impersonation"
40 LabelMisinformation = "misinformation"
41 LabelScam = "scam"
42 LabelEngagementFarming = "engagement-farming"
43 LabelSpam = "spam"
44 LabelRumor = "rumor"
45 LabelMisleading = "misleading"
46 LabelInauthentic = "inauthentic"
47)
48
49var bannedLabels = map[string]bool{
50 LabelDMCAViolation: true,
51 LabelDoxxing: true,
52 LabelPorn: true,
53 LabelSexual: true,
54 LabelNudity: true,
55 LabelNSFL: true,
56 LabelGore: true,
57 LabelTakedown: true,
58 LabelSuspend: true,
59 LabelSexualFigurative: true,
60 LabelGraphicMedia: true,
61 LabelSelfHarm: true,
62 LabelSensitive: true,
63 LabelExtremist: true,
64 LabelIntolerant: true,
65 LabelThreat: true,
66 LabelRude: true,
67 LabelIllicit: true,
68 LabelSecurity: true,
69 LabelUnsafeLink: true,
70 LabelImpersonation: true,
71 LabelMisinformation: true,
72 LabelScam: true,
73 LabelEngagementFarming: true,
74 LabelSpam: true,
75 LabelRumor: true,
76 LabelMisleading: true,
77 LabelInauthentic: true,
78}
79
80// Given a users' labels, determine if they are banned
81func IsBanned(labels ...*comatproto.LabelDefs_Label) bool {
82 for _, l := range labels {
83 if !strings.HasPrefix(l.Uri, "did:") {
84 // this is a label on a record, not a user
85 continue
86 }
87 if bannedLabels[l.Val] {
88 return true
89 }
90 }
91 return false
92}
93
94var chatHiddenLabels = map[string]bool{
95 // from com.atproto.label.defs
96 LabelHide: true,
97 LabelNoPromote: true,
98 LabelWarn: true,
99 LabelNoUnauthenticated: true,
100 LabelDMCAViolation: true,
101 LabelDoxxing: true,
102 LabelPorn: true,
103 LabelSexual: true,
104 LabelNudity: true,
105 LabelNSFL: true,
106 LabelGore: true,
107 LabelTakedown: true,
108 LabelSuspend: true,
109 LabelSexualFigurative: true,
110 LabelGraphicMedia: true,
111 LabelSelfHarm: true,
112 LabelSensitive: true,
113 LabelExtremist: true,
114 LabelIntolerant: true,
115 LabelThreat: true,
116 LabelRude: true,
117 LabelIllicit: true,
118 LabelSecurity: true,
119 LabelUnsafeLink: true,
120 LabelImpersonation: true,
121 LabelMisinformation: true,
122 LabelScam: true,
123 LabelEngagementFarming: true,
124 LabelSpam: true,
125 LabelRumor: true,
126 LabelMisleading: true,
127 LabelInauthentic: true,
128}
129
130// Given a users' labels, determine if they are banned
131func IsChatHidden(labels ...*comatproto.LabelDefs_Label) bool {
132 for _, l := range labels {
133 if !strings.HasPrefix(l.Uri, "did:") {
134 // this is a label on a record, not a user
135 continue
136 }
137 if bannedLabels[l.Val] {
138 return true
139 }
140 }
141 return false
142}