84 lines
2.8 KiB
Python
84 lines
2.8 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
BACKEND = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
api_host: str = "127.0.0.1"
|
|
api_port: int = 8000
|
|
cors_origins: str = (
|
|
"http://localhost:3000,http://127.0.0.1:3000,"
|
|
"http://localhost:5173,http://127.0.0.1:5173,"
|
|
"http://127.0.0.1:18574,http://localhost:18574"
|
|
)
|
|
|
|
pb_url: str = "http://127.0.0.1:8090"
|
|
pb_admin_email: str = "hackrobot@douyin.local"
|
|
pb_admin_password: str = "Xiao4669805@"
|
|
|
|
data_dir: Path = BACKEND / "data"
|
|
covers_dir: Path = BACKEND / "data" / "covers"
|
|
clips_dir: Path = BACKEND / "data" / "clips"
|
|
sqlite_path: Path = BACKEND / "data" / "monitor.db"
|
|
|
|
# Anti risk-control defaults — aligned with sh2 config.ini
|
|
# 循环时间(秒)=300, 同一时间访问网络的线程数=3 (we use 1 for safer mass poll)
|
|
max_concurrency: int = 1
|
|
min_request_gap_sec: float = 3.0
|
|
request_jitter_sec: float = 2.0
|
|
offline_interval_sec: float = 300.0
|
|
live_interval_sec: float = 120.0
|
|
error_backoff_base_sec: float = 60.0
|
|
error_backoff_max_sec: float = 600.0
|
|
global_pause_on_risk_sec: float = 90.0
|
|
capture_cover_on_start: bool = True
|
|
ffmpeg_bin: str = "ffmpeg"
|
|
|
|
# SeaweedFS S3 API (open-source object storage with F)
|
|
s3_enabled: bool = False
|
|
s3_endpoint: str = "http://127.0.0.1:8333"
|
|
s3_public_base: str = "" # e.g. http://107.173.30.245:8333
|
|
s3_access_key: str = "douyin"
|
|
s3_secret_key: str = "douyinweb_s3_2026"
|
|
s3_bucket: str = "douyin-covers"
|
|
s3_region: str = "us-east-1"
|
|
|
|
# Node sidecar: youtubei.js (https://github.com/LuanRT/YouTube.js)
|
|
youtube_svc_url: str = "http://127.0.0.1:8020"
|
|
|
|
# Optional: require X-API-Key on POST/PATCH/DELETE (leave empty to disable)
|
|
api_key: str = ""
|
|
|
|
# Public HTTPS origin, e.g. https://ypp.smallzhiyuns.com
|
|
public_base_url: str = ""
|
|
|
|
# Site login (whole-site protection)
|
|
auth_enabled: bool = True
|
|
admin_username: str = "hackrobot"
|
|
admin_password: str = "Xiao4669805@"
|
|
session_secret: str = "douyinweb-session-2026"
|
|
|
|
# Neko browser (per YouTube assign group) — US VPS direct, no ShellClash
|
|
neko_enabled: bool = True
|
|
neko_http_port_base: int = 9200
|
|
neko_webrtc_mux_base: int = 52300
|
|
neko_user_pass: str = "douyinweb"
|
|
neko_admin_pass: str = "Xiao4669805@"
|
|
neko_image: str = "ghcr.io/m1k1o/neko/chromium:3.0.0"
|
|
neko_nat1to1: str = ""
|
|
|
|
class Config:
|
|
env_prefix = "DY_"
|
|
env_file = ".env"
|
|
|
|
|
|
settings = Settings()
|
|
settings.data_dir.mkdir(parents=True, exist_ok=True)
|
|
settings.covers_dir.mkdir(parents=True, exist_ok=True)
|
|
settings.clips_dir.mkdir(parents=True, exist_ok=True)
|