Browse Source

Fixed #234 & 通用配置用户权限未被正确判断的BUG

兔姬桑 3 năm trước cách đây
mục cha
commit
c0cd2d48e6

+ 1 - 1
app/Http/Controllers/AdminController.php

@@ -116,7 +116,7 @@ class AdminController extends Controller
 
     public function config()
     {
-        return view('admin.config.config', [
+        return view('admin.config.common', [
             'methods' => SsConfig::type(1)->get(),
             'protocols' => SsConfig::type(2)->get(),
             'categories' => GoodsCategory::all(),

+ 1 - 1
app/Http/Requests/Admin/NodeRequest.php

@@ -37,7 +37,7 @@ class NodeRequest extends FormRequest
             'single'         => 'required|boolean',
             'port'           => 'required_unless:single,0|numeric|between:1,65535|different:push_port',
             'passwd'         => 'exclude_unless:type,1,type,4|required_if:single,1|string|nullable',
-            'v2_alter_id'    => 'required_if:type,2|numeric|between:0,65535',
+            'v2_alter_id'    => 'nullable|numeric|between:0,65535',
             'v2_method'      => 'required_if:type,2',
             'v2_net'         => 'required_if:type,2',
             'v2_type'        => 'required_if:type,2',

+ 0 - 54
config/bobclient.php

@@ -1,54 +0,0 @@
-<?php
-/*
- * ┌─────────────────────────────────────────┐
- * │ BobVPN                                  │
- * ├─────────────────────────────────────────┤
- * │ Copyright © 2021 (https://t.me/Bobs9)   │
- * └─────────────────────────────────────────┘
- */
-
-return [
-    // 登录页面配置
-    'login'        => [
-        'telegram_url'   => '',  // 留空的话则不展示telegram群
-        'qq_url'         => '',  // 留空的话则不展示QQ群
-        'background_img' => 'https://demo.proxypanel.cf/assets/images/logo64.png', // 背景图片地址,图片宽高不超过 860px * 544px 就行 (留空为默认的背景图)
-        'text'           => '一键开启<br>极速上网体验',
-        'text_color'     => 'rgba(255, 255, 255, 0.8);',    // 文字和按钮颜色   默认颜色 rgba(255, 255, 255, 0.8);
-        'button_color'   => '#8077f1',    // 文字和按钮颜色 默认颜色:#8077f1(v2版本配置)
-    ],
-
-    // PC端消息中心图片和跳转链接
-    'message'      => [
-        'background_img' => 'https://malus.s3cdn.net/uploads/malus_user-guide.jpg', // 背景图片地址
-        'url'            => 'https://www.goole.com',    // 跳转链接
-    ],
-
-    // Crisp在线客服
-    'crisp_enable' => false,  // 是否开启
-    'crisp_id'     => '',       // Crisp 的网站ID
-
-    // 弹窗公告
-    'notice'       => [
-        'is_start' => true, // 是否开启弹窗公告
-        'title'    => '最新公告', // 标题
-        'content'  => '<strong>这是最新 <i>公告</i> 内容</strong>', // 公告内容,可以为html格式,也可以纯文本
-    ],
-
-    // PC端菜单栏显示控制
-    'menu'         => [
-        'shop' => true,          // 会员
-        'user' => true,          // 我的
-        'gift' => true,          // 邀请
-    ],
-
-    // 检查用户计算机时间
-    'check_time'   => [
-        'is_check'     => true,  // 是否开启检查
-        'differ_time'  => 90,    // 相差多少秒提示
-        'warning_text' => '请校准系统时间为北京时间,否则会导致无法上网!', // 提示内容
-    ],
-
-    // 个人中心头像
-    'user_avatar'  => 'https://demo.proxypanel.cf/assets/images/avatar.svg',
-];

+ 464 - 479
resources/views/admin/config/config.blade.php → resources/views/admin/config/common.blade.php

@@ -433,522 +433,507 @@
     <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js"></script>
     <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
     <script>
-        @can('admin.config.level.store')
-        // 添加等级
-        function addLevel() {
-            const level = $('#add_level').val();
-            const level_name = $('#add_level_name').val();
-
-            if (level.trim() === '') {
-                $('#level_msg').show().html('等级不能为空');
-                $('#level').focus();
-                return false;
-            }
-
-            if (level_name.trim() === '') {
-                $('#level_msg').show().html('等级名称不能为空');
-                $('#level_name').focus();
-                return false;
-            }
-
-            $.ajax({
-                url: '{{route('admin.config.level.store')}}',
-                method: 'POST',
-                data: {_token: '{{csrf_token()}}', level: level, name: level_name},
-                beforeSend: function() {
-                    $('#level_msg').show().html('正在添加');
-                },
-                success: function(ret) {
-                    if (ret.status === 'fail') {
-                        $('#level_msg').show().html(ret.message);
-                        return false;
-                    }
-                    $('#add_level_modal').modal('hide');
-                    window.location.reload();
-                },
-                error: function() {
-                    $('#level_msg').show().html('请求错误,请重试');
-                },
-                complete: function() {
-                    swal.fire({title: '添加成功', icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                },
-            });
-        }
-
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.level.update')
-        // 更新等级
-        function updateLevel(id) {
-            $.ajax({
-                method: 'PUT',
-                url: '{{route('admin.config.level.update', '')}}/' + id,
-                data: {
-                    _token: '{{csrf_token()}}',
-                    level: $('#level_' + id).val(),
-                    name: $('#level_name_' + id).val(),
-                },
-                dataType: 'json',
-                success: function(ret) {
-                    if (ret.status === 'success') {
-                        swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                    } else {
-                        swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
-                    }
-                },
-            });
+      function addLevel() { // 添加等级
+          @can('admin.config.level.store')
+        const level = $('#add_level').val();
+        const level_name = $('#add_level_name').val();
+
+        if (level.trim() === '') {
+          $('#level_msg').show().html('等级不能为空');
+          $('#level').focus();
+          return false;
         }
 
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.level.destroy')
-        // 删除等级
-        function delLevel(id, name) {
-            swal.fire({
-                title: '确定删除等级 【' + name + '】 ?',
-                icon: 'question',
-                allowEnterKey: false,
-                showCancelButton: true,
-                cancelButtonText: '{{trans('common.close')}}',
-                confirmButtonText: '{{trans('common.confirm')}}',
-            }).then((result) => {
-                if (result.value) {
-                    $.ajax({
-                        method: 'DELETE',
-                        url: '{{route('admin.config.level.destroy', '')}}/' + id,
-                        data: {_token: '{{csrf_token()}}'},
-                        dataType: 'json',
-                        success: function(ret) {
-                            if (ret.status === 'success') {
-                                swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                            } else {
-                                swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
-                            }
-                        },
-                    });
-                }
-            });
+        if (level_name.trim() === '') {
+          $('#level_msg').show().html('等级名称不能为空');
+          $('#level_name').focus();
+          return false;
         }
 
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.category.store')
-        // 添加分类
-        function addCategory() {
-            const name = $('#add_category_name').val();
-            const sort = $('#add_category_sort').val();
-
-            if (name.trim() === '') {
-                $('#category_msg').show().html('分类名称不能为空');
-                $('#category_name').focus();
-                return false;
+        $.ajax({
+          url: '{{route('admin.config.level.store')}}',
+          method: 'POST',
+          data: {_token: '{{csrf_token()}}', level: level, name: level_name},
+          beforeSend: function() {
+            $('#level_msg').show().html('正在添加');
+          },
+          success: function(ret) {
+            if (ret.status === 'fail') {
+              $('#level_msg').show().html(ret.message);
+              return false;
             }
-
-            if (sort.trim() === '') {
-                $('#category_msg').show().html('分类排序不能为空');
-                $('#category_sort').focus();
-                return false;
-            }
-
-            $.ajax({
-                url: '{{route('admin.config.category.store')}}',
-                method: 'POST',
-                data: {_token: '{{csrf_token()}}', name: name, sort: sort},
-                beforeSend: function() {
-                    $('#category_msg').show().html('正在添加');
-                },
-                success: function(ret) {
-                    if (ret.status === 'fail') {
-                        $('#category_msg').show().html(ret.message);
-                        return false;
-                    }
-                    $('#add_category_modal').modal('hide');
-                    window.location.reload();
-                },
-                error: function() {
-                    $('#category_msg').show().html('请求错误,请重试');
-                },
-                complete: function() {
-                    swal.fire({title: '添加成功', icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                },
-            });
-        }
-
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.category.update')
-        // 更新分类
-        function updateCategory(id) {
-            $.ajax({
-                method: 'PUT',
-                url: '{{route('admin.config.category.update', '')}}/' + id,
-                data: {
-                    _token: '{{csrf_token()}}',
-                    name: $('#category_name_' + id).val(),
-                    sort: $('#category_sort_' + id).val(),
-                },
+            $('#add_level_modal').modal('hide');
+            window.location.reload();
+          },
+          error: function() {
+            $('#level_msg').show().html('请求错误,请重试');
+          },
+          complete: function() {
+            swal.fire({title: '添加成功', icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+          },
+        });
+          @endcan
+          @cannot('admin.config.level.store')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function updateLevel(id) { // 更新等级
+          @can('admin.config.level.update')
+          $.ajax({
+            method: 'PUT',
+            url: '{{route('admin.config.level.update', '')}}/' + id,
+            data: {
+              _token: '{{csrf_token()}}',
+              level: $('#level_' + id).val(),
+              name: $('#level_name_' + id).val(),
+            },
+            dataType: 'json',
+            success: function(ret) {
+              if (ret.status === 'success') {
+                swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+              } else {
+                swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
+              }
+            },
+          });
+          @endcan
+          @cannot('admin.config.level.update')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function delLevel(id, name) { // 删除等级
+          @can('admin.config.level.destroy')
+          swal.fire({
+            title: '确定删除等级 【' + name + '】 ?',
+            icon: 'question',
+            allowEnterKey: false,
+            showCancelButton: true,
+            cancelButtonText: '{{trans('common.close')}}',
+            confirmButtonText: '{{trans('common.confirm')}}',
+          }).then((result) => {
+            if (result.value) {
+              $.ajax({
+                method: 'DELETE',
+                url: '{{route('admin.config.level.destroy', '')}}/' + id,
+                data: {_token: '{{csrf_token()}}'},
                 dataType: 'json',
                 success: function(ret) {
-                    if (ret.status === 'success') {
-                        swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                    } else {
-                        swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
-                    }
+                  if (ret.status === 'success') {
+                    swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+                  } else {
+                    swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
+                  }
                 },
-            });
+              });
+            }
+          });
+          @endcan
+          @cannot('admin.config.level.destroy')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function addCategory() { // 添加分类
+          @can('admin.config.category.store')
+        const name = $('#add_category_name').val();
+        const sort = $('#add_category_sort').val();
+
+        if (name.trim() === '') {
+          $('#category_msg').show().html('分类名称不能为空');
+          $('#category_name').focus();
+          return false;
         }
 
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.category.destroy')
-        // 删除分类
-        function delCategory(id, name) {
-            swal.fire({
-                title: '确定删除分类 【' + name + '】 ?',
-                icon: 'question',
-                allowEnterKey: false,
-                showCancelButton: true,
-                cancelButtonText: '{{trans('common.close')}}',
-                confirmButtonText: '{{trans('common.confirm')}}',
-            }).then((result) => {
-                if (result.value) {
-                    $.ajax({
-                        method: 'DELETE',
-                        url: '{{route('admin.config.category.destroy', '')}}/' + id,
-                        data: {_token: '{{csrf_token()}}'},
-                        dataType: 'json',
-                        success: function(ret) {
-                            if (ret.status === 'success') {
-                                swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                            } else {
-                                swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
-                            }
-                        },
-                    });
-                }
-            });
+        if (sort.trim() === '') {
+          $('#category_msg').show().html('分类排序不能为空');
+          $('#category_sort').focus();
+          return false;
         }
 
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.country.store')
-        // 添加国家/地区
-        function addCountry() {
-            const country_name = $('#add_country_name').val();
-            const country_code = $('#add_country_code').val();
-
-            if (country_code.trim() === '') {
-                $('#country_msg').show().html('国家/地区代码不能为空');
-                $('#add_country_code').focus();
-                return false;
-            }
-
-            if (country_name.trim() === '') {
-                $('#country_msg').show().html('国家/地区名称不能为空');
-                $('#add_country_name').focus();
-                return false;
+        $.ajax({
+          url: '{{route('admin.config.category.store')}}',
+          method: 'POST',
+          data: {_token: '{{csrf_token()}}', name: name, sort: sort},
+          beforeSend: function() {
+            $('#category_msg').show().html('正在添加');
+          },
+          success: function(ret) {
+            if (ret.status === 'fail') {
+              $('#category_msg').show().html(ret.message);
+              return false;
             }
-
-            $.ajax({
-                url: '{{route('admin.config.country.store')}}',
-                method: 'POST',
-                data: {_token: '{{csrf_token()}}', code: country_code, name: country_name},
-                beforeSend: function() {
-                    $('#country_msg').show().html('正在添加');
-                },
-                success: function(ret) {
-                    if (ret.status === 'fail') {
-                        $('#country_msg').show().html(ret.message);
-                        return false;
-                    }
-                    $('#add_country_modal').modal('hide');
-                    window.location.reload();
-                },
-                error: function() {
-                    $('#country_msg').show().html('请求错误,请重试');
-                },
-                complete: function() {
-                    swal.fire({
-                        title: '添加成功',
-                        icon: 'success',
-                        timer: 1000,
-                        showConfirmButton: false,
-                    }).then(() => window.location.reload());
-                },
-            });
-        }
-
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.country.update')
-        // 更新国家/地区
-        function updateCountry(code) {
-            $.ajax({
-                method: 'PUT',
-                url: '{{route('admin.config.country.update', '')}}/' + code,
-                data: {_token: '{{csrf_token()}}', name: $('#country_' + code).val()},
+            $('#add_category_modal').modal('hide');
+            window.location.reload();
+          },
+          error: function() {
+            $('#category_msg').show().html('请求错误,请重试');
+          },
+          complete: function() {
+            swal.fire({title: '添加成功', icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+          },
+        });
+          @endcan
+          @cannot('admin.config.category.store')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function updateCategory(id) { // 更新分类
+          @can('admin.config.category.update')
+          $.ajax({
+            method: 'PUT',
+            url: '{{route('admin.config.category.update', '')}}/' + id,
+            data: {
+              _token: '{{csrf_token()}}',
+              name: $('#category_name_' + id).val(),
+              sort: $('#category_sort_' + id).val(),
+            },
+            dataType: 'json',
+            success: function(ret) {
+              if (ret.status === 'success') {
+                swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+              } else {
+                swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
+              }
+            },
+          });
+          @endcan
+          @cannot('admin.config.category.update')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function delCategory(id, name) { // 删除分类
+          @can('admin.config.category.destroy')
+          swal.fire({
+            title: '确定删除分类 【' + name + '】 ?',
+            icon: 'question',
+            allowEnterKey: false,
+            showCancelButton: true,
+            cancelButtonText: '{{trans('common.close')}}',
+            confirmButtonText: '{{trans('common.confirm')}}',
+          }).then((result) => {
+            if (result.value) {
+              $.ajax({
+                method: 'DELETE',
+                url: '{{route('admin.config.category.destroy', '')}}/' + id,
+                data: {_token: '{{csrf_token()}}'},
                 dataType: 'json',
                 success: function(ret) {
-                    if (ret.status === 'success') {
-                        swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                    } else {
-                        swal.fire({title: ret.message, icon: 'error'});
-                    }
+                  if (ret.status === 'success') {
+                    swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+                  } else {
+                    swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
+                  }
                 },
-            });
+              });
+            }
+          });
+          @endcan
+          @cannot('admin.config.category.destroy')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function addCountry() { // 添加国家/地区
+          @can('admin.config.country.store')
+        const country_name = $('#add_country_name').val();
+        const country_code = $('#add_country_code').val();
+
+        if (country_code.trim() === '') {
+          $('#country_msg').show().html('国家/地区代码不能为空');
+          $('#add_country_code').focus();
+          return false;
         }
 
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.country.destroy')
-        // 删除国家/地区
-        function delCountry(code, name) {
-            swal.fire({
-                title: '确定删除 【' + name + '】 信息?',
-                icon: 'question',
-                allowEnterKey: false,
-                showCancelButton: true,
-                cancelButtonText: '{{trans('common.close')}}',
-                confirmButtonText: '{{trans('common.confirm')}}',
-            }).then((result) => {
-                if (result.value) {
-                    $.ajax({
-                        method: 'DELETE',
-                        url: '{{route('admin.config.country.destroy', '')}}/' + code,
-                        data: {_token: '{{csrf_token()}}'},
-                        dataType: 'json',
-                        success: function(ret) {
-                            if (ret.status === 'success') {
-                                swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                            } else {
-                                swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
-                            }
-                        },
-                    });
-                }
-            });
+        if (country_name.trim() === '') {
+          $('#country_msg').show().html('国家/地区名称不能为空');
+          $('#add_country_name').focus();
+          return false;
         }
 
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.ss.store')
-        // 添加配置
-        function addConfig() {
-            const name = $('#name').val();
-            const type = $('#type').val();
-
-            if (name.trim() === '') {
-                $('#msg').show().html('名称不能为空');
-                $('#name').focus();
-                return false;
+        $.ajax({
+          url: '{{route('admin.config.country.store')}}',
+          method: 'POST',
+          data: {_token: '{{csrf_token()}}', code: country_code, name: country_name},
+          beforeSend: function() {
+            $('#country_msg').show().html('正在添加');
+          },
+          success: function(ret) {
+            if (ret.status === 'fail') {
+              $('#country_msg').show().html(ret.message);
+              return false;
             }
-
-            $.ajax({
-                url: '{{route('admin.config.ss.store')}}',
-                method: 'POST',
-                data: {_token: '{{csrf_token()}}', name: name, type: type},
+            $('#add_country_modal').modal('hide');
+            window.location.reload();
+          },
+          error: function() {
+            $('#country_msg').show().html('请求错误,请重试');
+          },
+          complete: function() {
+            swal.fire({
+              title: '添加成功',
+              icon: 'success',
+              timer: 1000,
+              showConfirmButton: false,
+            }).then(() => window.location.reload());
+          },
+        });
+          @endcan
+          @cannot('admin.config.country.store')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function updateCountry(code) { // 更新国家/地区
+          @can('admin.config.country.update')
+          $.ajax({
+            method: 'PUT',
+            url: '{{route('admin.config.country.update', '')}}/' + code,
+            data: {_token: '{{csrf_token()}}', name: $('#country_' + code).val()},
+            dataType: 'json',
+            success: function(ret) {
+              if (ret.status === 'success') {
+                swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+              } else {
+                swal.fire({title: ret.message, icon: 'error'});
+              }
+            },
+          });
+          @endcan
+          @cannot('admin.config.country.update')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function delCountry(code, name) { // 删除国家/地区
+          @can('admin.config.country.destroy')
+          swal.fire({
+            title: '确定删除 【' + name + '】 信息?',
+            icon: 'question',
+            allowEnterKey: false,
+            showCancelButton: true,
+            cancelButtonText: '{{trans('common.close')}}',
+            confirmButtonText: '{{trans('common.confirm')}}',
+          }).then((result) => {
+            if (result.value) {
+              $.ajax({
+                method: 'DELETE',
+                url: '{{route('admin.config.country.destroy', '')}}/' + code,
+                data: {_token: '{{csrf_token()}}'},
                 dataType: 'json',
-                beforeSend: function() {
-                    $('#msg').show().html('正在添加');
-                },
                 success: function(ret) {
-                    if (ret.status === 'fail') {
-                        $('#msg').show().html(ret.message);
-                        return false;
-                    }
-
-                    $('#add_config_modal').modal('hide');
+                  if (ret.status === 'success') {
+                    swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+                  } else {
+                    swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
+                  }
                 },
-                error: function() {
-                    $('#msg').show().html('请求错误,请重试');
-                },
-                complete: function() {
-                    swal.fire({title: '添加成功', icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                },
-            });
+              });
+            }
+          });
+          @endcan
+          @cannot('admin.config.country.destroy')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function addConfig() { // 添加配置
+          @can('admin.config.ss.store')
+        const name = $('#name').val();
+        const type = $('#type').val();
+
+        if (name.trim() === '') {
+          $('#msg').show().html('名称不能为空');
+          $('#name').focus();
+          return false;
         }
 
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
+        $.ajax({
+          url: '{{route('admin.config.ss.store')}}',
+          method: 'POST',
+          data: {_token: '{{csrf_token()}}', name: name, type: type},
+          dataType: 'json',
+          beforeSend: function() {
+            $('#msg').show().html('正在添加');
+          },
+          success: function(ret) {
+            if (ret.status === 'fail') {
+              $('#msg').show().html(ret.message);
+              return false;
+            }
 
-        @can('admin.config.ss.update')
-        // 置为默认
-        function setDefault(id) {
-            $.ajax({
-                method: 'PUT',
-                url: '{{route('admin.config.ss.update', '')}}/' + id,
+            $('#add_config_modal').modal('hide');
+          },
+          error: function() {
+            $('#msg').show().html('请求错误,请重试');
+          },
+          complete: function() {
+            swal.fire({title: '添加成功', icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+          },
+        });
+          @endcan
+          @cannot('admin.config.ss.store')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function setDefault(id) { // 置为默认
+          @can('admin.config.ss.update')
+          $.ajax({
+            method: 'PUT',
+            url: '{{route('admin.config.ss.update', '')}}/' + id,
+            data: {_token: '{{csrf_token()}}'},
+            dataType: 'json',
+            success: function(ret) {
+              if (ret.status === 'success') {
+                swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+              } else {
+                swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
+              }
+            },
+          });
+          @endcan
+          @cannot('admin.config.ss.update')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function delConfig(id, name) { // 删除配置
+          @can('admin.config.ss.destroy')
+          swal.fire({
+            title: '确定删除配置 【' + name + '】 ?',
+            icon: 'question',
+            allowEnterKey: false,
+            showCancelButton: true,
+            cancelButtonText: '{{trans('common.close')}}',
+            confirmButtonText: '{{trans('common.confirm')}}',
+          }).then((result) => {
+            if (result.value) {
+              $.ajax({
+                method: 'DELETE',
+                url: '{{route('admin.config.ss.destroy', '')}}/' + id,
                 data: {_token: '{{csrf_token()}}'},
                 dataType: 'json',
                 success: function(ret) {
-                    if (ret.status === 'success') {
-                        swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                    } else {
-                        swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
-                    }
+                  if (ret.status === 'success') {
+                    swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+                  } else {
+                    swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
+                  }
                 },
-            });
-        }
-
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.ss.destroy')
-        // 删除配置
-        function delConfig(id, name) {
-            swal.fire({
-                title: '确定删除配置 【' + name + '】 ?',
-                icon: 'question',
-                allowEnterKey: false,
-                showCancelButton: true,
-                cancelButtonText: '{{trans('common.close')}}',
-                confirmButtonText: '{{trans('common.confirm')}}',
-            }).then((result) => {
-                if (result.value) {
-                    $.ajax({
-                        method: 'DELETE',
-                        url: '{{route('admin.config.ss.destroy', '')}}/' + id,
-                        data: {_token: '{{csrf_token()}}'},
-                        dataType: 'json',
-                        success: function(ret) {
-                            if (ret.status === 'success') {
-                                swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                            } else {
-                                swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
-                            }
-                        },
-                    });
-                }
-            });
-        }
-
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.label.store')
-        // 添加标签
-        function addLabel() {
-            const name = $('#add_label').val();
-            const sort = $('#add_label_sort').val();
-
-            if (name.trim() === '') {
-                $('#lable_msg').show().html('标签不能为空');
-                return false;
-            }
-
-            if (sort.trim() === '') {
-                $('#lable_msg').show().html('标签排序不能为空');
-                return false;
+              });
             }
-
-            $.ajax({
-                url: '{{route('admin.config.label.store')}}',
-                method: 'POST',
-                data: {_token: '{{csrf_token()}}', name: name, sort: sort},
-                beforeSend: function() {
-                    $('#level_msg').show().html('正在添加');
-                },
-                success: function(ret) {
-                    if (ret.status === 'fail') {
-                        $('#lable_msg').show().html(ret.message);
-                        return false;
-                    }
-                    $('#add_label_modal').modal('hide');
-                    window.location.reload();
-                },
-                error: function() {
-                    $('#lable_msg').show().html('请求错误,请重试');
-                },
-                complete: function() {
-                    swal.fire({
-                        title: '添加成功',
-                        icon: 'success',
-                        timer: 1000,
-                        showConfirmButton: false,
-                    }).then(() => window.location.reload());
-                },
-            });
+          });
+          @endcan
+          @cannot('admin.config.ss.destroy')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function addLabel() { // 添加标签
+          @can('admin.config.label.store')
+        const name = $('#add_label').val();
+        const sort = $('#add_label_sort').val();
+
+        if (name.trim() === '') {
+          $('#lable_msg').show().html('标签不能为空');
+          return false;
         }
 
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.label.update')
-        // 编辑标签
-        function updateLabel(id) {
-            $.ajax({
-                method: 'PUT',
-                url: '{{route('admin.config.label.update', '')}}/' + id,
-                data: {
-                    _token: '{{csrf_token()}}',
-                    name: $('#label_name_' + id).val(),
-                    sort: $('#label_sort_' + id).val(),
-                },
-                dataType: 'json',
-                success: function(ret) {
-                    if (ret.status === 'success') {
-                        swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                    } else {
-                        swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
-                    }
-                },
-            });
+        if (sort.trim() === '') {
+          $('#lable_msg').show().html('标签排序不能为空');
+          return false;
         }
 
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
-
-        @can('admin.config.label.destroy')
-        // 删除标签
-        function delLabel(id, name) {
+        $.ajax({
+          url: '{{route('admin.config.label.store')}}',
+          method: 'POST',
+          data: {_token: '{{csrf_token()}}', name: name, sort: sort},
+          beforeSend: function() {
+            $('#level_msg').show().html('正在添加');
+          },
+          success: function(ret) {
+            if (ret.status === 'fail') {
+              $('#lable_msg').show().html(ret.message);
+              return false;
+            }
+            $('#add_label_modal').modal('hide');
+            window.location.reload();
+          },
+          error: function() {
+            $('#lable_msg').show().html('请求错误,请重试');
+          },
+          complete: function() {
             swal.fire({
-                title: '{{trans('common.warning')}}',
-                text: '确定删除标签 【' + name + '】 ?',
-                icon: 'warning',
-                showCancelButton: true,
-                cancelButtonText: '{{trans('common.close')}}',
-                confirmButtonText: '{{trans('common.confirm')}}',
-            }).then((result) => {
-                $.ajax({
-                    method: 'DELETE',
-                    url: '{{route('admin.config.label.destroy', '')}}/' + id,
-                    data: {_token: '{{csrf_token()}}'},
-                    dataType: 'json',
-                    success: function(ret) {
-                        if (ret.status === 'success') {
-                            swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
-                        } else {
-                            swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
-                        }
-                    },
-                });
+              title: '添加成功',
+              icon: 'success',
+              timer: 1000,
+              showConfirmButton: false,
+            }).then(() => window.location.reload());
+          },
+        });
+          @endcan
+          @cannot('admin.config.label.store')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function updateLabel(id) { // 编辑标签
+          @can('admin.config.label.update')
+          $.ajax({
+            method: 'PUT',
+            url: '{{route('admin.config.label.update', '')}}/' + id,
+            data: {
+              _token: '{{csrf_token()}}',
+              name: $('#label_name_' + id).val(),
+              sort: $('#label_sort_' + id).val(),
+            },
+            dataType: 'json',
+            success: function(ret) {
+              if (ret.status === 'success') {
+                swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+              } else {
+                swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
+              }
+            },
+          });
+          @endcan
+          @cannot('admin.config.label.update')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
+
+      function delLabel(id, name) { // 删除标签
+          @can('admin.config.label.destroy')
+          swal.fire({
+            title: '{{trans('common.warning')}}',
+            text: '确定删除标签 【' + name + '】 ?',
+            icon: 'warning',
+            showCancelButton: true,
+            cancelButtonText: '{{trans('common.close')}}',
+            confirmButtonText: '{{trans('common.confirm')}}',
+          }).then((result) => {
+            $.ajax({
+              method: 'DELETE',
+              url: '{{route('admin.config.label.destroy', '')}}/' + id,
+              data: {_token: '{{csrf_token()}}'},
+              dataType: 'json',
+              success: function(ret) {
+                if (ret.status === 'success') {
+                  swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
+                } else {
+                  swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
+                }
+              },
             });
-        }
-
-        @else
-        swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
-        @endcan
+          });
+          @endcan
+          @cannot('admin.config.label.destroy')
+          swal.fire({title: '您没有权限修改参数!', icon: 'error', timer: 1500, showConfirmButton: false});
+          @endcannot
+      }
     </script>
 @endsection

+ 3 - 3
resources/views/admin/layouts.blade.php

@@ -461,7 +461,7 @@
                         </ul>
                     </li>
                 @endcanany
-                @canany(['admin.config.filter.index', 'admin.config', 'admin.system.index'])
+                @canany(['admin.config.filter.index', 'admin.config.index', 'admin.system.index'])
                     <li class="site-menu-item has-sub {{request()->routeIs('admin.config.*', 'admin.system.index') ? 'active open' : ''}}">
                         <a href="javascript:void(0)">
                             <i class="site-menu-icon wb-settings" aria-hidden="true"></i>
@@ -475,9 +475,9 @@
                                     </a>
                                 </li>
                             @endcan
-                            @can('admin.config')
+                            @can('admin.config.index')
                                 <li class="site-menu-item {{request()->routeIs('admin.config.common.*') ? 'active open' : ''}}">
-                                    <a href="{{route('admin.config')}}">
+                                    <a href="{{route('admin.config.index')}}">
                                         <span class="site-menu-title">通用配置</span>
                                     </a>
                                 </li>

+ 5 - 4
resources/views/admin/node/info.blade.php

@@ -328,7 +328,7 @@
                                         <div class="v2ray-setting">
                                             <div class="form-group row">
                                                 <label for="v2_alter_id" class="col-md-3 col-form-label">额外ID</label>
-                                                <input type="text" class="form-control col-md-4" name="v2_alter_id" value="16" id="v2_alter_id" required/>
+                                                <input type="text" class="form-control col-md-4" name="v2_alter_id" value="16" id="v2_alter_id"/>
                                             </div>
                                             <div class="form-group row">
                                                 <label for="v2_port" class="col-md-3 col-form-label">服务端口</label>
@@ -337,8 +337,9 @@
                                             <div class="form-group row">
                                                 <label for="v2_method" class="col-md-3 col-form-label">加密方式</label>
                                                 <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control" id="v2_method">
-                                                    <option value="auto">auto</option>
                                                     <option value="none">none</option>
+                                                    <option value="auto">auto</option>
+                                                    <option value="aes-128-cfb">aes-128-cfb</option>
                                                     <option value="aes-128-gcm">aes-128-gcm</option>
                                                     <option value="chacha20-poly1305">chacha20-poly1305</option>
                                                 </select>
@@ -348,9 +349,9 @@
                                                 <label for="v2_net" class="col-md-3 col-form-label">传输方式</label>
                                                 <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control" id="v2_net">
                                                     <option value="tcp">TCP</option>
-                                                    <option value="kcp">mKCP</option>
-                                                    <option value="ws">WebSocket</option>
                                                     <option value="http">HTTP/2</option>
+                                                    <option value="ws">WebSocket</option>
+                                                    <option value="kcp">mKCP</option>
                                                     <option value="domainsocket">DomainSocket</option>
                                                     <option value="quic">QUIC</option>
                                                 </select>

+ 1 - 1
resources/views/user/services.blade.php

@@ -67,7 +67,7 @@
                                                     <span class="pricing-period">/ {{$goods->days.trans_choice('validation.attributes.day', 1)}}</span>
                                                 @endif
                                             </div>
-                                            @if($goods->info)
+                                            @if($goods->description)
                                                 <p class="px-30 pb-25 text-center">{{$goods->description}}</p>
                                             @endif
                                         </div>

+ 1 - 1
routes/admin.php

@@ -2,7 +2,7 @@
 
 Route::prefix('admin')->name('admin.')->group(function () {
     Route::get('/', 'AdminController@index')->name('index'); // 后台首页
-    Route::get('config', 'AdminController@config')->name('config'); // 系统设
+    Route::get('config', 'AdminController@config')->name('config.index'); // 系统通用配
     Route::get('invite', 'AdminController@inviteList')->name('invite.index'); // 邀请码列表
     Route::post('invite', 'AdminController@makeInvite')->name('invite.create'); // 生成邀请码
     Route::get('Invite/export', 'AdminController@exportInvite')->name('invite.export'); // 导出邀请码