hh
This commit is contained in:
@@ -33,6 +33,9 @@ _MATRIX_AVAILABLE: Optional[bool] = None
|
||||
_MATRIX_UNAVAILABLE_REASON: Optional[str] = None
|
||||
_MATRIX_CHECK_COMPLETE = False
|
||||
|
||||
# Global state for Cookies availability
|
||||
_COOKIES_FILE_PATH: Optional[str] = None
|
||||
|
||||
|
||||
def check_hydrus_availability(config: Dict[str, Any]) -> Tuple[bool, Optional[str]]:
|
||||
"""Check if Hydrus API is available by pinging it.
|
||||
@@ -575,3 +578,24 @@ def initialize_local_library_scan(config: Dict[str, Any]) -> None:
|
||||
except Exception as e:
|
||||
logger.error(f"[Startup] Failed to scan local library: {e}", exc_info=True)
|
||||
debug(f"⚠️ Local Library: ERROR - Scan failed: {e}", file=sys.stderr)
|
||||
|
||||
|
||||
def initialize_cookies_check() -> None:
|
||||
"""Check for cookies.txt in the application root directory."""
|
||||
global _COOKIES_FILE_PATH
|
||||
|
||||
# Assume CLI.py is in the root
|
||||
root_dir = Path(__file__).parent
|
||||
cookies_path = root_dir / "cookies.txt"
|
||||
|
||||
if cookies_path.exists():
|
||||
_COOKIES_FILE_PATH = str(cookies_path)
|
||||
debug(f"✅ Cookies: ENABLED - Found cookies.txt", file=sys.stderr)
|
||||
else:
|
||||
_COOKIES_FILE_PATH = None
|
||||
# debug("ℹ️ Cookies: Using browser cookies (fallback)", file=sys.stderr)
|
||||
|
||||
|
||||
def get_cookies_file_path() -> Optional[str]:
|
||||
"""Get the path to the cookies.txt file if it exists."""
|
||||
return _COOKIES_FILE_PATH
|
||||
|
||||
Reference in New Issue
Block a user