Skip to content

Commit 238b00d

Browse files
Configure moderation
1 parent bf69672 commit 238b00d

File tree

1 file changed

+67
-12
lines changed

1 file changed

+67
-12
lines changed

src/state/session/additional-moderation-authorities.ts

Lines changed: 67 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,88 @@ import {BskyAgent} from '@atproto/api'
33
import {logger} from '#/logger'
44
import {device} from '#/storage'
55

6-
export const BR_LABELER = 'did:plc:ekitcvx7uwnauoqy5oest3hm'
7-
export const DE_LABELER = 'did:plc:r55ow3tocux5kafs5dq445fy'
8-
export const ADDITIONAL_LABELERS_MAP: {
6+
export const BR_LABELER = 'did:plc:ekitcvx7uwnauoqy5oest3hm' // Brazil
7+
export const DE_LABELER = 'did:plc:r55ow3tocux5kafs5dq445fy' // Germany
8+
export const RU_LABELER = 'did:plc:crm2agcxvvlj6hilnjdc4hox' // Russia
9+
export const UK_LABELER = 'did:plc:gvkp7euswjjrctjmqwhhfzif' // United Kingdom
10+
export const AU_LABELER = 'did:plc:dsynw7isrf2eqlhcjx3ffnmt' // Australia
11+
export const TR_LABELER = 'did:plc:cquoj7aozvmkud2gifeinkda' // Turkey
12+
export const JP_LABELER = 'did:plc:vhgppeyjwgrr37vm4v6ggd5a' // Japan
13+
export const ES_LABELER = 'did:plc:zlbbuj5nov4ixhvgl3bj47em' // Spain
14+
export const PK_LABELER = 'did:plc:zrp6a3tvprrsgawsbswbxu7m' // Pakistan
15+
export const IN_LABELER = 'did:plc:srr4rdvgzkbx6t7fxqtt6j5t' // India
16+
17+
/**
18+
* For all EU countries
19+
*/
20+
export const EU_LABELER = 'did:plc:z57lz5dhgz2dkjogoysm3vut'
21+
22+
const MODERATION_AUTHORITIES: {
923
[countryCode: string]: string[]
1024
} = {
11-
BR: [BR_LABELER],
12-
DE: [DE_LABELER],
25+
BR: [BR_LABELER], // Brazil
26+
RU: [RU_LABELER], // Russia
27+
UK: [UK_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
1362
}
14-
export const ALL_ADDITIONAL_LABELERS = Object.values(
15-
ADDITIONAL_LABELERS_MAP,
16-
).flat()
17-
export const NON_CONFIGURABLE_LABELERS = [BR_LABELER, DE_LABELER]
63+
64+
const MODERATION_AUTHORITIES_DIDS = Array.from(
65+
new Set(Object.values(MODERATION_AUTHORITIES).flat()),
66+
)
1867

1968
export function isNonConfigurableModerationAuthority(did: string) {
20-
return NON_CONFIGURABLE_LABELERS.includes(did)
69+
return MODERATION_AUTHORITIES_DIDS.includes(did)
2170
}
2271

2372
export function configureAdditionalModerationAuthorities() {
2473
const geolocation = device.get(['geolocation'])
25-
let additionalLabelers: string[] = ALL_ADDITIONAL_LABELERS
74+
// default to all
75+
let additionalLabelers: string[] = MODERATION_AUTHORITIES_DIDS
2676

2777
if (geolocation?.countryCode) {
28-
additionalLabelers = ADDITIONAL_LABELERS_MAP[geolocation.countryCode] ?? []
78+
// overwrite with only those necessary
79+
additionalLabelers = MODERATION_AUTHORITIES[geolocation.countryCode] ?? []
2980
} else {
3081
logger.info(`no geolocation, cannot apply mod authorities`)
3182
}
3283

84+
if (__DEV__) {
85+
additionalLabelers = []
86+
}
87+
3388
const appLabelers = Array.from(
3489
new Set([...BskyAgent.appLabelers, ...additionalLabelers]),
3590
)

0 commit comments

Comments
 (0)