mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-19 05:55:34 +09:00
feat(users): add temporary new conversation limits (#3100)
This commit is contained in:
1 parent
b375abc20a
commit
98cce4815d
130 files changed
+995
-259
No files matched your search
@@ -4,9 +4,9 @@ export type Id = string;
|
||||
export type Flags64 = string;
|
||||
export type Channel = "stable" | "canary" | "worker" | "internal" | "import" | "other";
|
||||
export type Meta = { ip: string | null, country: string | null, ua: string | null, locale: string | null, channel: Channel, request_id: string | null, };
|
||||
export type Kind = "registration" | "email_changed" | "profile_updated" | "account_changed" | "admin_action" | "account_deleted" | "report_filed" | "email_bounced" | "action_outcome" | "login" | "session_started" | "guild_joined" | "dm_opened" | "message_created" | "friend_request" | "http_errors" | "user_blocked";
|
||||
export type Event = { v: number, id: string, at_ms: number, key: string, meta: Meta, } & ({ "kind": "registration", "data": Registration } | { "kind": "email_changed", "data": EmailChanged } | { "kind": "profile_updated", "data": ProfileUpdated } | { "kind": "account_changed", "data": AccountChanged } | { "kind": "admin_action", "data": AdminAction } | { "kind": "account_deleted", "data": AccountDeleted } | { "kind": "report_filed", "data": ReportFiled } | { "kind": "email_bounced", "data": EmailBounced } | { "kind": "action_outcome", "data": ActionOutcome } | { "kind": "login", "data": Login } | { "kind": "session_started", "data": SessionStarted } | { "kind": "guild_joined", "data": GuildJoined } | { "kind": "dm_opened", "data": DmOpened } | { "kind": "message_created", "data": MessageCreated } | { "kind": "friend_request", "data": FriendRequest } | { "kind": "http_errors", "data": HttpErrors } | { "kind": "user_blocked", "data": UserBlocked });
|
||||
export type Body = { "kind": "registration", "data": Registration } | { "kind": "email_changed", "data": EmailChanged } | { "kind": "profile_updated", "data": ProfileUpdated } | { "kind": "account_changed", "data": AccountChanged } | { "kind": "admin_action", "data": AdminAction } | { "kind": "account_deleted", "data": AccountDeleted } | { "kind": "report_filed", "data": ReportFiled } | { "kind": "email_bounced", "data": EmailBounced } | { "kind": "action_outcome", "data": ActionOutcome } | { "kind": "login", "data": Login } | { "kind": "session_started", "data": SessionStarted } | { "kind": "guild_joined", "data": GuildJoined } | { "kind": "dm_opened", "data": DmOpened } | { "kind": "message_created", "data": MessageCreated } | { "kind": "friend_request", "data": FriendRequest } | { "kind": "http_errors", "data": HttpErrors } | { "kind": "user_blocked", "data": UserBlocked };
|
||||
export type Kind = "registration" | "email_changed" | "profile_updated" | "account_changed" | "admin_action" | "account_deleted" | "report_filed" | "email_bounced" | "action_outcome" | "login" | "session_started" | "guild_joined" | "dm_opened" | "message_created" | "message_updated" | "friend_request" | "http_errors" | "user_blocked";
|
||||
export type Event = { v: number, id: string, at_ms: number, key: string, meta: Meta, } & ({ "kind": "registration", "data": Registration } | { "kind": "email_changed", "data": EmailChanged } | { "kind": "profile_updated", "data": ProfileUpdated } | { "kind": "account_changed", "data": AccountChanged } | { "kind": "admin_action", "data": AdminAction } | { "kind": "account_deleted", "data": AccountDeleted } | { "kind": "report_filed", "data": ReportFiled } | { "kind": "email_bounced", "data": EmailBounced } | { "kind": "action_outcome", "data": ActionOutcome } | { "kind": "login", "data": Login } | { "kind": "session_started", "data": SessionStarted } | { "kind": "guild_joined", "data": GuildJoined } | { "kind": "dm_opened", "data": DmOpened } | { "kind": "message_created", "data": MessageCreated } | { "kind": "message_updated", "data": MessageUpdated } | { "kind": "friend_request", "data": FriendRequest } | { "kind": "http_errors", "data": HttpErrors } | { "kind": "user_blocked", "data": UserBlocked });
|
||||
export type Body = { "kind": "registration", "data": Registration } | { "kind": "email_changed", "data": EmailChanged } | { "kind": "profile_updated", "data": ProfileUpdated } | { "kind": "account_changed", "data": AccountChanged } | { "kind": "admin_action", "data": AdminAction } | { "kind": "account_deleted", "data": AccountDeleted } | { "kind": "report_filed", "data": ReportFiled } | { "kind": "email_bounced", "data": EmailBounced } | { "kind": "action_outcome", "data": ActionOutcome } | { "kind": "login", "data": Login } | { "kind": "session_started", "data": SessionStarted } | { "kind": "guild_joined", "data": GuildJoined } | { "kind": "dm_opened", "data": DmOpened } | { "kind": "message_created", "data": MessageCreated } | { "kind": "message_updated", "data": MessageUpdated } | { "kind": "friend_request", "data": FriendRequest } | { "kind": "http_errors", "data": HttpErrors } | { "kind": "user_blocked", "data": UserBlocked };
|
||||
export type Registration = { user_id: Id, method: RegMethod, email: string | null, username: string, username_user_chosen: boolean, global_name: string | null, locale: string | null, timezone: string | null, invite_code: string | null, suspicious_flags: number, flags: Flags64, };
|
||||
export type RegMethod = "password" | "unclaimed" | "oauth" | "other";
|
||||
export type EmailChanged = { user_id: Id, new_email: string, was_unclaimed: boolean, has_ever_purchased: boolean, suspicious_flags: number, suspicious_flags_before: number | null, };
|
||||
@@ -26,14 +26,16 @@ export type SessionStarted = { user_id: Id, is_bot: boolean, has_verified_phone:
|
||||
export type GuildJoined = { user_id: Id, guild_id: Id, member_count: number, discoverable: boolean, invite_code: string | null, inviter_id: Id | null, join_source: JoinSource, };
|
||||
export type JoinSource = "creator" | "invite" | "vanity" | "bot_invite" | "admin_force_add" | "discovery" | "other";
|
||||
export type DmOpened = { user_id: Id, recipient_id: Id, channel_id: Id, recipient_is_friend: boolean, delivered: boolean, };
|
||||
export type MessageCreated = { user_id: Id, message_id: Id, channel_id: Id, channel_type: ChannelType, guild_id: Id | null, dm_recipient_id: Id | null, recipient_is_friend: boolean, channel_prior_messages: boolean, is_bot: boolean, content: string, attachment_count: number, attachment_names: Array<string>, link_domains: Array<string>, invite_codes: Array<string>, invite_guild_ids: Array<Id | null>, invite_guild_owner_ids: Array<Id | null>, mention_user_ids: Array<Id>, mentions_recipient: boolean, mention_everyone: boolean, author_owns_guild: boolean, guild_member_count: number | null, delivered: boolean, };
|
||||
export type MessageCreated = { user_id: Id, message_id: Id, channel_id: Id, channel_type: ChannelType, guild_id: Id | null, dm_recipient_id: Id | null, recipient_is_friend: boolean, channel_prior_messages: boolean, is_bot: boolean, content: string, attachment_count: number, attachment_names: Array<string>, attachments: Array<AttachmentMeta>, link_domains: Array<string>, invite_codes: Array<string>, invite_guild_ids: Array<Id | null>, invite_guild_owner_ids: Array<Id | null>, mention_user_ids: Array<Id>, mentions_recipient: boolean, mention_everyone: boolean, author_owns_guild: boolean, guild_member_count: number | null, delivered: boolean, };
|
||||
export type AttachmentMeta = { size: number, content_type: string | null, hash: string | null, };
|
||||
export type MessageUpdated = MessageCreated;
|
||||
export type ChannelType = "dm" | "group_dm" | "guild";
|
||||
export type FriendRequest = { user_id: Id, target_id: Id, delivered: boolean, };
|
||||
export type UserBlocked = { blocker_id: Id, blocked_id: Id, };
|
||||
export type HttpErrors = { ip: string, window_ms: number, s401: number, s403: number, s404: number, s429: number, other_4xx: number, auth_failures: number, token_hashes: Array<string>, };
|
||||
export type ActionEnvelope = { v: number, id: string, key: string, issued_at_ms: number, expires_at_ms: number, } & ({ "type": "set_suspicious_flags", user_id: Id, set: number, clear: number, if_current: number | null, } | { "type": "set_spammer", user_id: Id, on: boolean, } | { "type": "phone_verified", user_id: Id, method: PhoneMethod, clear_suspicious: number, } | { "type": "temp_ban_ip", ip: string, until_ms: number, } | { "type": "review", user_id: Id, });
|
||||
export type Action = { "type": "set_suspicious_flags", user_id: Id, set: number, clear: number, if_current: number | null, } | { "type": "set_spammer", user_id: Id, on: boolean, } | { "type": "phone_verified", user_id: Id, method: PhoneMethod, clear_suspicious: number, } | { "type": "temp_ban_ip", ip: string, until_ms: number, } | { "type": "review", user_id: Id, };
|
||||
export type ActionOutcome = { action_id: string, action_type: string, status: OutcomeStatus, detail: string | null, observed: Observed | null, };
|
||||
export type ActionEnvelope = { v: number, id: string, key: string, issued_at_ms: number, expires_at_ms: number, } & ({ "type": "set_suspicious_flags", user_id: Id, set: number, clear: number, if_current: number | null, } | { "type": "phone_verified", user_id: Id, method: PhoneMethod, clear_suspicious: number, } | { "type": "temp_ban_ip", ip: string, until_ms: number, } | { "type": "limit_new_conversations", user_id: Id, on: boolean, until_ms: number, });
|
||||
export type Action = { "type": "set_suspicious_flags", user_id: Id, set: number, clear: number, if_current: number | null, } | { "type": "phone_verified", user_id: Id, method: PhoneMethod, clear_suspicious: number, } | { "type": "temp_ban_ip", ip: string, until_ms: number, } | { "type": "limit_new_conversations", user_id: Id, on: boolean, until_ms: number, };
|
||||
export type ActionOutcome = { action_id: string, action_type: string, status: OutcomeStatus, detail: string | null, observed: Observed | null, user_id?: Id, };
|
||||
export type OutcomeStatus = "applied" | "noop" | "conflict" | "expired" | "ineligible" | "exempt" | "unsupported" | "failed";
|
||||
export type Observed = { flags: Flags64, suspicious_flags: number, has_verified_phone: boolean, deleted: boolean, };
|
||||
export type StartReq = { v: number, user_id: Id, user_flags: Flags64, has_verified_phone: boolean, phone: string, requested_channel: PhoneChannel | null, client_ip: string, captcha_passed: boolean, };
|
||||
@@ -89,6 +91,7 @@ export const EVENT_KINDS: ReadonlyArray<EventKind> = [
|
||||
'guild_joined',
|
||||
'dm_opened',
|
||||
'message_created',
|
||||
'message_updated',
|
||||
'friend_request',
|
||||
'http_errors',
|
||||
'user_blocked',
|
||||
@@ -108,6 +111,7 @@ export const EVENT_MAJOR: Record<EventKind, number> = {
|
||||
guild_joined: 1,
|
||||
dm_opened: 1,
|
||||
message_created: 1,
|
||||
message_updated: 1,
|
||||
friend_request: 1,
|
||||
http_errors: 1,
|
||||
user_blocked: 1,
|
||||
@@ -127,6 +131,7 @@ export const EVENT_TTL: Record<EventKind, string> = {
|
||||
guild_joined: '3024000',
|
||||
dm_opened: '259200',
|
||||
message_created: '259200',
|
||||
message_updated: '259200',
|
||||
friend_request: '259200',
|
||||
http_errors: '3600',
|
||||
user_blocked: '259200',
|
||||
@@ -146,6 +151,7 @@ export const EVENT_CLASS: Record<EventKind, 'fact' | 'signal'> = {
|
||||
guild_joined: 'signal',
|
||||
dm_opened: 'signal',
|
||||
message_created: 'signal',
|
||||
message_updated: 'signal',
|
||||
friend_request: 'signal',
|
||||
http_errors: 'signal',
|
||||
user_blocked: 'signal',
|
||||
|
||||
Reference in new issue
Block a user