Bluesky app fork with some witchin' additions 馃挮
witchsky.app
bluesky
fork
client
1import {BskyAgent} from '@atproto/api'
2
3import {logger} from '#/logger'
4import {device} from '#/storage'
5
6export const BR_LABELER = 'did:plc:ekitcvx7uwnauoqy5oest3hm' // Brazil
7export const DE_LABELER = 'did:plc:r55ow3tocux5kafs5dq445fy' // Germany
8export const RU_LABELER = 'did:plc:crm2agcxvvlj6hilnjdc4hox' // Russia
9export const GB_LABELER = 'did:plc:gvkp7euswjjrctjmqwhhfzif' // United Kingdom
10export const AU_LABELER = 'did:plc:dsynw7isrf2eqlhcjx3ffnmt' // Australia
11export const TR_LABELER = 'did:plc:cquoj7aozvmkud2gifeinkda' // Turkey
12export const JP_LABELER = 'did:plc:vhgppeyjwgrr37vm4v6ggd5a' // Japan
13export const ES_LABELER = 'did:plc:zlbbuj5nov4ixhvgl3bj47em' // Spain
14export const PK_LABELER = 'did:plc:zrp6a3tvprrsgawsbswbxu7m' // Pakistan
15export const IN_LABELER = 'did:plc:srr4rdvgzkbx6t7fxqtt6j5t' // India
16
17/**
18 * For all EU countries
19 */
20export const EU_LABELER = 'did:plc:z57lz5dhgz2dkjogoysm3vut'
21
22const MODERATION_AUTHORITIES: {
23 [countryCode: string]: string[]
24} = {
25 BR: [BR_LABELER], // Brazil
26 RU: [RU_LABELER], // Russia
27 GB: [GB_LABELER], // United Kingdom
28 AU: [AU_LABELER], // Australia
29 TR: [TR_LABELER], // Turkey
30 JP: [JP_LABELER], // Japan
31 PK: [PK_LABELER], // Pakistan
32 IN: [IN_LABELER], // India
33
34 // EU countries
35 AT: [EU_LABELER], // Austria
36 BE: [EU_LABELER], // Belgium
37 BG: [EU_LABELER], // Bulgaria
38 HR: [EU_LABELER], // Croatia
39 CY: [EU_LABELER], // Cyprus
40 CZ: [EU_LABELER], // Czech Republic
41 DK: [EU_LABELER], // Denmark
42 EE: [EU_LABELER], // Estonia
43 FI: [EU_LABELER], // Finland
44 FR: [EU_LABELER], // France
45 DE: [EU_LABELER, DE_LABELER], // Germany
46 GR: [EU_LABELER], // Greece
47 HU: [EU_LABELER], // Hungary
48 IE: [EU_LABELER], // Ireland
49 IT: [EU_LABELER], // Italy
50 LV: [EU_LABELER], // Latvia
51 LT: [EU_LABELER], // Lithuania
52 LU: [EU_LABELER], // Luxembourg
53 MT: [EU_LABELER], // Malta
54 NL: [EU_LABELER], // Netherlands
55 PL: [EU_LABELER], // Poland
56 PT: [EU_LABELER], // Portugal
57 RO: [EU_LABELER], // Romania
58 SK: [EU_LABELER], // Slovakia
59 SI: [EU_LABELER], // Slovenia
60 ES: [EU_LABELER, ES_LABELER], // Spain
61 SE: [EU_LABELER], // Sweden
62}
63
64const MODERATION_AUTHORITIES_DIDS = Array.from(
65 new Set(Object.values(MODERATION_AUTHORITIES).flat()),
66)
67
68export function isNonConfigurableModerationAuthority(did: string) {
69 return MODERATION_AUTHORITIES_DIDS.includes(did)
70}
71
72export function configureAdditionalModerationAuthorities() {
73 const geolocation = device.get(['mergedGeolocation'])
74 // default to all
75 let additionalLabelers: string[] = MODERATION_AUTHORITIES_DIDS
76
77 if (geolocation?.countryCode) {
78 // overwrite with only those necessary
79 additionalLabelers = MODERATION_AUTHORITIES[geolocation.countryCode] ?? []
80 } else {
81 logger.info(`no geolocation, cannot apply mod authorities`)
82 }
83
84 if (__DEV__) {
85 additionalLabelers = []
86 }
87
88 const appLabelers = Array.from(
89 new Set([...BskyAgent.appLabelers, ...additionalLabelers]),
90 )
91
92 logger.info(`applying mod authorities`, {
93 additionalLabelers,
94 appLabelers,
95 })
96
97 BskyAgent.configure({appLabelers})
98}