reload whitelist function

This commit is contained in:
Erik 2022-07-30 19:02:05 +03:00
parent 7dac86bb2a
commit 0b150680ff
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
2 changed files with 8 additions and 1 deletions

View File

@ -3,7 +3,7 @@ const { inspect } = require('util');
const { username } = require('os').userInfo();
// eslint-disable-next-line no-unused-vars
const { Util } = require("../../../../utilities");
const { Util, FilterUtil } = require("../../../../utilities");
class EvalCommand extends Command {

View File

@ -3,6 +3,8 @@ const similarity = require('similarity');
const { FilterPresets } = require('../constants/index.js');
const BinaryTree = require('./BinaryTree.js');
const Logger = require('./Logger.js');
const fs = require('fs');
const path = require('path');
module.exports = class FilterUtility {
@ -16,6 +18,11 @@ module.exports = class FilterUtility {
}
static reloadFilterWhitelist() {
const { whitelist } = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'src/constants/FilterPresets.json'), { encoding: 'utf-8' }));
FilterUtility.whitelist = new BinaryTree(null, whitelist);
}
/*static filter = {
words: CONFIG.words.map((word) => new RegExp(`(${word})`, 'gi')),
_words: CONFIG._words,