fix: 修复proxy_service和account_service中不当的顶层import

- proxy_service.py: 将requests和WhitelistManager改为函数内延迟import,
  避免启动时加载不需要的依赖;移除未使用的get_exit_ip_via_proxy导入
- account_service.py: 移除未使用的func、joinedload、AuditLog、
  user_has_permission顶层导入
This commit is contained in:
yml2213
2026-06-23 08:35:29 +08:00
parent 2ab6724543
commit dd56de9bd4
40 changed files with 2006 additions and 936 deletions
+20
View File
@@ -0,0 +1,20 @@
"""代理模块使用的白名单适配器。"""
from typing import Optional
from .whitelist import WhitelistManager, get_local_exit_ip
class DouyuWhitelistSyncer:
"""把白名单 API 隔离成代理解析流程可调用的适配器。"""
def __init__(self, uid: str, ukey: str):
self.uid = uid
self.ukey = ukey
def sync_ip(self, ip: str) -> tuple[bool, str]:
manager = WhitelistManager(self.uid, self.ukey)
return manager.sync_ip(ip)
def get_local_exit_ip(self) -> Optional[str]:
return get_local_exit_ip()