refactor(api): emit moderation events and apply account actions (#3031)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-29 12:24:15 +02:00
1 parent c488906131
commit 364084c819
385 files changed
+8994 -22221

No files matched your search

@@ -19,10 +19,8 @@ export const EXTERNAL_RESPONSE_LIMITS = {
wikipediaSummaryBytes: 256 * 1024,
oEmbedBytes: 256 * 1024,
pwnedPasswordsBytes: 1024 * 1024,
rdapBytes: 512 * 1024,
externalTemplateBytes: 512 * 1024,
ncmecResponseBytes: 64 * 1024,
fileBlocklistBytes: 25 * 1024 * 1024,
urlBlocklistBytes: 25 * 1024 * 1024,
disposableEmailBytes: 10 * 1024 * 1024,
} as const;
+13
View File
@@ -42,3 +42,16 @@ export function findInvite(content: string | null): string | null {
}
return null;
}
export function findInvites(content: string | null, limit: number): Array<string> {
if (!content) return [];
const pattern = getInvitePattern();
pattern.lastIndex = 0;
const codes = new Set<string>();
for (const match of content.matchAll(pattern)) {
const code = match[1] || match[2];
if (code) codes.add(code);
if (codes.size >= limit) break;
}
return [...codes];
}
-5
View File
@@ -4,7 +4,6 @@ import assert from 'node:assert/strict';
import crypto from 'node:crypto';
const RANDOM_STRING_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
const RANDOM_DIGIT_ALPHABET = '0123456789';
function randomFromAlphabet(length: number, alphabet: string): string {
assert(Number.isSafeInteger(length) && length >= 0, 'Random string length must be a nonnegative safe integer');
@@ -26,10 +25,6 @@ function randomFromAlphabet(length: number, alphabet: string): string {
return result;
}
export function randomNumericCode(length: number): string {
return randomFromAlphabet(length, RANDOM_DIGIT_ALPHABET);
}
export function randomString(length: number): string {
return randomFromAlphabet(length, RANDOM_STRING_ALPHABET);
}