|
22 | 22 | CONFIG_FILE = "conf/conf.yaml" |
23 | 23 |
|
24 | 24 |
|
25 | | -# ============================================================================== |
26 | | -# Utility Functions |
27 | | -# ============================================================================== |
| 25 | +## Utility Functions |
28 | 26 |
|
29 | 27 | def fetch_url(url: str) -> bytes: |
30 | 28 | """Fetch content from a URL.""" |
@@ -96,10 +94,7 @@ def find_domains_section_end(lines: list, start_idx: int) -> int: |
96 | 94 |
|
97 | 95 | return len(lines) |
98 | 96 |
|
99 | | - |
100 | | -# ============================================================================== |
101 | | -# Source-Specific Functions: Bon Appetit Porn Domains |
102 | | -# ============================================================================== |
| 97 | +## Source-Specific Functions: Bon Appetit Porn Domains |
103 | 98 |
|
104 | 99 | def fetch_bon_appetit() -> Tuple[List[str], str, Dict]: |
105 | 100 | """ |
@@ -166,9 +161,7 @@ def parse_bon_appetit(domain: str) -> str: |
166 | 161 | return f' - {{"name": "{domain}", "always_block": true, "absolute": true}}' |
167 | 162 |
|
168 | 163 |
|
169 | | -# ============================================================================== |
170 | | -# Source-Specific Functions: StevenBlack Hosts |
171 | | -# ============================================================================== |
| 164 | +## Source-Specific Functions: StevenBlack Hosts |
172 | 165 |
|
173 | 166 | def fetch_stevenblack() -> Tuple[List[str], str, Dict]: |
174 | 167 | """ |
@@ -244,9 +237,7 @@ def parse_stevenblack(domain: str) -> str: |
244 | 237 | return f' - {{\"name\": \"{domain}\", \"always_block\": true, \"absolute\": true}}' |
245 | 238 |
|
246 | 239 |
|
247 | | -# ============================================================================== |
248 | | -# Source-Specific Functions: HaGeZi DoH/VPN/TOR/Proxy Bypass |
249 | | -# ============================================================================== |
| 240 | +## Source-Specific Functions: HaGeZi DoH/VPN/TOR/Proxy Bypass |
250 | 241 |
|
251 | 242 | def fetch_hagezi() -> Tuple[List[str], str, Dict]: |
252 | 243 | """ |
@@ -324,9 +315,7 @@ def parse_hagezi(domain: str) -> str: |
324 | 315 | return f' - {{\"name\": \"{domain}\", \"always_block\": true, \"absolute\": true}}' |
325 | 316 |
|
326 | 317 |
|
327 | | -# ============================================================================== |
328 | | -# Source-Specific Functions: UnblockStop Proxy Bypass |
329 | | -# ============================================================================== |
| 318 | +## Source-Specific Functions: UnblockStop Proxy Bypass |
330 | 319 |
|
331 | 320 | def fetch_unblockstop() -> Tuple[List[str], str, Dict]: |
332 | 321 | """ |
@@ -390,10 +379,7 @@ def parse_unblockstop(domain: str) -> str: |
390 | 379 | return f' - {{\"name\": \"{domain}\", \"always_block\": true, \"absolute\": true}}' |
391 | 380 |
|
392 | 381 |
|
393 | | -# ============================================================================== |
394 | | -# Source Registry |
395 | | -# ============================================================================== |
396 | | - |
| 382 | +## Source Registry |
397 | 383 | SOURCES = [ |
398 | 384 | { |
399 | 385 | 'id': 1, |
@@ -431,9 +417,7 @@ def parse_unblockstop(domain: str) -> str: |
431 | 417 | ] |
432 | 418 |
|
433 | 419 |
|
434 | | -# ============================================================================== |
435 | | -# Generic Source Update Logic |
436 | | -# ============================================================================== |
| 420 | +## Generic Source Update Logic |
437 | 421 |
|
438 | 422 | def get_source_by_id(source_id: int) -> Optional[Dict]: |
439 | 423 | """Get source definition by ID.""" |
@@ -590,10 +574,7 @@ def update_source(source_id: int): |
590 | 574 | print(f" Error writing config file: {e}", file=sys.stderr) |
591 | 575 | sys.exit(1) |
592 | 576 |
|
593 | | - |
594 | | -# ============================================================================== |
595 | | -# Strip Managed Sources |
596 | | -# ============================================================================== |
| 577 | +## Strip Managed Sources |
597 | 578 |
|
598 | 579 | def strip_managed_sources(): |
599 | 580 | """Remove all managed domain lists from the config file.""" |
@@ -659,11 +640,7 @@ def strip_managed_sources(): |
659 | 640 | print(f" Error writing config file: {e}", file=sys.stderr) |
660 | 641 | sys.exit(1) |
661 | 642 |
|
662 | | - |
663 | | -# ============================================================================== |
664 | | -# Source Listing |
665 | | -# ============================================================================== |
666 | | - |
| 643 | +## Source Listing |
667 | 644 | def list_sources(): |
668 | 645 | """Display all available sources with their current status.""" |
669 | 646 | # Read config file once |
@@ -713,10 +690,7 @@ def list_sources(): |
713 | 690 | print(" ./update_domains.py <number> - Update a specific source") |
714 | 691 | print(" ./update_domains.py strip - Remove all managed sources\n") |
715 | 692 |
|
716 | | - |
717 | | -# ============================================================================== |
718 | | -# Main Entry Point |
719 | | -# ============================================================================== |
| 693 | +## Main Entry Point |
720 | 694 |
|
721 | 695 | def main(): |
722 | 696 | """Main execution function with CLI argument parsing.""" |
|
0 commit comments