Explorar o código

1.修正混淆参数问题
2.修正节点自定义分组问题

bingo %!s(int64=8) %!d(string=hai) anos
pai
achega
d5b0659a57

+ 6 - 3
app/Http/Controllers/AdminController.php

@@ -1114,8 +1114,11 @@ class AdminController extends Controller
 
         $nodeList = SsNode::query()->where('status', 1)->paginate(10)->appends($request->except('page'));
         foreach ($nodeList as &$node) {
+            // 获取分组名称
+            $group = SsGroup::query()->where('id', $node->group_id)->first();
+
             // 生成ssr scheme
-            $obfs_param = $node->single ? '' : $user->obfs_param;
+            $obfs_param = $user->obfs_param ? $user->obfs_param : $node->obfs_param;
             $protocol_param = $node->single ? $user->port . ':' . $user->passwd : $user->protocol_param;
 
             $ssr_str = '';
@@ -1125,7 +1128,7 @@ class AdminController extends Controller
             $ssr_str .= '/?obfsparam=' . ($node->single ? '' : base64url_encode($obfs_param));
             $ssr_str .= '&protoparam=' . ($node->single ? base64url_encode($user->port . ':' . $user->passwd) : base64url_encode($protocol_param));
             $ssr_str .= '&remarks=' . base64url_encode($node->name);
-            $ssr_str .= '&group=' . base64url_encode('VPN');
+            $ssr_str .= '&group=' . base64url_encode(empty($group) ? '' : $group->name);
             $ssr_str .= '&udpport=0';
             $ssr_str .= '&uot=0';
             $ssr_str = base64url_encode($ssr_str);
@@ -1146,7 +1149,7 @@ class AdminController extends Controller
             $txt .= "协议:" . ($node->single ? $node->single_protocol : $user->protocol) . "\r\n";
             $txt .= "协议参数:" . ($node->single ? $user->port . ':' . $user->passwd : $user->protocol_param) . "\r\n";
             $txt .= "混淆方式:" . ($node->single ? $node->single_obfs : $user->obfs) . "\r\n";
-            $txt .= "混淆参数:" . ($node->single ? '' : $user->obfs_param) . "\r\n";
+            $txt .= "混淆参数:" . ($user->obfs_param ? $user->obfs_param : $node->obfs_param) . "\r\n";
             $txt .= "本地端口:1080\r\n路由:绕过局域网及中国大陆地址";
 
             $node->txt = $txt;

+ 6 - 2
app/Http/Controllers/SubscribeController.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Http\Models\SsGroup;
 use App\Http\Models\User;
 use App\Http\Models\UserLabel;
 use App\Http\Models\UserSubscribe;
@@ -77,7 +78,10 @@ class SubscribeController extends Controller
                 break;
             }
 
-            $obfs_param = $node->single ? '' : $user->obfs_param;
+            // 获取分组名称
+            $group = SsGroup::query()->where('id', $node->group_id)->first();
+
+            $obfs_param = $user->obfs_param ? $user->obfs_param : $node->obfs_param;
             $protocol_param = $node->single ? $user->port . ':' . $user->passwd : $user->protocol_param;
 
             // 生成ssr scheme
@@ -88,7 +92,7 @@ class SubscribeController extends Controller
             $ssr_str .= '/?obfsparam=' . ($node->single ? '' : base64url_encode($obfs_param));
             $ssr_str .= '&protoparam=' . ($node->single ? base64url_encode($user->port . ':' . $user->passwd) : base64url_encode($protocol_param));
             $ssr_str .= '&remarks=' . base64url_encode($node->name);
-            $ssr_str .= '&group=' . base64url_encode('VPN');
+            $ssr_str .= '&group=' . base64url_encode(empty($group) ? '' : $group->name);
             $ssr_str .= '&udpport=0';
             $ssr_str .= '&uot=0';
             $ssr_str = base64url_encode($ssr_str);

+ 7 - 3
app/Http/Controllers/UserController.php

@@ -12,6 +12,7 @@ use App\Http\Models\Order;
 use App\Http\Models\ReferralApply;
 use App\Http\Models\ReferralLog;
 use App\Http\Models\SsConfig;
+use App\Http\Models\SsGroup;
 use App\Http\Models\Ticket;
 use App\Http\Models\TicketReply;
 use App\Http\Models\User;
@@ -80,8 +81,11 @@ class UserController extends Controller
             ->get();
 
         foreach ($nodeList as &$node) {
+            // 获取分组名称
+            $group = SsGroup::query()->where('id', $node->group_id)->first();
+
             // 生成ssr scheme
-            $obfs_param = $node->single ? '' : $user->obfs_param;
+            $obfs_param = $user->obfs_param ? $user->obfs_param : $node->obfs_param;
             $protocol_param = $node->single ? $user->port . ':' . $user->passwd : $user->protocol_param;
 
             $ssr_str = '';
@@ -91,7 +95,7 @@ class UserController extends Controller
             $ssr_str .= '/?obfsparam=' . ($node->single ? '' : base64url_encode($obfs_param));
             $ssr_str .= '&protoparam=' . ($node->single ? base64url_encode($user->port . ':' . $user->passwd) : base64url_encode($protocol_param));
             $ssr_str .= '&remarks=' . base64url_encode($node->name);
-            $ssr_str .= '&group=' . base64url_encode('VPN');
+            $ssr_str .= '&group=' . base64url_encode(empty($group) ? '' : $group->name);
             $ssr_str .= '&udpport=0';
             $ssr_str .= '&uot=0';
             $ssr_str = base64url_encode($ssr_str);
@@ -112,7 +116,7 @@ class UserController extends Controller
             $txt .= "协议:" . ($node->single ? $node->single_protocol : $user->protocol) . "\r\n";
             $txt .= "协议参数:" . ($node->single ? $user->port . ':' . $user->passwd : $user->protocol_param) . "\r\n";
             $txt .= "混淆方式:" . ($node->single ? $node->single_obfs : $user->obfs) . "\r\n";
-            $txt .= "混淆参数:" . ($node->single ? '' : $user->obfs_param) . "\r\n";
+            $txt .= "混淆参数:" . ($user->obfs_param ? $user->obfs_param : $node->obfs_param) . "\r\n";
             $txt .= "本地端口:1080\r\n路由:绕过局域网及中国大陆地址";
 
             $node->txt = $txt;

+ 2 - 2
resources/views/admin/addUser.blade.php

@@ -247,13 +247,13 @@
                                             <div class="form-group">
                                                 <label for="protocol_param" class="col-md-3 control-label">协议参数</label>
                                                 <div class="col-md-8">
-                                                    <input type="text" class="form-control" name="protocol_param" id="protocol_param" placeholder="节点单端口时,请务必留空">
+                                                    <input type="text" class="form-control" name="protocol_param" id="protocol_param" placeholder="节点单端口时无效">
                                                 </div>
                                             </div>
                                             <div class="form-group">
                                                 <label for="obfs_param" class="col-md-3 control-label">混淆参数</label>
                                                 <div class="col-md-8">
-                                                    <textarea class="form-control" rows="3" name="obfs_param" id="obfs_param" placeholder="节点单端口时,请务必留空"></textarea>
+                                                    <textarea class="form-control" rows="3" name="obfs_param" id="obfs_param" placeholder="不填则取节点自定义混淆参数"></textarea>
                                                 </div>
                                             </div>
                                             <hr>

+ 2 - 2
resources/views/admin/editUser.blade.php

@@ -283,13 +283,13 @@
                                             <div class="form-group">
                                                 <label for="protocol_param" class="col-md-3 control-label">协议参数</label>
                                                 <div class="col-md-8">
-                                                    <input type="text" class="form-control" name="protocol_param" value="{{$user->protocol_param}}" id="protocol_param" placeholder="节点单端口时,请务必留空">
+                                                    <input type="text" class="form-control" name="protocol_param" value="{{$user->protocol_param}}" id="protocol_param" placeholder="节点单端口时无效">
                                                 </div>
                                             </div>
                                             <div class="form-group">
                                                 <label for="obfs_param" class="col-md-3 control-label">混淆参数</label>
                                                 <div class="col-md-8">
-                                                    <textarea class="form-control" rows="5" name="obfs_param" id="obfs_param" placeholder="节点单端口时,请务必留空">{{$user->obfs_param}}</textarea>
+                                                    <textarea class="form-control" rows="5" name="obfs_param" id="obfs_param" placeholder="不填则取节点自定义混淆参数">{{$user->obfs_param}}</textarea>
                                                 </div>
                                             </div>
                                             <hr>

+ 2 - 6
resources/views/admin/groupList.blade.php

@@ -30,23 +30,19 @@
                                 <tr>
                                     <th> # </th>
                                     <th> 分组名称 </th>
-                                    <th> 可见级别 </th>
                                     <th> 操作 </th>
                                 </tr>
                                 </thead>
                                 <tbody>
                                     @if($groupList->isEmpty())
                                         <tr>
-                                            <td colspan="4" style="text-align: center;">暂无数据</td>
+                                            <td colspan="3" style="text-align: center;">暂无数据</td>
                                         </tr>
                                     @else
                                         @foreach($groupList as $group)
                                             <tr class="odd gradeX">
                                                 <td> {{$group->id}} </td>
                                                 <td> {{$group->name}} </td>
-                                                <td>
-                                                    <span class="label label-warning">{{empty($level_dict) ? '' : $level_dict[$group->level]}}</span>
-                                                </td>
                                                 <td>
                                                     <button type="button" class="btn btn-sm blue btn-outline" onclick="editGroup('{{$group->id}}')">
                                                         <i class="fa fa-pencil"></i>
@@ -63,7 +59,7 @@
                         </div>
                         <div class="row">
                             <div class="col-md-4 col-sm-4">
-                                <div class="dataTables_info" role="status" aria-live="polite">共 {{$groupList->total()}} 个节点</div>
+                                <div class="dataTables_info" role="status" aria-live="polite">共 {{$groupList->total()}} 个节点分组</div>
                             </div>
                             <div class="col-md-8 col-sm-8">
                                 <div class="dataTables_paginate paging_bootstrap_full_number pull-right">