65 lines
1.9 KiB
JavaScript
65 lines
1.9 KiB
JavaScript
/**
|
|
* Single-Source-of-Truth für Gambling-Keyword-Detection.
|
|
*
|
|
* Importiert von:
|
|
* - server/api/mail/scan.post.ts
|
|
* - server/api/mail/scan-internal.post.ts
|
|
* - imap-proxy/session.mjs
|
|
* - imap-idle/index.mjs
|
|
*
|
|
* Mo's DSGVO-Finding #4: vorher in 4 Files dupliziert → Drift-Risk.
|
|
*/
|
|
|
|
export const GAMBLING_KEYWORDS = [
|
|
// Major Anbieter
|
|
"casino", "bet365", "bwin", "tipico", "unibet", "betway", "888casino",
|
|
"pokerstars", "interwetten", "netbet", "leovegas", "mrgreen", "mr green",
|
|
"betsson", "neobet", "mybet", "lottoland", "betano", "william hill",
|
|
"paddypower", "betfair", "stake", "rolletto", "vbet", "1xbet", "melbet",
|
|
"mostbet", "luckyvibe", "lucky vibe", "spinz", "casinoly", "rabona",
|
|
"justcasino", "getslots", "rocketplay", "fresh casino", "freshcasino",
|
|
"nom nom",
|
|
|
|
// Generic Begriffe
|
|
"sportwetten", "jackpot", "freispiel", "free spin", "bonus code",
|
|
"auszahlung", "glücksspiel", "slots", "roulette",
|
|
|
|
// ⚠️ Risk: matcht auch unschuldige Wörter (Mo's Finding #5)
|
|
// TODO Whitelist: "wette" matcht "wettervorhersage" → False-Positive
|
|
// siehe gambling-whitelist.mjs (TODO)
|
|
"wette",
|
|
];
|
|
|
|
/**
|
|
* Whitelist — Begriffe die NICHT als Gambling gelten dürfen.
|
|
* Bei Match in GAMBLING_KEYWORDS, vor Block prüfen ob in Whitelist.
|
|
*
|
|
* TODO Mo's Finding #5: ausführen Mail-Whitelist-Check vor Auto-Delete.
|
|
*/
|
|
export const GAMBLING_WHITELIST = [
|
|
"wettervorhersage",
|
|
"wetter",
|
|
"wetterbericht",
|
|
"wettkampf", // kein Glücksspiel
|
|
"wettbewerb", // dito
|
|
];
|
|
|
|
/**
|
|
* Helper: prüft ob ein Text Gambling-Keywords enthält, mit Whitelist-Check.
|
|
*/
|
|
export function isGamblingText(text) {
|
|
if (!text) return false;
|
|
const lower = text.toLowerCase();
|
|
|
|
// Erst Whitelist — wenn matched, kein Gambling
|
|
for (const w of GAMBLING_WHITELIST) {
|
|
if (lower.includes(w)) return false;
|
|
}
|
|
|
|
// Dann Gambling-Keywords
|
|
for (const kw of GAMBLING_KEYWORDS) {
|
|
if (lower.includes(kw)) return true;
|
|
}
|
|
return false;
|
|
}
|