Hujiarui il y a 2 jours
Parent
commit
55da3a9f66
3 fichiers modifiés avec 27 ajouts et 9 suppressions
  1. 1 1
      Dockerfile
  2. 2 2
      deps.txt
  3. 24 6
      plugins/vfs_plugin.py

+ 1 - 1
Dockerfile

@@ -52,7 +52,7 @@ RUN mkdir -p /opt/ungoogled-chromium && \
     rm /tmp/chrome.tar.xz
 
 # 复制并解压 mihomo
-COPY downloads/mihomo-linux-amd64-alpha-98aa7e6.gz /tmp/mihomo.gz
+COPY downloads/mihomo-linux-amd64.gz /tmp/mihomo.gz
 RUN gzip -dc /tmp/mihomo.gz > /bin/mihomo && chmod +x /bin/mihomo && rm /tmp/mihomo.gz
 
 # 依赖安装

+ 2 - 2
deps.txt

@@ -1,4 +1,4 @@
-mihomo-linux-amd64-alpha-98aa7e6.gz|https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha/mihomo-linux-amd64-alpha-98aa7e6.gz
-mihomo-windows-amd64-alpha-98aa7e6.zip|https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha/mihomo-windows-amd64-alpha-98aa7e6.zip
+mihomo-linux-amd64.gz|https://github.com/MetaCubeX/mihomo/releases/download/v1.19.24/mihomo-linux-amd64-v3-v1.19.24.gz
+mihomo-windows-amd64.zip|https://github.com/MetaCubeX/mihomo/releases/download/v1.19.24/mihomo-windows-amd64-v3-v1.19.24.zip
 ungoogled-chromium-144.0.7559.132-1-x86_64_linux.tar.xz|https://github.com/adryfish/fingerprint-chromium/releases/download/144.0.7559.132/ungoogled-chromium-144.0.7559.132-1-x86_64_linux.tar.xz
 ungoogled-chromium_144.0.7559.132-1.1_windows_x64.zip|https://github.com/adryfish/fingerprint-chromium/releases/download/144.0.7559.132/ungoogled-chromium_144.0.7559.132-1.1_windows_x64.zip

+ 24 - 6
plugins/vfs_plugin.py

@@ -20,10 +20,11 @@ from cryptography.hazmat.primitives import serialization, hashes
 from cryptography.hazmat.primitives.asymmetric import padding
 from cryptography.hazmat.backends import default_backend
 
+import configure
 from vs_plg import IVSPlg 
 from vs_types import VSPlgConfig, AppointmentType, VSQueryResult, VSBookResult, DateAvailability, AvailabilityStatus, NotFoundError, PermissionDeniedError, RateLimiteddError, SessionExpiredOrInvalidError, BizLogicError 
 from toolkit.vs_cloud_api import VSCloudApi
-from toolkit.proxy_tunnel import ProxyTunnel
+from toolkit.mihomo_tunnel import MihomoTunnel
 from utils.cloudflare_bypass_for_scraping import CloudflareBypasser
 
 
@@ -217,20 +218,37 @@ class VfsPlugin(IVSPlg):
         co.set_local_port(debug_port)
         co.set_user_data_path(self.user_data_path)
         
-        chrome_path = os.getenv("CHROME_BIN")
+        chrome_path = configure.CHROME_PATH
+        if not chrome_path:
+            chrome_path = os.getenv("CHROME_BIN")
         if chrome_path and os.path.exists(chrome_path):
             co.set_paths(browser_path=chrome_path)
         
         if self.config.proxy and self.config.proxy.ip:
             p = self.config.proxy
-            
+            self._log(f'Current proxy id={p.id}')
             if p.username and p.password:
                 self._log(f"Starting Proxy Tunnel for {p.ip}...")
-                self.tunnel = ProxyTunnel(p.ip, p.port, p.username, p.password)
+                exit_node = {
+                    "name": "ExitNode",
+                    "type": p.proto,
+                    "server": p.ip,
+                    "port": p.port,
+                    "username": p.username,
+                    "password": p.password
+                }
+                relay_node = None
+                if configure.MIHOMO_RELAY_NODES:
+                    relay_node = random.choice(configure.MIHOMO_RELAY_NODES)
+                mihomo_path = configure.MIHOMO_BIN_PATH
+                if not mihomo_path:
+                    mihomo_path = os.getenv("MIHOMO_BIN")
+                if not mihomo_path:
+                    raise BizLogicError(message='Mihomo path is null, You need set mihomo bin path in configure or os env')
+                self.tunnel = MihomoTunnel(mihomo_path, exit_node=exit_node, relay_node=relay_node)
                 local_proxy = self.tunnel.start()
                 self._log(f"Tunnel started at {local_proxy}")
                 co.set_argument(f'--proxy-server={local_proxy}')
-                
             else:
                 proxy_str = f"{p.proto}://{p.ip}:{p.port}"
                 co.set_argument(f'--proxy-server={proxy_str}')
@@ -239,7 +257,7 @@ class VfsPlugin(IVSPlg):
             
         co.headless(False) 
         co.set_argument('--no-sandbox')
-        # co.set_argument('--disable-gpu')
+        co.set_argument('--disable-gpu')
         co.set_argument('--disable-dev-shm-usage') 
         co.set_argument('--window-size=1920,1080')
         co.set_argument('--disable-blink-features=AutomationControlled')