Auto-update: Mon Aug 5 17:39:27 PDT 2024
This commit is contained in:
parent
2a299e77af
commit
1da12755c8
3 changed files with 6 additions and 6 deletions
sijapi
|
@ -29,9 +29,8 @@ from requests.adapters import HTTPAdapter
|
||||||
from urllib3.util.retry import Retry
|
from urllib3.util.retry import Retry
|
||||||
from datetime import datetime as dt_datetime
|
from datetime import datetime as dt_datetime
|
||||||
from better_profanity import profanity
|
from better_profanity import profanity
|
||||||
from sijapi.classes import L, API, Archivist
|
|
||||||
from sijapi.utilities import html_to_markdown, sanitize_filename, assemble_journal_path, assemble_archive_path, contains_profanity, is_ad_or_tracker, initialize_adblock_rules, contains_blacklisted_word
|
from sijapi.utilities import html_to_markdown, sanitize_filename, assemble_journal_path, assemble_archive_path, contains_profanity, is_ad_or_tracker, initialize_adblock_rules, contains_blacklisted_word
|
||||||
from sijapi import L, Archivist, BLOCKLISTS_DIR, OBSIDIAN_VAULT_DIR, OBSIDIAN_RESOURCES_DIR, DEFAULT_11L_VOICE, DEFAULT_VOICE
|
from sijapi import L, API, Archivist, BLOCKLISTS_DIR, OBSIDIAN_VAULT_DIR, OBSIDIAN_RESOURCES_DIR, DEFAULT_11L_VOICE, DEFAULT_VOICE
|
||||||
|
|
||||||
archivist = APIRouter()
|
archivist = APIRouter()
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ from urllib3.util.retry import Retry
|
||||||
from fastapi import APIRouter, BackgroundTasks, UploadFile, Form, HTTPException, Query, Path as FastAPIPath
|
from fastapi import APIRouter, BackgroundTasks, UploadFile, Form, HTTPException, Query, Path as FastAPIPath
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from sijapi import L, News, Archivist, OBSIDIAN_VAULT_DIR, OBSIDIAN_RESOURCES_DIR, DEFAULT_11L_VOICE, DEFAULT_VOICE
|
from sijapi import L, News, Archivist, OBSIDIAN_VAULT_DIR, OBSIDIAN_RESOURCES_DIR, DEFAULT_11L_VOICE, DEFAULT_VOICE
|
||||||
from sijapi.utilities import htmp_to_markdown, sanitize_filename, assemble_journal_path, assemble_archive_path, contains_profanity, is_ad_or_tracker
|
from sijapi.utilities import html_to_markdown, sanitize_filename, assemble_journal_path, assemble_archive_path, contains_profanity, is_ad_or_tracker
|
||||||
from sijapi.routers import gis, llm, tts, note
|
from sijapi.routers import gis, llm, tts, note
|
||||||
|
|
||||||
news = APIRouter()
|
news = APIRouter()
|
||||||
|
|
|
@ -27,6 +27,7 @@ from scipy.spatial import cKDTree
|
||||||
from dateutil.parser import parse as dateutil_parse
|
from dateutil.parser import parse as dateutil_parse
|
||||||
from docx import Document
|
from docx import Document
|
||||||
from sshtunnel import SSHTunnelForwarder
|
from sshtunnel import SSHTunnelForwarder
|
||||||
|
from urllib.parse import urlparse
|
||||||
from fastapi import Depends, HTTPException, Request, UploadFile
|
from fastapi import Depends, HTTPException, Request, UploadFile
|
||||||
from fastapi.security.api_key import APIKeyHeader
|
from fastapi.security.api_key import APIKeyHeader
|
||||||
|
|
||||||
|
@ -215,15 +216,15 @@ def load_filter_lists(blocklists_dir: Path):
|
||||||
try:
|
try:
|
||||||
with open(file_path, 'r', encoding='utf-8') as file:
|
with open(file_path, 'r', encoding='utf-8') as file:
|
||||||
rules.extend(file.read().splitlines())
|
rules.extend(file.read().splitlines())
|
||||||
logging.info(f"Loaded blocklist: {file_path.name}")
|
info(f"Loaded blocklist: {file_path.name}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error loading blocklist {file_path.name}: {str(e)}")
|
err(f"Error loading blocklist {file_path.name}: {str(e)}")
|
||||||
return rules
|
return rules
|
||||||
|
|
||||||
|
|
||||||
def initialize_adblock_rules(blocklists_dir: Path):
|
def initialize_adblock_rules(blocklists_dir: Path):
|
||||||
rules = load_filter_lists(blocklists_dir)
|
rules = load_filter_lists(blocklists_dir)
|
||||||
logging.info(f"Initialized AdblockRules with {len(rules)} rules")
|
info(f"Initialized AdblockRules with {len(rules)} rules")
|
||||||
return AdblockRules(rules)
|
return AdblockRules(rules)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue