openvibers/openvibe.live Commits

The home's quote strip also leaves out strong profanity in Portuguese, Spanish, French and German (#346)

OP OpenVibers committed 20 days ago · ea02541b23 · 2 files, +6 −1

Changes

ddiff --git a/server/home/front-page-text.js b/server/home/front-page-text.js
iindex 5e3ec603..d6ed7e07 100644
---- a/server/home/front-page-text.js
++++ b/server/home/front-page-text.js
@@@ -8,12 +8,15 @@
const { CORE_SLUR_CATEGORIES } = require('../chat/moderation-utils');
const ROUGH = /\b(?:f+u+c+k\w*|motherf\w*|sh[i1]t(?:s|ty|ting|ted)?|bullshit|cunts?|bitch\w*|whores?|sluts?|pussy|retard\w*|nazis?|hitler|holocaust|anti-?semit\w*|kkk|rap(?:e|ed|es|ist|ists|ing))\b/i;
++// Streamers here speak Portuguese, Spanish, French and German too ("…tô com o rollback do caralho" led the strip on
++// 2026-10-24 once the English words were out). Letter boundaries, not \b: \b does not know ç, ñ or ß.
++const ROUGH_INTL = /(?<!\p{L})(?:caralho|porra|foda(?:-se)?|fodase|merda|putas?|viado|buceta|mierda|joder|coño|pendejos?|cabr[oó]n(?:es)?|verga|chinga\p{L}*|putain|merde|connard|salope|scheiße|scheisse|hurensohn|ficken|fick)(?!\p{L})/iu;
const SLUR_RES = CORE_SLUR_CATEGORIES.map((c) => ({ c, res: c.patterns.map((p) => new RegExp(p, 'i')) }));
/** True when the text may lead the front page. */
function frontPageOk(text) {
const t = String(text || '');
-- if (!t.trim() || ROUGH.test(t)) return false;
++ if (!t.trim() || ROUGH.test(t) || ROUGH_INTL.test(t)) return false;
return !SLUR_RES.some(({ c, res }) => c.generateCandidates(t).some((x) => res.some((re) => re.test(x))));
}
ddiff --git a/test/home-front-page-text.test.js b/test/home-front-page-text.test.js
iindex b1fffd66..322f3f88 100644
---- a/test/home-front-page-text.test.js
++++ b/test/home-front-page-text.test.js
@@@ -16,11 +16,13 @@ for (const t of [
'I had Hermes say, oh, that\'s got an anti-semitic trope. I can\'t help.',
'that was some bullshit', 'what a bitch move', 'he went full nazi on it', 'the Holocaust bit again',
'n1gger', 'f a g g o t', 'Motherfucker!', '', null,
++ 'Eita, pô, tô com tô com o rollback do caralho.', 'Que porra é essa', '¡Joder, qué mierda!', 'putain de merde', 'So eine Scheiße',
]) assert.ok(!frontPageOk(t), `left off the front page: ${t}`);
for (const t of [
'That first time I walked in, I knew that I was not alone.', 'We finally beat the boss on hard mode',
'Shitake mushrooms are underrated', 'My dad Dick says hi', 'Scunthorpe won again', 'Grape soda forever',
'The cockpit view in this sim is amazing',
++ 'Eita, pô, tô com o rollback do servidor.', 'O computador travou de novo', 'Hola a todos, ¿qué tal?', 'Disputa final hoje',
]) assert.ok(frontPageOk(t), `fine for the front page: ${t}`);
console.log(' ✓ slurs, strong profanity and hate topics are left off; ordinary takes (and Shitake, Scunthorpe, grape) stay');