Auto-update: Mon Aug 5 17:39:27 PDT 2024
This commit is contained in:
parent
72d3ba27b2
commit
954ad967e9
3 changed files with 6 additions and 6 deletions
|
@ -29,9 +29,8 @@ from requests.adapters import HTTPAdapter
|
|||
from urllib3.util.retry import Retry
|
||||
from datetime import datetime as dt_datetime
|
||||
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 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()
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ from urllib3.util.retry import Retry
|
|||
from fastapi import APIRouter, BackgroundTasks, UploadFile, Form, HTTPException, Query, Path as FastAPIPath
|
||||
from pathlib import Path
|
||||
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
|
||||
|
||||
news = APIRouter()
|
||||
|
|
|
@ -27,6 +27,7 @@ from scipy.spatial import cKDTree
|
|||
from dateutil.parser import parse as dateutil_parse
|
||||
from docx import Document
|
||||
from sshtunnel import SSHTunnelForwarder
|
||||
from urllib.parse import urlparse
|
||||
from fastapi import Depends, HTTPException, Request, UploadFile
|
||||
from fastapi.security.api_key import APIKeyHeader
|
||||
|
||||
|
@ -215,15 +216,15 @@ def load_filter_lists(blocklists_dir: Path):
|
|||
try:
|
||||
with open(file_path, 'r', encoding='utf-8') as file:
|
||||
rules.extend(file.read().splitlines())
|
||||
logging.info(f"Loaded blocklist: {file_path.name}")
|
||||
info(f"Loaded blocklist: {file_path.name}")
|
||||
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
|
||||
|
||||
|
||||
def initialize_adblock_rules(blocklists_dir: Path):
|
||||
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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue