mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
refactor: route browser auth settings through runtime
This commit is contained in:
@@ -7,8 +7,8 @@ from dataclasses import dataclass, field
|
||||
from typing import Any, Callable, Optional, Protocol
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
from app.runtime.settings import RuntimeSettingsCompat
|
||||
from app.runtime.managed_resources import (
|
||||
acquire_managed_resource,
|
||||
acquire_managed_resource_async,
|
||||
@@ -16,6 +16,10 @@ from app.runtime.managed_resources import (
|
||||
from app.adapters.network.http import RequestUtils, cookie_parse
|
||||
|
||||
|
||||
# 保留旧插件可覆盖的模块级入口,默认通过 runtime 代理动态读取浏览器配置。
|
||||
settings = RuntimeSettingsCompat()
|
||||
|
||||
|
||||
class BrowserElement(Protocol):
|
||||
"""
|
||||
页面元素的最小接口,避免为了类型标注直接导入 Playwright。
|
||||
|
||||
@@ -15,8 +15,8 @@ from fastapi.security import (
|
||||
)
|
||||
|
||||
from app.runtime.cache import cached
|
||||
from app.runtime.config import settings
|
||||
from app.runtime.log import logger
|
||||
from app.runtime.settings import RuntimeSettingsCompat
|
||||
from app.schemas.token import TokenPayload
|
||||
|
||||
SuperuserTokenPayloadProvider = Callable[[], TokenPayload]
|
||||
@@ -27,6 +27,10 @@ _token_encoder: Optional[TokenEncoder] = None
|
||||
_token_decoder: Optional[TokenDecoder] = None
|
||||
JWT_ALGORITHM = "HS256"
|
||||
|
||||
|
||||
# 兼容旧鉴权插件覆盖模块级设置;令牌实际策略仍由已注入 codec 和 runtime 配置提供。
|
||||
settings = RuntimeSettingsCompat()
|
||||
|
||||
oauth2_scheme_manual_error = OAuth2PasswordBearer(
|
||||
auto_error=False,
|
||||
tokenUrl=f"{settings.API_V1_STR}/login/access-token",
|
||||
|
||||
Reference in New Issue
Block a user