Index: files/whitelist.js |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/files/whitelist.js |
@@ -0,0 +1,13 @@ |
+const whitelist = { |
+ check: function(url) { |
+ rules = lists.whitelist.get(); |
+ for(i in rules) { |
+ if(url.match(this.regex(rules[i]))) |
+ return false; |
+ } |
+ return true; |
+ }, |
+ regex: function(rule) { |
+ return RegExp(rule.replace(".","\\.").replace("*",".*").replace("[","\\[").replace("(","\\(").replace("||","[a-z]+://([a-z]+\\.){0,2}").replace("^","[!\"#$&'()*+,/:;<=>?@[\\]\\\\^`{}|~]")); |
+ } |
+}; |