блокирование так же по названиям файлов

This commit is contained in:
Alexey Kasyanchuk 2017-01-23 23:00:09 +03:00
parent ccfd5f4734
commit c9f901b0f4

View File

@ -236,12 +236,8 @@ const ContentCategoryProp = 'contentCategory';
const XXX_BLOCK_WORDS = require('./bad-words');
const detectSubCategory = (torrent, files, typesPriority, contentType) => {
let name = torrent.name.toLowerCase()
// блокируем порнографию
if(contentType == ContentTypes.VIDEO)
{
const blockBadName = (torrent, name) => {
let splitName = name.split(/[`~!@#$%^&*()\]\[{}.,+?/\\;:\-_' "|]/);
splitName.some((word) => {
if (XXX_BLOCK_WORDS.some(function(v) { return word == v; })) {
@ -250,6 +246,27 @@ const detectSubCategory = (torrent, files, typesPriority, contentType) => {
return torrent[ContentCategoryProp] == 'xxx';
})
}
const detectSubCategory = (torrent, files, typesPriority, contentType) => {
let name = torrent.name.toLowerCase()
// блокируем порнографию
if(contentType == ContentTypes.VIDEO || contentType == ContentTypes.PICTURES)
{
blockBadName(torrent, name);
// блокируем так по названию файлов
if(torrent[ContentCategoryProp] != 'xxx')
{
files.some(({path}) => {
blockBadName(torrent, path.toLowerCase());
if(torrent[ContentCategoryProp] == 'xxx')
{
console.log('block because file' + path);
}
return torrent[ContentCategoryProp] == 'xxx';
})
}
}
}
const fileDetect = (file) => {