From 3b6d63d9fb3c8e249f1c289df9615659efe370fe Mon Sep 17 00:00:00 2001 From: Amos Vstar Date: Sun, 15 Dec 2024 15:41:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=85=8D=E7=BD=AE=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.py | 1 + main.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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 去重为可选)。