this repo has no description
1let rtype = event?.commit?.record?["$type"];
2
3if rtype == "app.bsky.feed.like" {
4 return update_match(build_aturi(event));
5}
6
7if rtype != "app.bsky.feed.post" {
8 return false;
9}
10
11// Reject posts where the created at is more than 8 days ago.
12// See https://docs.rs/duration-str/latest/duration_str/
13if matcher_before_duration("-8d", event?.commit?.record?.createdAt ?? "") {
14 return false;
15}
16
17const BAIL = [
18 // For obvious reasons, keep the feed to PG
19 "nsfw", "porn", "nsfl",
20 // Used a lot with tags like "dogsofbluesky"
21 "ofbluesky",
22 "ofbsky",
23 "onbsky",
24 "onbluesky",
25 // Stuff that is also "art" related is usually not developer releated.
26 "art", "illustration",
27];
28
29// Posts that reference one or more of these DIDs may be talking about something atmosphere related, but the weight isn't very high because sometimes posts are just trying to get attention for a feature request or support case.
30const DIDS = [
31 "did:plc:ewvi7nxzyoun6zhxrhs64oiz", // atproto.com
32 "did:plc:oc6vwdlmk2kqyida5i74d3p5", // support.bsky.team
33 "did:plc:lehcqqkwzcwvjvw66uthu5oq", // atprotocol.dev
34 "did:plc:z72i7hdynmk6r22z27h6tvur", // bsky.app
35 "did:plc:q6gjnaw2blty4crticxkmujt", // jaz.bsky.social
36 "did:plc:oky5czdrnfjpqslsw2a5iclo", // jay.bsky.team
37 "did:plc:ragtjsm2j2vknwkz3zp4oxrd", // pfrazee.com
38 "did:plc:cbkjy5n7bk3ax2wplmtjofq2", // ngerakines.me
39 "did:plc:tgudj2fjm77pzkuawquqhsxm", // smokesignal.events
40 "did:plc:kkoqcj4msmlta4nr47g6pk4r", // aviary.domains
41 "did:plc:klmr76mpewpv7rtm3xgpzd7x", // whtwnd.com
42 "did:plc:klmr76mpewpv7rtm3xgpzd7x", // frontpage.fyi
43 "did:plc:mdjhvva6vlrswsj26cftjttd", // laurenshof.online
44 "did:plc:gttrfs4hfmrclyxvwkwcgpj7", // aparker.io
45 "did:plc:w4xbfzo7kqfes5zb7r6qv3rw", // rudyfraser.com
46 "did:plc:7mnpet2pvof2llhpcwattscf", // stellz.xyz
47 "did:plc:by3jhwdqgbtrcc7q4tkkv3cf", // alice.mosphere.at
48 "did:plc:fpruhuo22xkm5o7ttr2ktxdo", // danabra.mov
49 "did:plc:tpg43qhh4lw4ksiffs4nbda3", // jacob.gold
50 "did:plc:vpkhqolt662uhesyj6nxm7ys", // why.bsky.team
51 "did:plc:2cxgdrgtsmrbqnjkwyplmp43", // bmann.ca
52 "did:plc:cak4klqoj3bqgk5rj6b4f5do", // mmasnick.bsky.social
53 "did:plc:44ybard66vv44zksje25o7dz", // bnewbold.net
54];
55
56let score = 0.0;
57
58const KEYWORDS = [
59 [["atproto"], 2.0],
60 [["appview"], 1.0],
61 [["feed", "generator"], 2.0],
62 [["pds"], 0.5],
63 [["jetstream"], 0.5],
64 [["firehose"], 0.5],
65 [["lexicon"], 0.5],
66 [["activitypub"], 0.5],
67 [["federation"], 0.5],
68 [["fediverse"], 0.5],
69 [["handle"], 0.3],
70 [["domain"], 0.3],
71 [["mastodon"], 0.3],
72 [["labeler"], 0.3],
73 [["ozone"], 0.3],
74 [["bluesky", "infra"], 2.0],
75];
76const TAGS = [
77 ["atproto", 2.0],
78 ["atprotocol", 2.0],
79 ["pds", 0.5],
80 ["atmosphere", 0.5],
81 ["ozone", 0.5],
82];
83
84const URLS = [
85 "https://atproto.com/",
86 "https://github.com/bluesky-social/",
87 "https://docs.bsky.app/",
88 "https://atprotocol.dev/",
89 "https://docs.smokesignal.events/",
90];
91
92let text = event?.commit?.record?.text ?? "";
93let text_normalized = text.to_lower();
94
95for token in BAIL {
96 if token in text_normalized {
97 return false;
98 }
99}
100
101for keyword in KEYWORDS {
102 if sequence_matches(keyword[0], text_normalized) {
103 score += keyword[1];
104 }
105}
106
107let embed_external_url = event?.commit?.record?.embed?.external?.uri ?? "";
108if !embed_external_url.is_empty() {
109 for needle in URLS {
110 if embed_external_url.starts_with(needle) {
111 score += 1.0;
112 }
113 }
114}
115
116let has_did = false;
117
118for facet in event?.commit?.record?.facets ?? [] {
119 for feature in facet?.features ?? [] {
120 switch feature?["$type"] {
121 "app.bsky.richtext.facet#mention" => {
122 let mention = feature?["did"] ?? "";
123 if !has_did && !mention.is_empty() {
124 if mention in DIDS {
125 has_did = true;
126 }
127 }
128 }
129 "app.bsky.richtext.facet#link" => {
130 let link = feature?["uri"] ?? "";
131 if !link.is_empty() {
132 for needle in URLS {
133 if link.starts_with(needle) {
134 score += 1.0;
135 break;
136 }
137 }
138 }
139 }
140 "app.bsky.richtext.facet#tag" => {
141 let tag = feature?["tag"] ?? "";
142 if !tag.is_empty() {
143 let tag_normalized = tag.to_lower();
144 for token in BAIL {
145 if token in tag_normalized {
146 return false;
147 }
148 }
149 for needle in TAGS {
150 if needle[0] == tag_normalized {
151 score += needle[1];
152 break;
153 }
154 }
155 }
156 }
157 _ => {}
158 }
159 }
160}
161
162if has_did {
163 score += 0.5;
164}
165if score >= 1.0 {
166 return build_aturi(event);
167}
168
169false