mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
refactor(config): retire RuntimeSettingsCompat host usage
This commit is contained in:
@@ -8,9 +8,8 @@ from urllib.parse import urljoin, urlsplit
|
||||
|
||||
from requests import Session
|
||||
|
||||
from app.runtime.settings import RuntimeSettingsCompat
|
||||
from app.runtime.settings import get_runtime_setting
|
||||
|
||||
settings = RuntimeSettingsCompat()
|
||||
from app.adapters.network.cloudflare import under_challenge
|
||||
from app.runtime.log import logger
|
||||
from app.adapters.network.http import RequestUtils
|
||||
@@ -228,7 +227,7 @@ class SiteParserBase(metaclass=ABCMeta):
|
||||
)
|
||||
)
|
||||
# 解析用户未读消息
|
||||
if settings.SITE_MESSAGE:
|
||||
if get_runtime_setting('SITE_MESSAGE'):
|
||||
self._pase_unread_msgs()
|
||||
# 解析用户上传、下载、分享率等信息
|
||||
if self._user_traffic_page:
|
||||
@@ -346,7 +345,7 @@ class SiteParserBase(metaclass=ABCMeta):
|
||||
:return:
|
||||
"""
|
||||
req_headers = None
|
||||
proxies = settings.PROXY if self._proxy else None
|
||||
proxies = get_runtime_setting('PROXY') if self._proxy else None
|
||||
if self._ua or headers or self._addition_headers:
|
||||
|
||||
if self.request_mode == "apikey":
|
||||
@@ -408,8 +407,8 @@ class SiteParserBase(metaclass=ABCMeta):
|
||||
f"{self._site_name} 检测到Cloudflare,请更新Cookie和UA")
|
||||
return ""
|
||||
return RequestUtils.get_decoded_html_content(res,
|
||||
settings.ENCODING_DETECTION_PERFORMANCE_MODE,
|
||||
settings.ENCODING_DETECTION_MIN_CONFIDENCE)
|
||||
get_runtime_setting('ENCODING_DETECTION_PERFORMANCE_MODE'),
|
||||
get_runtime_setting('ENCODING_DETECTION_MIN_CONFIDENCE'))
|
||||
|
||||
return ""
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@ from urllib.parse import urljoin
|
||||
from typing import Optional, Tuple
|
||||
|
||||
from app.runtime.log import logger
|
||||
from app.runtime.settings import RuntimeSettingsCompat
|
||||
from app.runtime.settings import get_runtime_setting
|
||||
|
||||
settings = RuntimeSettingsCompat()
|
||||
from app.adapters.network.http import RequestUtils
|
||||
from app.domain import site as site_rules
|
||||
from app.foundation import temporal as time_tools
|
||||
@@ -195,7 +194,7 @@ class RousiSiteUserInfo(SiteParserBase):
|
||||
res = RequestUtils(
|
||||
headers=headers,
|
||||
timeout=60,
|
||||
proxies=settings.PROXY if self._proxy else None
|
||||
proxies=get_runtime_setting('PROXY') if self._proxy else None
|
||||
).get_res(
|
||||
url=urljoin(self._base_url, "api/messages"),
|
||||
params=params
|
||||
@@ -231,7 +230,7 @@ class RousiSiteUserInfo(SiteParserBase):
|
||||
RequestUtils(
|
||||
headers=headers,
|
||||
timeout=60,
|
||||
proxies=settings.PROXY if self._proxy else None
|
||||
proxies=get_runtime_setting('PROXY') if self._proxy else None
|
||||
).post_res(
|
||||
url=urljoin(self._base_url, "api/messages/read-all")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user