Skip to content

Commit

Permalink
Update & Release
Browse files Browse the repository at this point in the history
  • Loading branch information
zsxsoft committed May 13, 2016
1 parent 31345f9 commit 08eaca4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/utils/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ let cachedFilters = {};
/**
* 检测用户是否被封禁
*/
let checkUserIsBlocked = _.curry((room, blockUsers, hash) => {
let checkUserIsBlocked = _.curry((blockUsers, hash) => {
return (blockUsers.indexOf(hash)) > -1;
});
/**
* 检测文字是否和谐
*/
let validateText = _.curry((room, ignoreRegEx, checkRegEx, str) => {
let validateText = _.curry((ignoreRegEx, checkRegEx, str) => {
checkRegEx.lastIndex = 0;
let testStr = str.replace(ignoreRegEx, "");
return !checkRegEx.test(testStr);
});
/**
* 替换关键字
*/
let replaceKeyword = _.curry((room, regex, str) => {
let replaceKeyword = _.curry((regex, str) => {
return str.replace(regex, "***");
});

Expand All @@ -37,9 +37,9 @@ function initialize(roomName, forceUpdate) {
throw "Init RegExp Error";
}
let ret = {
checkUserIsBlocked: checkUserIsBlocked(roomName)(room.blockusers),
validateText: validateText(roomName)(room.keyword.ignore)(room.keyword.block),
replaceKeyword: replaceKeyword(roomName)(room.keyword.replacement),
checkUserIsBlocked: checkUserIsBlocked(room.blockusers),
validateText: validateText(room.keyword.ignore)(room.keyword.block),
replaceKeyword: replaceKeyword(room.keyword.replacement),
};
cachedFilters[roomName] = null; // Release Memory
cachedFilters[roomName] = ret;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "danmu-server",
"version": "1.0.6-pre",
"version": "1.0.6",
"license": "MIT",
"scripts": {
"start": "node app.js",
Expand Down

0 comments on commit 08eaca4

Please sign in to comment.