new version

This commit is contained in:
UrloMythus
2026-01-11 14:29:22 +01:00
parent b8a40b5afc
commit 7785e8c604
45 changed files with 5463 additions and 832 deletions

View File

@@ -19,11 +19,14 @@ class TransportConfig(BaseSettings):
proxy_url: Optional[str] = Field(
None, description="Primary proxy URL. Example: socks5://user:pass@proxy:1080 or http://proxy:8080"
)
disable_ssl_verification_globally: bool = Field(
False, description="Disable SSL verification for all requests globally."
)
all_proxy: bool = Field(False, description="Enable proxy for all routes by default")
transport_routes: Dict[str, RouteConfig] = Field(
default_factory=dict, description="Pattern-based route configuration"
)
timeout: int = Field(30, description="Timeout for HTTP requests in seconds")
timeout: int = Field(60, description="Timeout for HTTP requests in seconds")
def get_mounts(
self, async_http: bool = True
@@ -33,11 +36,13 @@ class TransportConfig(BaseSettings):
"""
mounts = {}
transport_cls = httpx.AsyncHTTPTransport if async_http else httpx.HTTPTransport
global_verify = not self.disable_ssl_verification_globally
# Configure specific routes
for pattern, route in self.transport_routes.items():
mounts[pattern] = transport_cls(
verify=route.verify_ssl, proxy=route.proxy_url or self.proxy_url if route.proxy else None
verify=route.verify_ssl if global_verify else False,
proxy=route.proxy_url or self.proxy_url if route.proxy else None,
)
# Hardcoded configuration for jxoplay.xyz domain - SSL verification disabled
@@ -45,9 +50,23 @@ class TransportConfig(BaseSettings):
verify=False, proxy=self.proxy_url if self.all_proxy else None
)
mounts["all://dlhd.dad"] = transport_cls(
verify=False, proxy=self.proxy_url if self.all_proxy else None
)
mounts["all://*.newkso.ru"] = transport_cls(
verify=False, proxy=self.proxy_url if self.all_proxy else None
)
# Apply global settings for proxy and SSL
default_proxy_url = self.proxy_url if self.all_proxy else None
if default_proxy_url or not global_verify:
mounts["all://"] = transport_cls(proxy=default_proxy_url, verify=global_verify)
# Set default proxy for all routes if enabled
if self.all_proxy:
mounts["all://"] = transport_cls(proxy=self.proxy_url)
# This part is now handled above to combine proxy and SSL settings
# if self.all_proxy:
# mounts["all://"] = transport_cls(proxy=self.proxy_url)
return mounts
@@ -78,6 +97,8 @@ class Settings(BaseSettings):
dash_prebuffer_cache_size: int = 50 # Maximum number of segments to cache in memory.
dash_prebuffer_max_memory_percent: int = 80 # Maximum percentage of system memory to use for DASH pre-buffer cache.
dash_prebuffer_emergency_threshold: int = 90 # Emergency threshold percentage to trigger aggressive cache cleanup.
mpd_live_init_cache_ttl: int = 0 # TTL (seconds) for live init segment cache; 0 disables caching.
mpd_live_playlist_depth: int = 8 # Number of recent segments to expose per live playlist variant.
user_agent: str = (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36" # The user agent to use for HTTP requests.