Skip to content

Commit 3a5d136

Browse files
committed
Add all the missing config options for communities
1 parent 5c440b9 commit 3a5d136

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

src/policyserv_api.ts

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ export interface CommunityConfig {
7373
mention_filter_min_plaintext_length?: number; // whole number
7474
many_ats_filter_max_ats?: number; // whole number, positive to enable
7575
media_filter_media_types?: string[];
76+
untrusted_media_filter_media_types?: string[];
77+
untrusted_media_filter_use_muninn?: boolean;
78+
untrusted_media_filter_use_power_levels?: boolean;
79+
untrusted_media_filter_allowed_user_globs?: string[];
80+
untrusted_media_filter_denied_user_globs?: string[];
7681
density_filter_max_density?: number; // float, positive to enable
7782
density_filter_min_trigger_length?: number; // whole number, positive to enable
7883
trim_length_filter_max_difference?: number; // float, positive to enable
@@ -83,7 +88,10 @@ export interface CommunityConfig {
8388
hellban_postfilter_minutes?: number; // whole number, positive to enable
8489
mjolnir_filter_enabled?: boolean;
8590
spam_threshold?: number; // float
91+
webhook_url?: string;
92+
openai_filter_fail_secure?: boolean;
8693
sticky_events_filter_allow_sticky_events?: boolean;
94+
hma_filter_enabled_banks?: string[];
8795
}
8896

8997
export interface ConfigDescription {
@@ -141,6 +149,31 @@ export const ConfigDescriptions: Record<string /* user-friendly name */, ConfigD
141149
description: "The event and message types to consider spam. Multiple types can be specified by separating them with commas.",
142150
transformFn: toArray,
143151
},
152+
"untrusted_media_types": {
153+
property: "untrusted_media_filter_media_types",
154+
description: "The event and message types to consider spam if the sender is not trusted. Multiple types can be specified by separating them with commas. Trust uses a deny-wins model, where the first trust source to deny a user will cause them to be untrusted. If no trust sources deny the user, then the first to allow them will cause them to be trusted. This filter assumes no trust by default (and therefore denies after all trust sources are consulted).",
155+
transformFn: toArray,
156+
},
157+
"enable_muninn_hall_trust_source": {
158+
property: "untrusted_media_filter_use_muninn",
159+
description: "Trusts users from servers which are members of Muninn Hall.",
160+
transformFn: toBoolean,
161+
},
162+
"enable_power_levels_trust_source": {
163+
property: "untrusted_media_filter_use_power_levels",
164+
description: "Trusts users if they have above-default power levels in the room.",
165+
transformFn: toBoolean,
166+
},
167+
"allowed_globs_trust_source": {
168+
property: "untrusted_media_filter_allowed_user_globs",
169+
description: "The globs of users to trust. Multiple globs can be specified by separating them with commas.",
170+
transformFn: toArray,
171+
},
172+
"denied_globs_trust_source": {
173+
property: "untrusted_media_filter_denied_user_globs",
174+
description: "The globs of users to explicitly not trust. Multiple globs can be specified by separating them with commas. Overrides any source which trusts a user.",
175+
transformFn: toArray,
176+
},
144177
"max_density": {
145178
property: "density_filter_max_density",
146179
description: "The maximum ratio of non-whitespace to whitespace characters allowed in a message. Set to -1 to disable.",
@@ -192,11 +225,27 @@ export const ConfigDescriptions: Record<string /* user-friendly name */, ConfigD
192225
// description: "How 'spammy' an event must be to be considered spam. Zero is not spammy, one is very spammy.",
193226
// transformFn: toNumber,
194227
// },
228+
// Note: we don't currently allow this to be set because we don't have a good way to indicate whether the URL domain is allowed.
229+
// "webhook_url": {
230+
// property: "webhook_url",
231+
// description: "The (preferably Hookshot) URL to send notifications of spammy events to. If not set, no notifications will be sent.",
232+
// },
233+
"fail_secure_for_openai": {
234+
property: "openai_filter_fail_secure",
235+
description: "If the OpenAI filter is enabled for your community or room, this determines whether it considers an event spam when the filter cannot reach OpenAI. Set to false to allow events to pass during errors.",
236+
transformFn: toBoolean,
237+
},
195238
"allow_sticky_events": {
196239
property: "sticky_events_filter_allow_sticky_events",
197240
description: "Whether to enable the use of MSC4354-style Sticky Events in rooms.",
198241
transformFn: toBoolean,
199-
}
242+
},
243+
// Note: we don't currently allow this to be changed because we want to ensure that illegal content is always blocked. We'll need to find a way to make this additive rather than replace the instance's values.
244+
// "enabled_hma_banks": {
245+
// property: "hma_filter_enabled_banks",
246+
// description: "If the HMA filter is enabled for your community, these are the bank names to scan media against. Multiple banks can be specified by separating them with commas.",
247+
// transformFn: toArray,
248+
// },
200249
};
201250

202251
interface RoomResponse {

0 commit comments

Comments
 (0)