mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-28 07:20:49 -04:00
#275 sus keywords improvements
This commit is contained in:
parent
17f914633e
commit
2c535db7af
2
.gitignore
vendored
2
.gitignore
vendored
@ -17,6 +17,8 @@
|
|||||||
/static/card
|
/static/card
|
||||||
/static/img-local
|
/static/img-local
|
||||||
|
|
||||||
|
sus.txt
|
||||||
|
|
||||||
# Created by .ignore support plugin (hsz.mobi)
|
# Created by .ignore support plugin (hsz.mobi)
|
||||||
### Node template
|
### Node template
|
||||||
# Logs
|
# Logs
|
||||||
|
@ -1219,7 +1219,7 @@ profile:
|
|||||||
pronouns: 'Zaimki'
|
pronouns: 'Zaimki'
|
||||||
pronounsInfo: >
|
pronounsInfo: >
|
||||||
Możesz tu wpisać <strong>zaimek</strong> (np. „onu”, „on/jego”) lub wkleić <strong>linka</strong> do niego (np. „https://zaimki.pl/ona/ich”).
|
Możesz tu wpisać <strong>zaimek</strong> (np. „onu”, „on/jego”) lub wkleić <strong>linka</strong> do niego (np. „https://zaimki.pl/ona/ich”).
|
||||||
Użyj {/zaimki#generator=<strong>generatora</strong>} by wypełnić luki w zdaniach niestandardowymi formami.'
|
Użyj {/zaimki#generator=<strong>generatora</strong>} by wypełnić luki w zdaniach niestandardowymi formami.
|
||||||
pronounsNotFound: 'Niepoprawny format. Szczegóły w instrukcji powyżej'
|
pronounsNotFound: 'Niepoprawny format. Szczegóły w instrukcji powyżej'
|
||||||
words: 'Słowa'
|
words: 'Słowa'
|
||||||
birthday: 'Wiek'
|
birthday: 'Wiek'
|
||||||
|
@ -117,7 +117,7 @@
|
|||||||
<Icon v="comment-edit"/>
|
<Icon v="comment-edit"/>
|
||||||
<T>profile.description</T>
|
<T>profile.description</T>
|
||||||
</h3>
|
</h3>
|
||||||
<textarea class="form-control form-control-sm" v-model="description" maxlength="256" rows="4"/>
|
<textarea class="form-control form-control-sm" v-model="description" maxlength="256" rows="8"/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="form-group">
|
<section class="form-group">
|
||||||
|
@ -5,6 +5,7 @@ import {ulid} from "ulid";
|
|||||||
import avatar from "../avatar";
|
import avatar from "../avatar";
|
||||||
import {handleErrorAsync} from "../../src/helpers";
|
import {handleErrorAsync} from "../../src/helpers";
|
||||||
import { caches } from "../../src/cache";
|
import { caches } from "../../src/cache";
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
const normalise = s => s.trim().toLowerCase();
|
const normalise = s => s.trim().toLowerCase();
|
||||||
|
|
||||||
@ -57,49 +58,17 @@ const fetchProfiles = async (db, username, self, isAdmin) => {
|
|||||||
return p;
|
return p;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const susRegexes = fs.readFileSync(__dirname + '/../../sus.txt').toString('utf-8').split('\n').filter(x => !!x);
|
||||||
|
|
||||||
function* isSuspicious(profile) {
|
function* isSuspicious(profile) {
|
||||||
const description = profile.description.toLowerCase();
|
for (let s of [profile.description, JSON.stringify(profile.customFlags), JSON.stringify(profile.pronouns), JSON.stringify(profile.words)]) {
|
||||||
const flags = JSON.stringify(profile.customFlags).toLowerCase();
|
s = s.toLowerCase().replace(/\s+/g, ' ');
|
||||||
const pronouns = JSON.stringify(profile.pronouns).toLowerCase();
|
for (let sus of susRegexes) {
|
||||||
|
let m = s.match(new RegExp(sus, 'ig'));
|
||||||
if (description.includes('superstr') || description.includes('superhet') || description.includes('super-') ||
|
if (m) {
|
||||||
flags.includes('superstr') || flags.includes('superhet') || flags.includes('super-')
|
yield `${m[0]} (${sus})`;
|
||||||
) {
|
}
|
||||||
yield 'Superstraight';
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (description.includes('phobe') || description.includes('phobic') ||
|
|
||||||
flags.includes('phobe') || flags.includes('phobic')
|
|
||||||
) {
|
|
||||||
yield '-phobic';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description.includes('terf') || description.includes('radfem') || description.includes('gender critical') ||
|
|
||||||
flags.includes('terf') || flags.includes('radfem') || flags.includes('gender critical')
|
|
||||||
) {
|
|
||||||
yield 'TERF';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description.includes('helicopter') ||
|
|
||||||
flags.includes('helicopter') ||
|
|
||||||
pronouns.includes('helicopter')
|
|
||||||
) {
|
|
||||||
yield 'Helicopter';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pronouns.includes('nor/mal')
|
|
||||||
) {
|
|
||||||
yield 'nor/mal';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (description.includes('pedophile') ||
|
|
||||||
flags.includes('pedophile') ||
|
|
||||||
description.includes('lolicon') ||
|
|
||||||
flags.includes('lolicon') ||
|
|
||||||
profile.description.match(/\bMAP\b/) ||
|
|
||||||
JSON.stringify(profile.customFlags).match(/\bMAP\b/)
|
|
||||||
) {
|
|
||||||
yield 'Pedophile';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user