From 6d0b663769216560c7a9e66e1550f73eef5195ba Mon Sep 17 00:00:00 2001 From: Arnob-B Date: Tue, 30 Jul 2024 00:12:35 +0530 Subject: [PATCH] moderation review system completed --- backend/src/index.ts | 5 +- backend/src/lib/badwords.list | 524 +++++++++++++++++++++++++++ backend/src/lib/convertor.ts | 30 ++ backend/src/lib/wordlist.json | 1 + backend/src/middleware/moderation.ts | 54 +++ backend/src/routes/mRuote.ts | 5 + 6 files changed, 618 insertions(+), 1 deletion(-) create mode 100644 backend/src/lib/badwords.list create mode 100644 backend/src/lib/convertor.ts create mode 100644 backend/src/lib/wordlist.json create mode 100644 backend/src/middleware/moderation.ts create mode 100644 backend/src/routes/mRuote.ts diff --git a/backend/src/index.ts b/backend/src/index.ts index 007659c..460ad7c 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -4,6 +4,7 @@ import cors from 'cors'; import cookieParser from 'cookie-parser'; import "dotenv/config"; import userRoutes from './routes/userRoutes'; +import moderationRouter from './routes/mRuote'; const app = express(); app.use(express.json()); @@ -16,7 +17,9 @@ app.use(cookieParser()); app.use("/api/user", userRoutes); - +//actual path (/api/admin/reviews/approve) +// body :-> {"content":"....."} +app.use("/api/admin",moderationRouter); diff --git a/backend/src/lib/badwords.list b/backend/src/lib/badwords.list new file mode 100644 index 0000000..fb57528 --- /dev/null +++ b/backend/src/lib/badwords.list @@ -0,0 +1,524 @@ +2g1c +2 girls 1 cup +acrotomophilia +alabama hot pocket +alaskan pipeline +anal +anilingus +anus +apeshit +arsehole +ass +asshole +assmunch +auto erotic +autoerotic +babeland +baby batter +baby juice +ball gag +ball gravy +ball kicking +ball licking +ball sack +ball sucking +bangbros +bangbus +bareback +barely legal +barenaked +bastard +bastardo +bastinado +bbw +bdsm +beaner +beaners +beaver cleaver +beaver lips +beastiality +bestiality +big black +big breasts +big knockers +big tits +bimbos +birdlock +bitch +bitches +black cock +blonde action +blonde on blonde action +blowjob +blow job +blow your load +blue waffle +blumpkin +bollocks +bondage +boner +boob +boobs +booty call +brown showers +brunette action +bukkake +bulldyke +bullet vibe +bullshit +bung hole +bunghole +busty +butt +buttcheeks +butthole +camel toe +camgirl +camslut +camwhore +carpet muncher +carpetmuncher +chocolate rosebuds +cialis +circlejerk +cleveland steamer +clit +clitoris +clover clamps +clusterfuck +cock +cocks +coprolagnia +coprophilia +cornhole +coon +coons +creampie +cum +cumming +cumshot +cumshots +cunnilingus +cunt +darkie +date rape +daterape +deep throat +deepthroat +dendrophilia +dick +dildo +dingleberry +dingleberries +dirty pillows +dirty sanchez +doggie style +doggiestyle +doggy style +doggystyle +dog style +dolcett +domination +dominatrix +dommes +donkey punch +double dong +double penetration +dp action +dry hump +dvda +eat my ass +ecchi +ejaculation +erotic +erotism +escort +eunuch +fag +faggot +fecal +felch +fellatio +feltch +female squirting +femdom +figging +fingerbang +fingering +fisting +foot fetish +footjob +frotting +fuck +fuck buttons +fuckin +fucking +fucktards +fudge packer +fudgepacker +futanari +gangbang +gang bang +gay sex +genitals +giant cock +girl on +girl on top +girls gone wild +goatcx +goatse +god damn +gokkun +golden shower +goodpoop +goo girl +goregasm +grope +group sex +g-spot +guro +hand job +handjob +hard core +hardcore +hentai +homoerotic +honkey +hooker +horny +hot carl +hot chick +how to kill +how to murder +huge fat +humping +incest +intercourse +jack off +jail bait +jailbait +jelly donut +jerk off +jigaboo +jiggaboo +jiggerboo +jizz +juggs +kike +kinbaku +kinkster +kinky +knobbing +leather restraint +leather straight jacket +lemon party +livesex +lolita +lovemaking +make me come +male squirting +masturbate +masturbating +masturbation +menage a trois +milf +missionary position +mong +motherfucker +mound of venus +mr hands +muff diver +muffdiving +nambla +nawashi +negro +neonazi +nigga +nigger +nig nog +nimphomania +nipple +nipples +nsfw +nsfw images +nude +nudity +nutten +nympho +nymphomania +octopussy +omorashi +one cup two girls +one guy one jar +orgasm +orgy +paedophile +paki +panties +panty +pedobear +pedophile +pegging +penis +phone sex +piece of shit +pikey +pissing +piss pig +pisspig +playboy +pleasure chest +pole smoker +ponyplay +poof +poon +poontang +punany +poop chute +poopchute +porn +porno +pornography +prince albert piercing +pthc +pubes +pussy +queaf +queef +quim +raghead +raging boner +rape +raping +rapist +rectum +reverse cowgirl +rimjob +rimming +rosy palm +rosy palm and her 5 sisters +rusty trombone +sadism +santorum +scat +schlong +scissoring +semen +sex +sexcam +sexo +sexy +sexual +sexually +sexuality +shaved beaver +shaved pussy +shemale +shibari +shit +shitblimp +shitty +shota +shrimping +skeet +slanteye +slut +s&m +smut +snatch +snowballing +sodomize +sodomy +spastic +spic +splooge +splooge moose +spooge +spread legs +spunk +strap on +strapon +strappado +strip club +style doggy +suck +sucks +suicide girls +sultry women +swastika +swinger +tainted love +taste my +tea bagging +threesome +throating +thumbzilla +tied up +tight white +tit +tits +titties +titty +tongue in a +topless +tosser +towelhead +tranny +tribadism +tub girl +tubgirl +tushy +twat +twink +twinkie +two girls one cup +undressing +upskirt +urethra play +urophilia +vagina +venus mound +viagra +vibrator +violet wand +vorarephilia +voyeur +voyeurweb +voyuer +vulva +wank +wetback +wet dream +white power +whore +worldsex +wrapping men +wrinkled starfish +xx +xxx +yaoi +yellow showers +yiffy +zoophilia +🖕 + + +aand +aandu +balatkar +balatkari +behen chod +beti chod +bhadva +bhadve +bhandve +bhangi +bhootni ke +bhosad +bhosadi ke +boobe +chakke +chinaal +chinki +chod +chodu +chodu bhagat +chooche +choochi +choope +choot +choot ke baal +chootia +chootiya +chuche +chuchi +chudaap +chudai khanaa +chudam chudai +chude +chut +chut ka chuha +chut ka churan +chut ka mail +chut ke baal +chut ke dhakkan +chut maarli +chutad +chutadd +chutan +chutia +chutiya +gaand +gaandfat +gaandmasti +gaandufad +gandfattu +gandu +gashti +gasti +ghassa +ghasti +gucchi +gucchu +harami +haramzade +hawas +hawas ke pujari +hijda +hijra +jhant +jhant chaatu +jhant ka keeda +jhant ke baal +jhant ke pissu +jhantu +kamine +kaminey +kanjar +kutta +kutta kamina +kutte ki aulad +kutte ki jat +kuttiya +loda +lodu +lund +lund choos +lund ka bakkal +lund khajoor +lundtopi +lundure +maa ki chut +maal +madar chod +madarchod +madhavchod +mooh mein le +mutth +mutthal +najayaz +najayaz aulaad +najayaz paidaish +paki +pataka +patakha +raand +randaap +randi +randi rona +saala +saala kutta +saali kutti +saali randi +suar +suar ke lund +suar ki aulad +tatte +tatti +teri maa ka bhosada +teri maa ka boba chusu +teri maa ki behenchod +teri maa ki chut +tharak +tharki +tu chuda \ No newline at end of file diff --git a/backend/src/lib/convertor.ts b/backend/src/lib/convertor.ts new file mode 100644 index 0000000..8c9711d --- /dev/null +++ b/backend/src/lib/convertor.ts @@ -0,0 +1,30 @@ +const fs:any = require('fs') + + +const ip:object = fs.readFile('badwords.list','utf-8',(err:object,data:string)=>{ + if(!err) + { + let arr:Array = data.split('\n'); + arr.sort(); + for(let i:any =0;i{ + if(!err){ + console.log("file written successfully"); + } + }) + } +}); \ No newline at end of file diff --git a/backend/src/lib/wordlist.json b/backend/src/lib/wordlist.json new file mode 100644 index 0000000..b76a474 --- /dev/null +++ b/backend/src/lib/wordlist.json @@ -0,0 +1 @@ +{"words":["2 GIRLS 1 CUP","2G1C","AAND","AANDU","ACROTOMOPHILIA","ALABAMA HOT POCKET","ALASKAN PIPELINE","ANAL","ANILINGUS","ANUS","APESHIT","ARSEHOLE","ASS","ASSHOLE","ASSMUNCH","AUTO EROTIC","AUTOEROTIC","BABELAND","BABY BATTER","BABY JUICE","BALATKAR","BALATKARI","BALL GAG","BALL GRAVY","BALL KICKING","BALL LICKING","BALL SACK","BALL SUCKING","BANGBROS","BANGBUS","BAREBACK","BARELY LEGAL","BARENAKED","BASTARD","BASTARDO","BASTINADO","BBW","BDSM","BEANER","BEANERS","BEASTIALITY","BEAVER CLEAVER","BEAVER LIPS","BEHEN CHOD","BESTIALITY","BETI CHOD","BHADVA","BHADVE","BHANDVE","BHANGI","BHOOTNI KE","BHOSAD","BHOSADI KE","BIG BLACK","BIG BREASTS","BIG KNOCKERS","BIG TITS","BIMBOS","BIRDLOCK","BITCH","BITCHES","BLACK COCK","BLONDE ACTION","BLONDE ON BLONDE ACTION","BLOW JOB","BLOW YOUR LOAD","BLOWJOB","BLUE WAFFLE","BLUMPKIN","BOLLOCKS","BONDAGE","BONER","BOOB","BOOBE","BOOBS","BOOTY CALL","BROWN SHOWERS","BRUNETTE ACTION","BUKKAKE","BULLDYKE","BULLET VIBE","BULLSHIT","BUNG HOLE","BUNGHOLE","BUSTY","BUTT","BUTTCHEEKS","BUTTHOLE","CAMEL TOE","CAMGIRL","CAMSLUT","CAMWHORE","CARPET MUNCHER","CARPETMUNCHER","CHAKKE","CHINAAL","CHINKI","CHOCOLATE ROSEBUDS","CHOD","CHODU","CHODU BHAGAT","CHOOCHE","CHOOCHI","CHOOPE","CHOOT","CHOOT KE BAAL","CHOOTIA","CHOOTIYA","CHUCHE","CHUCHI","CHUDAAP","CHUDAI KHANAA","CHUDAM CHUDAI","CHUDE","CHUT","CHUT KA CHUHA","CHUT KA CHURAN","CHUT KA MAIL","CHUT KE BAAL","CHUT KE DHAKKAN","CHUT MAARLI","CHUTAD","CHUTADD","CHUTAN","CHUTIA","CHUTIYA","CIALIS","CIRCLEJERK","CLEVELAND STEAMER","CLIT","CLITORIS","CLOVER CLAMPS","CLUSTERFUCK","COCK","COCKS","COON","COONS","COPROLAGNIA","COPROPHILIA","CORNHOLE","CREAMPIE","CUM","CUMMING","CUMSHOT","CUMSHOTS","CUNNILINGUS","CUNT","DARKIE","DATE RAPE","DATERAPE","DEEP THROAT","DEEPTHROAT","DENDROPHILIA","DICK","DILDO","DINGLEBERRIES","DINGLEBERRY","DIRTY PILLOWS","DIRTY SANCHEZ","DOG STYLE","DOGGIE STYLE","DOGGIESTYLE","DOGGY STYLE","DOGGYSTYLE","DOLCETT","DOMINATION","DOMINATRIX","DOMMES","DONKEY PUNCH","DOUBLE DONG","DOUBLE PENETRATION","DP ACTION","DRY HUMP","DVDA","EAT MY ASS","ECCHI","EJACULATION","EROTIC","EROTISM","ESCORT","EUNUCH","FAG","FAGGOT","FECAL","FELCH","FELLATIO","FELTCH","FEMALE SQUIRTING","FEMDOM","FIGGING","FINGERBANG","FINGERING","FISTING","FOOT FETISH","FOOTJOB","FROTTING","FUCK","FUCK BUTTONS","FUCKIN","FUCKING","FUCKTARDS","FUDGE PACKER","FUDGEPACKER","FUTANARI","G-SPOT","GAAND","GAANDFAT","GAANDMASTI","GAANDUFAD","GANDFATTU","GANDU","GANG BANG","GANGBANG","GASHTI","GASTI","GAY SEX","GENITALS","GHASSA","GHASTI","GIANT COCK","GIRL ON","GIRL ON TOP","GIRLS GONE WILD","GOATCX","GOATSE","GOD DAMN","GOKKUN","GOLDEN SHOWER","GOO GIRL","GOODPOOP","GOREGASM","GROPE","GROUP SEX","GUCCHI","GUCCHU","GURO","HAND JOB","HANDJOB","HARAMI","HARAMZADE","HARD CORE","HARDCORE","HAWAS","HAWAS KE PUJARI","HENTAI","HIJDA","HIJRA","HOMOEROTIC","HONKEY","HOOKER","HORNY","HOT CARL","HOT CHICK","HOW TO KILL","HOW TO MURDER","HUGE FAT","HUMPING","INCEST","INTERCOURSE","JACK OFF","JAIL BAIT","JAILBAIT","JELLY DONUT","JERK OFF","JHANT","JHANT CHAATU","JHANT KA KEEDA","JHANT KE BAAL","JHANT KE PISSU","JHANTU","JIGABOO","JIGGABOO","JIGGERBOO","JIZZ","JUGGS","KAMINE","KAMINEY","KANJAR","KIKE","KINBAKU","KINKSTER","KINKY","KNOBBING","KUTTA","KUTTA KAMINA","KUTTE KI AULAD","KUTTE KI JAT","KUTTIYA","LEATHER RESTRAINT","LEATHER STRAIGHT JACKET","LEMON PARTY","LIVESEX","LODA","LODU","LOLITA","LOVEMAKING","LUND","LUND CHOOS","LUND KA BAKKAL","LUND KHAJOOR","LUNDTOPI","LUNDURE","MAA KI CHUT","MAAL","MADAR CHOD","MADARCHOD","MADHAVCHOD","MAKE ME COME","MALE SQUIRTING","MASTURBATE","MASTURBATING","MASTURBATION","MENAGE A TROIS","MILF","MISSIONARY POSITION","MONG","MOOH MEIN LE","MOTHERFUCKER","MOUND OF VENUS","MR HANDS","MUFF DIVER","MUFFDIVING","MUTTH","MUTTHAL","NAJAYAZ","NAJAYAZ AULAAD","NAJAYAZ PAIDAISH","NAMBLA","NAWASHI","NEGRO","NEONAZI","NIG NOG","NIGGA","NIGGER","NIMPHOMANIA","NIPPLE","NIPPLES","NSFW","NSFW IMAGES","NUDE","NUDITY","NUTTEN","NYMPHO","NYMPHOMANIA","OCTOPUSSY","OMORASHI","ONE CUP TWO GIRLS","ONE GUY ONE JAR","ORGASM","ORGY","PAEDOPHILE","PAKI","PAKI","PANTIES","PANTY","PATAKA","PATAKHA","PEDOBEAR","PEDOPHILE","PEGGING","PENIS","PHONE SEX","PIECE OF SHIT","PIKEY","PISS PIG","PISSING","PISSPIG","PLAYBOY","PLEASURE CHEST","POLE SMOKER","PONYPLAY","POOF","POON","POONTANG","POOP CHUTE","POOPCHUTE","PORN","PORNO","PORNOGRAPHY","PRINCE ALBERT PIERCING","PTHC","PUBES","PUNANY","PUSSY","QUEAF","QUEEF","QUIM","RAAND","RAGHEAD","RAGING BONER","RANDAAP","RANDI","RANDI RONA","RAPE","RAPING","RAPIST","RECTUM","REVERSE COWGIRL","RIMJOB","RIMMING","ROSY PALM","ROSY PALM AND HER 5 SISTERS","RUSTY TROMBONE","S&M","SAALA","SAALA KUTTA","SAALI KUTTI","SAALI RANDI","SADISM","SANTORUM","SCAT","SCHLONG","SCISSORING","SEMEN","SEX","SEXCAM","SEXO","SEXUAL","SEXUALITY","SEXUALLY","SEXY","SHAVED BEAVER","SHAVED PUSSY","SHEMALE","SHIBARI","SHIT","SHITBLIMP","SHITTY","SHOTA","SHRIMPING","SKEET","SLANTEYE","SLUT","SMUT","SNATCH","SNOWBALLING","SODOMIZE","SODOMY","SPASTIC","SPIC","SPLOOGE","SPLOOGE MOOSE","SPOOGE","SPREAD LEGS","SPUNK","STRAP ON","STRAPON","STRAPPADO","STRIP CLUB","STYLE DOGGY","SUAR","SUAR KE LUND","SUAR KI AULAD","SUCK","SUCKS","SUICIDE GIRLS","SULTRY WOMEN","SWASTIKA","SWINGER","TAINTED LOVE","TASTE MY","TATTE","TATTI","TEA BAGGING","TERI MAA KA BHOSADA","TERI MAA KA BOBA CHUSU","TERI MAA KI BEHENCHOD","TERI MAA KI CHUT","THARAK","THARKI","THREESOME","THROATING","THUMBZILLA","TIED UP","TIGHT WHITE","TIT","TITS","TITTIES","TITTY","TONGUE IN A","TOPLESS","TOSSER","TOWELHEAD","TRANNY","TRIBADISM","TU CHUDA","TUB GIRL","TUBGIRL","TUSHY","TWAT","TWINK","TWINKIE","TWO GIRLS ONE CUP","UNDRESSING","UPSKIRT","URETHRA PLAY","UROPHILIA","VAGINA","VENUS MOUND","VIAGRA","VIBRATOR","VIOLET WAND","VORAREPHILIA","VOYEUR","VOYEURWEB","VOYUER","VULVA","WANK","WET DREAM","WETBACK","WHITE POWER","WHORE","WORLDSEX","WRAPPING MEN","WRINKLED STARFISH","XX","XXX","YAOI","YELLOW SHOWERS","YIFFY","ZOOPHILIA","🖕"]} \ No newline at end of file diff --git a/backend/src/middleware/moderation.ts b/backend/src/middleware/moderation.ts new file mode 100644 index 0000000..a065dd7 --- /dev/null +++ b/backend/src/middleware/moderation.ts @@ -0,0 +1,54 @@ +function binarySearch(items:Array, value:string){ + var startIndex = 0, + stopIndex = items.length - 1, + middle = Math.floor((stopIndex + startIndex)/2); + + while(items[middle] != value && startIndex < stopIndex){ + + //adjust search area + if (value < items[middle]){ + stopIndex = middle - 1; + } else if (value > items[middle]){ + startIndex = middle + 1; + } + + //recalculate middle + middle = Math.floor((stopIndex + startIndex)/2); + } + + //make sure it's the right value + return (items[middle] != value) ? 0 : 1; +} + +function checkModeration(req:any,res:any,next:any){ + const fs = require("fs"); + //for some reason it is taking backend folder as the root folder + fs.readFile("./src/lib/wordlist.json", (err:any, data:any) => { + if(!err) + { + data = JSON.parse(data); + let contents = req.body.content; + let content = contents.split(" "); + var flag: boolean = true; + for (let i = 0; i < content.length; i++) { + // performing the binary searcing + if (binarySearch(data.words, content[i].toUpperCase())) { + flag = false; + break; + } + } + if (flag) + { + res.status(200); + res.send("1"); + } + else + { + res.status(401); + res.send("0"); + } + } + }) +}; + +export default checkModeration; \ No newline at end of file diff --git a/backend/src/routes/mRuote.ts b/backend/src/routes/mRuote.ts new file mode 100644 index 0000000..6588cd0 --- /dev/null +++ b/backend/src/routes/mRuote.ts @@ -0,0 +1,5 @@ +import express from "express"; +import moderation from "../middleware/moderation.js" +const router = express.Router(); +router.post("/reviews/approve",moderation); +export default router; \ No newline at end of file