diff --git a/config.py b/config.py index b5fb6d6..908891a 100644 --- a/config.py +++ b/config.py @@ -13,6 +13,7 @@ def __init__(self): # manual self.ls_index = 1 + self.enable_trie_filtering = [True, False][0] # 是否按照 domain_suffix 剔除重复的 domain self.ls_keyword = ["little-snitch", "adobe-blocklist"] # little snitch 链接关键字 self.map_dict = { 'DOMAIN-SUFFIX': 'domain_suffix', 'HOST-SUFFIX': 'domain_suffix', 'DOMAIN': 'domain', 'HOST': 'domain', 'host': 'domain', diff --git a/main.py b/main.py index 8868d70..12da0e6 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,7 @@ class RuleParser: def __init__(self): - self.ls_index = config.ls_index + self.ls_index = 1 def parse_littlesnitch_file(self, link): """ @@ -163,7 +163,7 @@ def generate_json_file(self, links, output_file): return self.merge_json(json_file_list, output_file) - def merge_json(self, json_file_list, output_file, enable_trie_filtering=True): + def merge_json(self, json_file_list, output_file, enable_trie_filtering=config.enable_trie_filtering): """ 合并 JSON 文件并进行去重(第二轮 Trie 去重为可选)。