mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 06:34:15 +00:00
feat: profanity censoring and filtering
This commit is contained in:
parent
e1d248853f
commit
25c9bb079c
9 changed files with 41 additions and 5 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import { profanity } from "@2toad/profanity";
|
||||
import { AES_CCM } from "@trafficlunar/asmcrypto.js";
|
||||
|
||||
import { MII_DECRYPTION_KEY } from "./constants";
|
||||
import Mii from "./mii.js/mii";
|
||||
import TomodachiLifeMii from "./tomodachi-life-mii";
|
||||
|
|
@ -39,6 +41,11 @@ export function convertQrCode(bytes: Uint8Array): { mii: Mii; tomodachiLifeMii:
|
|||
mii.facialHairColor = tomodachiLifeMii.studioHairColor;
|
||||
}
|
||||
|
||||
// Censor potential inappropriate words
|
||||
tomodachiLifeMii.firstName = profanity.censor(tomodachiLifeMii.firstName);
|
||||
tomodachiLifeMii.lastName = profanity.censor(tomodachiLifeMii.lastName);
|
||||
tomodachiLifeMii.islandName = profanity.censor(tomodachiLifeMii.islandName);
|
||||
|
||||
return { mii, tomodachiLifeMii };
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import { z } from "zod";
|
||||
|
||||
// profanity censoring bypasses the regex in some of these but I think it's funny
|
||||
|
||||
export const querySchema = z
|
||||
.string()
|
||||
.trim()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue