Zulassen von Anonymen RFID updates verlinkung der UUID wenn spieler angelegt wurde
This commit is contained in:
176
config/blacklist.js
Normal file
176
config/blacklist.js
Normal file
@@ -0,0 +1,176 @@
|
||||
/**
|
||||
* Blacklist für unerwünschte Namen
|
||||
* Basierend auf deutschen Namensregeln und allgemeinen Richtlinien
|
||||
*/
|
||||
|
||||
const BLACKLIST = {
|
||||
// Historisch belastete Namen
|
||||
historical: [
|
||||
'adolf', 'hitler', 'adolf hitler', 'adolfhittler', 'adolfhittler',
|
||||
'mussolini', 'benito', 'benito mussolini',
|
||||
'stalin', 'joseph stalin',
|
||||
'mao', 'mao zedong',
|
||||
'pol pot', 'polpot',
|
||||
'saddam', 'saddam hussein',
|
||||
'osama', 'osama bin laden',
|
||||
'kim jong', 'kim jong il', 'kim jong un'
|
||||
],
|
||||
|
||||
// Beleidigende/anstößige Begriffe
|
||||
offensive: [
|
||||
'satan', 'luzifer', 'teufel', 'devil',
|
||||
'hurensohn', 'wichser', 'fotze', 'arschloch',
|
||||
'idiot', 'dummkopf', 'trottel', 'schwachsinnig',
|
||||
'nazi', 'faschist', 'rassist',
|
||||
'terrorist', 'mörder', 'killer'
|
||||
],
|
||||
|
||||
// Titel und Berufsbezeichnungen
|
||||
titles: [
|
||||
'lord', 'lady', 'sir', 'dame',
|
||||
'prinz', 'prinzessin', 'prince', 'princess',
|
||||
'könig', 'königin', 'king', 'queen',
|
||||
'kaiser', 'kaiserin', 'emperor', 'empress',
|
||||
'doktor', 'professor', 'dr', 'prof',
|
||||
'pastor', 'pfarrer', 'bischof', 'priester',
|
||||
'richter', 'anwalt', 'notar'
|
||||
],
|
||||
|
||||
// Markennamen (Beispiele)
|
||||
brands: [
|
||||
'mcdonald', 'coca cola', 'cocacola', 'pepsi',
|
||||
'nike', 'adidas', 'puma', 'reebok',
|
||||
'bmw', 'mercedes', 'audi', 'volkswagen',
|
||||
'apple', 'microsoft', 'google', 'facebook',
|
||||
'samsung', 'sony', 'panasonic'
|
||||
],
|
||||
|
||||
// Unpassende Begriffe
|
||||
inappropriate: [
|
||||
'sex', 'porn', 'porno', 'fuck', 'shit',
|
||||
'bitch', 'whore', 'prostitute',
|
||||
'drug', 'cocaine', 'heroin', 'marijuana',
|
||||
'bomb', 'explosive', 'weapon', 'gun'
|
||||
]
|
||||
};
|
||||
|
||||
/**
|
||||
* Prüft ob ein Name in der Blacklist steht
|
||||
* @param {string} firstname - Vorname
|
||||
* @param {string} lastname - Nachname
|
||||
* @returns {Object} - {isBlocked: boolean, reason: string, category: string}
|
||||
*/
|
||||
function checkNameAgainstBlacklist(firstname, lastname) {
|
||||
if (!firstname || !lastname) {
|
||||
return { isBlocked: false, reason: '', category: '' };
|
||||
}
|
||||
|
||||
const fullName = `${firstname.toLowerCase()} ${lastname.toLowerCase()}`;
|
||||
const firstNameOnly = firstname.toLowerCase();
|
||||
const lastNameOnly = lastname.toLowerCase();
|
||||
|
||||
// Alle Blacklist-Einträge in einem Array sammeln
|
||||
const allBlacklistEntries = [];
|
||||
|
||||
Object.entries(BLACKLIST).forEach(([category, entries]) => {
|
||||
entries.forEach(entry => {
|
||||
allBlacklistEntries.push({
|
||||
term: entry,
|
||||
category: category,
|
||||
reason: getCategoryReason(category)
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Prüfung durchführen
|
||||
for (const entry of allBlacklistEntries) {
|
||||
const term = entry.term.toLowerCase();
|
||||
|
||||
// Vollständiger Name
|
||||
if (fullName.includes(term) || term.includes(fullName)) {
|
||||
return {
|
||||
isBlocked: true,
|
||||
reason: entry.reason,
|
||||
category: entry.category,
|
||||
matchedTerm: entry.term
|
||||
};
|
||||
}
|
||||
|
||||
// Vorname allein
|
||||
if (firstNameOnly.includes(term) || term.includes(firstNameOnly)) {
|
||||
return {
|
||||
isBlocked: true,
|
||||
reason: entry.reason,
|
||||
category: entry.category,
|
||||
matchedTerm: entry.term
|
||||
};
|
||||
}
|
||||
|
||||
// Nachname allein
|
||||
if (lastNameOnly.includes(term) || term.includes(lastNameOnly)) {
|
||||
return {
|
||||
isBlocked: true,
|
||||
reason: entry.reason,
|
||||
category: entry.category,
|
||||
matchedTerm: entry.term
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return { isBlocked: false, reason: '', category: '' };
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt eine benutzerfreundliche Begründung für die Kategorie zurück
|
||||
*/
|
||||
function getCategoryReason(category) {
|
||||
const reasons = {
|
||||
historical: 'Historisch belasteter Name',
|
||||
offensive: 'Beleidigender oder anstößiger Begriff',
|
||||
titles: 'Titel oder Berufsbezeichnung',
|
||||
brands: 'Markenname',
|
||||
inappropriate: 'Unpassender Begriff'
|
||||
};
|
||||
|
||||
return reasons[category] || 'Unzulässiger Begriff';
|
||||
}
|
||||
|
||||
/**
|
||||
* Fügt einen neuen Begriff zur Blacklist hinzu
|
||||
* @param {string} term - Der hinzuzufügende Begriff
|
||||
* @param {string} category - Die Kategorie
|
||||
*/
|
||||
function addToBlacklist(term, category) {
|
||||
if (BLACKLIST[category] && !BLACKLIST[category].includes(term.toLowerCase())) {
|
||||
BLACKLIST[category].push(term.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Entfernt einen Begriff aus der Blacklist
|
||||
* @param {string} term - Der zu entfernende Begriff
|
||||
* @param {string} category - Die Kategorie
|
||||
*/
|
||||
function removeFromBlacklist(term, category) {
|
||||
if (BLACKLIST[category]) {
|
||||
const index = BLACKLIST[category].indexOf(term.toLowerCase());
|
||||
if (index > -1) {
|
||||
BLACKLIST[category].splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die komplette Blacklist zurück (für Admin-Zwecke)
|
||||
*/
|
||||
function getBlacklist() {
|
||||
return BLACKLIST;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
checkNameAgainstBlacklist,
|
||||
addToBlacklist,
|
||||
removeFromBlacklist,
|
||||
getBlacklist,
|
||||
BLACKLIST
|
||||
};
|
||||
Reference in New Issue
Block a user