瀏覽代碼

fix: ss2022 user pk for us clash & v2rayjson

M1Screw 1 年之前
父節點
當前提交
520f56fdd6
共有 2 個文件被更改,包括 5 次插入2 次删除
  1. 2 1
      src/Services/Subscribe/Clash.php
  2. 3 1
      src/Services/Subscribe/V2RayJson.php

+ 2 - 1
src/Services/Subscribe/Clash.php

@@ -57,13 +57,14 @@ final class Clash extends Base
 
                     // Clash 特定配置
                     $udp = $node_custom_config['udp'] ?? true;
+                    $server_key = $node_custom_config['server_key'] ?? '';
 
                     $node = [
                         'name' => $node_raw->name,
                         'type' => 'ss',
                         'server' => $node_raw->server,
                         'port' => (int) $ss_2022_port,
-                        'password' => $user_pk,
+                        'password' => $server_key === '' ? $user_pk : $server_key . ':' .$user_pk,
                         'cipher' => $method,
                         'udp' => (bool) $udp,
                     ];

+ 3 - 1
src/Services/Subscribe/V2RayJson.php

@@ -46,13 +46,15 @@ final class V2RayJson extends Base
                         break;
                     }
 
+                    $server_key = $node_custom_config['server_key'] ?? '';
+
                     $node = [
                         'protocol' => 'shadowsocks2022',
                         'settings' => [
                             'address' => $node_raw->server,
                             'port' => (int) $ss_2022_port,
                             'method' => $user->method,
-                            'psk' => $user_pk,
+                            'psk' => $server_key === '' ? $user_pk : $server_key . ':' .$user_pk,
                         ],
                         'tag' => $node_raw->name,
                     ];