|
@@ -49,10 +49,12 @@
|
|
|
<div class="form-group row">
|
|
|
<label for="ip" class="col-md-3 col-form-label"> IPv4地址 </label>
|
|
|
<input type="text" class="form-control col-md-4" name="ip" id="ip" placeholder="服务器IPv4地址" required>
|
|
|
+ <span class="text-help offset-md-3">多IP使用“, ”分割,例:1.1.1.1, 8.8.8.8</span>
|
|
|
</div>
|
|
|
<div class="form-group row">
|
|
|
<label for="ipv6" class="col-md-3 col-form-label"> IPv6地址 </label>
|
|
|
<input type="text" class="form-control col-md-4" name="ipv6" id="ipv6" placeholder="服务器IPv6地址,填写则用户可见,域名无效">
|
|
|
+ <span class="text-help offset-md-3">多IP使用“, ”分割,例:1.1.1.1, 8.8.8.8</span>
|
|
|
</div>
|
|
|
<div class="form-group row">
|
|
|
<label for="push_port" class="col-md-3 col-form-label"> 消息推送端口 </label>
|
|
@@ -145,10 +147,16 @@
|
|
|
<ul class="col-md-9 list-unstyled list-inline">
|
|
|
<li class="list-inline-item">
|
|
|
<div class="radio-custom radio-primary">
|
|
|
- <input type="radio" id="shadowsocks" name="type" value="1" checked>
|
|
|
- <label for="shadowsocks">Shadowsocks(R)</label>
|
|
|
+ <input type="radio" id="shadowsocks" name="type" value="0">
|
|
|
+ <label for="shadowsocks">Shadowsocks</label>
|
|
|
</div>
|
|
|
</li>
|
|
|
+ <!--<li class="list-inline-item">-->
|
|
|
+ <!-- <div class="radio-custom radio-primary">-->
|
|
|
+ <!-- <input type="radio" id="shadowsocksR" name="type" value="1">-->
|
|
|
+ <!-- <label for="shadowsocksR">ShadowsocksR</label>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!--</li>-->
|
|
|
<li class="list-inline-item">
|
|
|
<div class="radio-custom radio-primary">
|
|
|
<input type="radio" id="v2ray" name="type" value="2">
|
|
@@ -171,7 +179,7 @@
|
|
|
</div>
|
|
|
<hr/>
|
|
|
<!-- SS/SSR 设置部分 -->
|
|
|
- <div class="ssr-setting">
|
|
|
+ <div class="ss-setting">
|
|
|
<div class="form-group row">
|
|
|
<label for="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" name="method" id="method">
|
|
@@ -180,39 +188,44 @@
|
|
|
@endforeach
|
|
|
</select>
|
|
|
</div>
|
|
|
- <div class="form-group row">
|
|
|
- <label for="protocol" class="col-md-3 col-form-label">协议</label>
|
|
|
- <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control" name="protocol" id="protocol">
|
|
|
- @foreach (Helpers::protocolList() as $protocol)
|
|
|
- <option value="{{$protocol->name}}" @if(!isset($node) && $protocol->is_default) selected @endif>{{$protocol->name}}</option>
|
|
|
- @endforeach
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <div class="form-group row">
|
|
|
- <label for="protocol_param" class="col-md-3 col-form-label"> 协议参数 </label>
|
|
|
- <input type="text" class="form-control col-md-4" name="protocol_param" id="protocol_param">
|
|
|
- </div>
|
|
|
- <div class="form-group row">
|
|
|
- <label for="obfs" class="col-md-3 col-form-label">混淆</label>
|
|
|
- <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control" name="obfs" id="obfs">
|
|
|
- @foreach (Helpers::obfsList() as $obfs)
|
|
|
- <option value="{{$obfs->name}}" @if(!isset($node) && $obfs->is_default) selected @endif>{{$obfs->name}}</option>
|
|
|
- @endforeach
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <div class="form-group row obfs_param">
|
|
|
- <label for="obfs_param" class="col-md-3 col-form-label"> 混淆参数 </label>
|
|
|
- <textarea class="form-control col-md-8" rows="5" name="obfs_param" id="obfs_param"
|
|
|
- placeholder="混淆不为 [plain] 时可填入参数进行流量伪装; 混淆为 [http_simple] 时,建议端口为 80; 混淆为 [tls] 时,建议端口为 443;"></textarea>
|
|
|
- </div>
|
|
|
- <div class="form-group row">
|
|
|
- <label for="compatible" class="col-md-3 col-form-label">兼容SS</label>
|
|
|
- <div class="col-md-9">
|
|
|
- <input type="checkbox" id="compatible" name="compatible" data-plugin="switchery">
|
|
|
+ <div class="ssr-setting">
|
|
|
+ <div class="form-group row">
|
|
|
+ <label for="protocol" class="col-md-3 col-form-label">协议</label>
|
|
|
+ <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control" name="protocol" id="protocol">
|
|
|
+ @foreach (Helpers::protocolList() as $protocol)
|
|
|
+ <option value="{{$protocol->name}}" @if(!isset($node) && $protocol->is_default) selected @endif>{{$protocol->name}}</option>
|
|
|
+ @endforeach
|
|
|
+ </select>
|
|
|
</div>
|
|
|
- <div class="text-help offset-md-3">
|
|
|
- 如果兼容请在服务端配置协议和混淆时加上<span class="red-700">_compatible</span>
|
|
|
+ <div class="form-group row">
|
|
|
+ <label for="protocol_param" class="col-md-3 col-form-label"> 协议参数 </label>
|
|
|
+ <input type="text" class="form-control col-md-4" name="protocol_param" id="protocol_param">
|
|
|
+ </div>
|
|
|
+ <div class="form-group row">
|
|
|
+ <label for="obfs" class="col-md-3 col-form-label">混淆</label>
|
|
|
+ <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="col-md-5 form-control" name="obfs" id="obfs">
|
|
|
+ @foreach (Helpers::obfsList() as $obfs)
|
|
|
+ <option value="{{$obfs->name}}" @if(!isset($node) && $obfs->is_default) selected @endif>{{$obfs->name}}</option>
|
|
|
+ @endforeach
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="form-group row obfs_param">
|
|
|
+ <label for="obfs_param" class="col-md-3 col-form-label"> 混淆参数 </label>
|
|
|
+ <textarea class="form-control col-md-8" rows="5" name="obfs_param" id="obfs_param"
|
|
|
+ placeholder="混淆不为 [plain] 时可填入参数进行流量伪装; 混淆为 [http_simple] 时,建议端口为 80; 混淆为 [tls] 时,建议端口为 443;"></textarea>
|
|
|
+ </div>
|
|
|
+ <div class="form-group row">
|
|
|
+ <label for="compatible" class="col-md-3 col-form-label">兼容SS</label>
|
|
|
+ <div class="col-md-9">
|
|
|
+ <input type="checkbox" id="compatible" name="compatible" data-plugin="switchery">
|
|
|
+ </div>
|
|
|
+ <div class="text-help offset-md-3">
|
|
|
+ 如果兼容请在服务端配置协议和混淆时加上<span class="red-700">_compatible</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
</div>
|
|
|
<hr/>
|
|
|
<div class="form-group row">
|
|
@@ -224,32 +237,28 @@
|
|
|
如果启用请配置服务端的<span class="red-700"><a href="javascript:showTnc();">additional_ports</a></span>信息
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="single-setting hidden">
|
|
|
+ <div class="single-setting">
|
|
|
<div class="form-group row">
|
|
|
<label for="single_port" class="col-md-3 col-form-label">[单] 端口</label>
|
|
|
<input type="number" class="form-control col-md-4" name="port" value="443" id="single_port"/>
|
|
|
<span class="text-help offset-md-3"> 推荐80或443,服务端需要配置 <br>
|
|
|
严格模式:用户的端口无法连接,只能通过以下指定的端口进行连接(<a href="javascript:showPortsOnlyConfig();">如何配置</a>)</span>
|
|
|
</div>
|
|
|
- <div class="form-group row">
|
|
|
+ <div class="form-group row ss-setting">
|
|
|
<label for="passwd" class="col-md-3 col-form-label">[单] 密码</label>
|
|
|
<input type="text" class="form-control col-md-4" name="passwd" id="passwd" placeholder="password">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- V2ray 设置部分 -->
|
|
|
- <div class="v2ray-setting hidden">
|
|
|
+ <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/>
|
|
|
</div>
|
|
|
- <div class="form-group row">
|
|
|
- <label for="v2ray_port" class="col-md-3 col-form-label">连接端口</label>
|
|
|
- <input type="number" class="form-control col-md-4" name="port" id="v2ray_port" value="443"/>
|
|
|
- </div>
|
|
|
<div class="form-group row">
|
|
|
<label for="v2_port" class="col-md-3 col-form-label">服务端口</label>
|
|
|
- <input type="number" class="form-control col-md-4" name="v2_port" id="v2_port" value="10053" required/>
|
|
|
+ <input type="number" class="form-control col-md-4" name="port" id="v2_port" value="10053" required/>
|
|
|
</div>
|
|
|
<div class="form-group row">
|
|
|
<label for="v2_method" class="col-md-3 col-form-label">加密方式</label>
|
|
@@ -291,17 +300,6 @@
|
|
|
<label for="v2_host" class="col-md-3 col-form-label">伪装域名</label>
|
|
|
<div class="col-md-4 pl-0">
|
|
|
<input type="text" class="form-control" name="v2_other" id="v2_host">
|
|
|
- <div name="v2_ws">
|
|
|
- <select data-plugin="selectpicker" data-style="btn-outline btn-primary" class="form-control" id="v2_ws">
|
|
|
- <option value="" hidden></option>
|
|
|
- @foreach($certs as $cert)
|
|
|
- <option value="{{$cert->domain}}"
|
|
|
- @if(isset($node) && $node->v2_net === "ws" && $node->v2_host === $cert->domain) selected @endif>
|
|
|
- {{$cert->domain}}
|
|
|
- </option>
|
|
|
- @endforeach
|
|
|
- </select>
|
|
|
- </div>
|
|
|
</div>
|
|
|
<div class="text-help offset-md-3">
|
|
|
伪装类型为http时多个伪装域名逗号隔开,使用WebSocket传输协议时只允许单个
|
|
@@ -311,6 +309,10 @@
|
|
|
<label for="v2_path" class="col-md-3 col-form-label">路径 | 密钥</label>
|
|
|
<input type="text" class="form-control col-md-4" name="v2_path" id="v2_path">
|
|
|
</div>
|
|
|
+ <div class="form-group row">
|
|
|
+ <label for="v2_sni" class="col-md-3 col-form-label">SNI</label>
|
|
|
+ <input type="text" class="form-control col-md-4" name="v2_sni" id="v2_sni">
|
|
|
+ </div>
|
|
|
<div class="form-group row">
|
|
|
<label for="v2_tls" class="col-md-3 col-form-label">连接TLS</label>
|
|
|
<div class="col-md-9">
|
|
@@ -328,7 +330,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- Trojan 设置部分 -->
|
|
|
- <div class="trojan-setting hidden">
|
|
|
+ <div class="trojan-setting">
|
|
|
<div class="form-group row">
|
|
|
<label for="trojan_port" class="col-md-3 col-form-label">连接端口</label>
|
|
|
<input type="number" class="form-control col-md-4" name="port" id="trojan_port" value="443"/>
|
|
@@ -378,7 +380,7 @@
|
|
|
<input type="checkbox" id="is_relay" name="is_relay" data-plugin="switchery" onchange="switchSetting('is_relay')">
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="relay-setting hidden">
|
|
|
+ <div class="relay-setting">
|
|
|
<div class="form-group row">
|
|
|
<label for="relay_port" class="col-md-3 col-form-label"> 中转端口 </label>
|
|
|
<input type="number" class="form-control col-md-4" name="relay_port" id="relay_port" value="443">
|
|
@@ -409,346 +411,356 @@
|
|
|
<script src="/assets/global/vendor/switchery/switchery.min.js"></script>
|
|
|
<script src="/assets/global/js/Plugin/switchery.js"></script>
|
|
|
<script>
|
|
|
- const string = "{{strtolower(Str::random())}}";
|
|
|
- $(document).ready(function() {
|
|
|
- let v2_path = $('#v2_path');
|
|
|
- @isset($node)
|
|
|
+ const string = "{{strtolower(Str::random())}}";
|
|
|
+ $(document).ready(function() {
|
|
|
+ let v2_path = $('#v2_path');
|
|
|
+ switchSetting('single');
|
|
|
+ switchSetting('is_relay');
|
|
|
+ switchSetting('is_ddns');
|
|
|
+ @isset($node)
|
|
|
|
|
|
- @if($node->is_ddns)
|
|
|
- $('#is_ddns').click();
|
|
|
- @endif
|
|
|
- $('#name').val('{{$node->name}}');
|
|
|
- $('#server').val('{{$node->server}}');
|
|
|
- $('#ip').val('{{$node->ip}}');
|
|
|
- $('#ipv6').val('{{$node->ipv6}}');
|
|
|
- $('#push_port').val('{{$node->push_port}}');
|
|
|
- $('#traffic_rate').val('{{$node->traffic_rate}}');
|
|
|
- $('#level').selectpicker('val', '{{$node->level}}');
|
|
|
- $('#ruleGroup').selectpicker('val', '{{$node->rule_group_id}}');
|
|
|
- $('#speed_limit').val('{{$node->speed_limit}}');
|
|
|
- $('#client_limit').val('{{$node->client_limit}}');
|
|
|
- $('#labels').selectpicker('val', {{$node->labels->pluck('id')}});
|
|
|
- $('#country_code').selectpicker('val', '{{$node->country_code}}');
|
|
|
- $('#description').val('{{$node->description}}');
|
|
|
- $('#sort').val('{{$node->sort}}');
|
|
|
- @if($node->is_udp)
|
|
|
- $('#is_udp').click();
|
|
|
- @endif
|
|
|
- @if($node->status)
|
|
|
- $('#status').click();
|
|
|
- @endif
|
|
|
- @if($node->is_subscribe)
|
|
|
- $('#is_subscribe').click();
|
|
|
- @endif
|
|
|
- $("input[name='detection_type'][value='{{$node->detection_type}}']").click();
|
|
|
- @if($node->single)
|
|
|
- $('#single').click();
|
|
|
- @endif
|
|
|
- $('input[name = port]').val('{{$node->port}}');
|
|
|
- $('#passwd').val('{{$node->passwd}}');
|
|
|
- $("input[name='type'][value='{{$node->type}}']").click();
|
|
|
+ @if($node->is_ddns)
|
|
|
+ $('#is_ddns').click();
|
|
|
+ @endif
|
|
|
+ $('#name').val('{{$node->name}}');
|
|
|
+ $('#server').val('{{$node->server}}');
|
|
|
+ $('#ip').val('{{$node->ip}}');
|
|
|
+ $('#ipv6').val('{{$node->ipv6}}');
|
|
|
+ $('#push_port').val('{{$node->push_port}}');
|
|
|
+ $('#traffic_rate').val('{{$node->traffic_rate}}');
|
|
|
+ $('#level').selectpicker('val', '{{$node->level}}');
|
|
|
+ $('#ruleGroup').selectpicker('val', '{{$node->rule_group_id}}');
|
|
|
+ $('#speed_limit').val('{{$node->speed_limit}}');
|
|
|
+ $('#client_limit').val('{{$node->client_limit}}');
|
|
|
+ $('#labels').selectpicker('val', {{$node->labels->pluck('id')}});
|
|
|
+ $('#country_code').selectpicker('val', '{{$node->country_code}}');
|
|
|
+ $('#description').val('{{$node->description}}');
|
|
|
+ $('#sort').val('{{$node->sort}}');
|
|
|
+ @if($node->is_udp)
|
|
|
+ $('#is_udp').click();
|
|
|
+ @endif
|
|
|
+ @if($node->status)
|
|
|
+ $('#status').click();
|
|
|
+ @endif
|
|
|
+ @if($node->is_subscribe)
|
|
|
+ $('#is_subscribe').click();
|
|
|
+ @endif
|
|
|
+ $("input[name='detection_type'][value='{{$node->detection_type}}']").click();
|
|
|
+ @if($node->single)
|
|
|
+ $('#single').click();
|
|
|
+ @endif
|
|
|
+ $('input[name = port]').val('{{$node->port}}');
|
|
|
+ $('#passwd').val('{{$node->passwd}}');
|
|
|
+ $("input[name='type'][value='{{$node->type}}']").click();
|
|
|
|
|
|
- @if($node->type == 1 || $node->type == 4)
|
|
|
- // ShadowsocksR
|
|
|
- $('#method').selectpicker('val', '{{$node->method}}');
|
|
|
- $('#protocol').selectpicker('val', '{{$node->protocol}}');
|
|
|
- $('#protocol_param').val('{{$node->protocol_param}}');
|
|
|
- $('#obfs').selectpicker('val', '{{$node->obfs}}');
|
|
|
- $('#obfs_param').val('{{$node->obfs_param}}');
|
|
|
- @if($node->compatible)
|
|
|
- $('#compatible').click();
|
|
|
- @endif
|
|
|
- @endif
|
|
|
+ switch ({{$node->type}}) {
|
|
|
+ case 1:
|
|
|
+ case 4:
|
|
|
+ @if ($node->compatible)
|
|
|
+ $('#compatible').click();
|
|
|
+ @endif
|
|
|
+ $('#protocol').selectpicker('val', '{{$node->protocol}}');
|
|
|
+ $('#protocol_param').val('{{$node->protocol_param}}');
|
|
|
+ $('#obfs').selectpicker('val', '{{$node->obfs}}');
|
|
|
+ $('#obfs_param').val('{{$node->obfs_param}}');
|
|
|
+ case 0:
|
|
|
+ $('#method').selectpicker('val', '{{$node->method}}');
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ //V2Ray
|
|
|
+ $('#v2_alter_id').val('{{$node->v2_alter_id}}');
|
|
|
+ $('#v2_method').selectpicker('val', '{{$node->v2_method}}');
|
|
|
+ $('#v2_net').selectpicker('val', '{{$node->v2_net}}');
|
|
|
+ $('#v2_type').selectpicker('val', '{{$node->v2_type}}');
|
|
|
+ $('#v2_host').val('{{$node->v2_host}}');
|
|
|
+ $('#v2_port').val('{{$node->port}}');
|
|
|
+ $('#v2_sni').val('{{$node->v2_sni}}');
|
|
|
+ v2_path.val('{{$node->v2_path}}');
|
|
|
+ @if($node->v2_tls)
|
|
|
+ $('#v2_tls').click();
|
|
|
+ @endif
|
|
|
+ $('#tls_provider').val('{!! $node->tls_provider !!}');
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ $('#trojan_port').val('{{$node->port}}');
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ }
|
|
|
|
|
|
- @if($node->type === 2)
|
|
|
- //V2Ray
|
|
|
- $('#v2_alter_id').val('{{$node->v2_alter_id}}');
|
|
|
- $('#v2_port').val('{{$node->v2_port}}');
|
|
|
- $('#v2_method').selectpicker('val', '{{$node->v2_method}}');
|
|
|
- $('#v2_net').selectpicker('val', '{{$node->v2_net}}');
|
|
|
- $('#v2_type').selectpicker('val', '{{$node->v2_type}}');
|
|
|
- $('#v2_host').val('{{$node->v2_host}}');
|
|
|
- v2_path.val('{{$node->v2_path}}');
|
|
|
- @if($node->v2_tls)
|
|
|
- $('#v2_tls').click();
|
|
|
- @endif
|
|
|
- $('#tls_provider').val('{!! $node->tls_provider !!}');
|
|
|
- @endif
|
|
|
+ @if($node->is_relay)
|
|
|
+ // 中转
|
|
|
+ $('#is_relay').click();
|
|
|
+ $('#relay_port').val('{{$node->relay_port}}');
|
|
|
+ $('#relay_server').val('{{$node->relay_server}}');
|
|
|
+ @endif
|
|
|
+ @else
|
|
|
+ $('input[name=\'type\'][value=\'0\']').click();
|
|
|
+ $('#status').click();
|
|
|
+ $('#is_udp').click();
|
|
|
+ $('#is_subscribe').click();
|
|
|
+ v2_path.val('/' + string);
|
|
|
+ @endisset
|
|
|
+ if ($('#obfs').val() === 'plain') {
|
|
|
+ $('.obfs_param').hide();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- @if($node->is_relay)
|
|
|
- // 中转
|
|
|
- $('#is_relay').click();
|
|
|
- $('#relay_port').val('{{$node->relay_port}}');
|
|
|
- $('#relay_server').val('{{$node->relay_server}}');
|
|
|
- @endif
|
|
|
- @else
|
|
|
- $('#status').click();
|
|
|
- $('#is_udp').click();
|
|
|
- $('#is_subscribe').click();
|
|
|
- v2_path.val('/' + string);
|
|
|
- @endisset
|
|
|
- if ($('#obfs').val() === 'plain') {
|
|
|
- $('.obfs_param').hide();
|
|
|
- }
|
|
|
- });
|
|
|
+ // ajax同步提交
|
|
|
+ function Submit() {
|
|
|
+ const type = $('input[name=\'type\']:checked').val();
|
|
|
+ let port;
|
|
|
+ switch (type) {
|
|
|
+ case '2':
|
|
|
+ port = $('#v2_port').val();
|
|
|
+ break;
|
|
|
+ case '3':
|
|
|
+ port = $('#trojan_port').val();
|
|
|
+ break;
|
|
|
+ case '0':
|
|
|
+ case '1':
|
|
|
+ case '4':
|
|
|
+ default:
|
|
|
+ port = $('#single_port').val();
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ method: @isset($node) 'PUT' @else 'POST' @endisset,
|
|
|
+ url: '{{isset($node)? route('admin.node.update', $node) : route('admin.node.store')}}',
|
|
|
+ dataType: 'json',
|
|
|
+ data: {
|
|
|
+ _token: '{{csrf_token()}}',
|
|
|
+ is_ddns: document.getElementById('is_ddns').checked ? 1 : 0,
|
|
|
+ name: $('#name').val(),
|
|
|
+ server: $('#server').val(),
|
|
|
+ ip: $('#ip').val(),
|
|
|
+ ipv6: $('#ipv6').val(),
|
|
|
+ push_port: $('#push_port').val(),
|
|
|
+ traffic_rate: $('#traffic_rate').val(),
|
|
|
+ level: $('#level').val(),
|
|
|
+ rule_group_id: $('#ruleGroup').val(),
|
|
|
+ speed_limit: $('#speed_limit').val(),
|
|
|
+ client_limit: $('#client_limit').val(),
|
|
|
+ labels: $('#labels').val(),
|
|
|
+ country_code: $('#country_code option:selected').val(),
|
|
|
+ description: $('#description').val(),
|
|
|
+ sort: $('#sort').val(),
|
|
|
+ is_udp: document.getElementById('is_udp').checked ? 1 : 0,
|
|
|
+ status: document.getElementById('status').checked ? 1 : 0,
|
|
|
+ type: type,
|
|
|
+ method: $('#method').val(),
|
|
|
+ protocol: $('#protocol').val(),
|
|
|
+ protocol_param: $('#protocol_param').val(),
|
|
|
+ obfs: $('#obfs').val(),
|
|
|
+ obfs_param: $('#obfs_param').val(),
|
|
|
+ compatible: document.getElementById('compatible').checked ? 1 : 0,
|
|
|
+ is_subscribe: document.getElementById('is_subscribe').checked ? 1 : 0,
|
|
|
+ detection_type: $('input[name=\'detection_type\']:checked').val(),
|
|
|
+ single: document.getElementById('single').checked ? 1 : 0,
|
|
|
+ port: port,
|
|
|
+ passwd: $('#passwd').val(),
|
|
|
+ v2_alter_id: $('#v2_alter_id').val(),
|
|
|
+ v2_method: $('#v2_method').val(),
|
|
|
+ v2_net: $('#v2_net').val(),
|
|
|
+ v2_type: $('#v2_type').val(),
|
|
|
+ v2_host: $('#v2_host').val(),
|
|
|
+ v2_path: $('#v2_path').val(),
|
|
|
+ v2_sni: $('#v2_sni').val(),
|
|
|
+ v2_port: $('#v2_port').val(),
|
|
|
+ v2_tls: document.getElementById('v2_tls').checked ? 1 : 0,
|
|
|
+ tls_provider: $('#tls_provider').val(),
|
|
|
+ is_relay: document.getElementById('is_relay').checked ? 1 : 0,
|
|
|
+ relay_port: $('#relay_port').val(),
|
|
|
+ relay_server: $('#relay_server').val(),
|
|
|
+ },
|
|
|
+ success: function(ret) {
|
|
|
+ if (ret.status === 'success') {
|
|
|
+ swal.fire({
|
|
|
+ title: ret.message,
|
|
|
+ icon: 'success',
|
|
|
+ timer: 1000,
|
|
|
+ showConfirmButton: false,
|
|
|
+ }).then(() => window.location.href = '{{route('admin.node.index').(Request::getQueryString()?('?'.Request::getQueryString()):'') }}');
|
|
|
+ } else {
|
|
|
+ swal.fire({title: '[错误 | Error]', text: ret.message, icon: 'error'});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(data) {
|
|
|
+ let str = '';
|
|
|
+ const errors = data.responseJSON;
|
|
|
+ if ($.isEmptyObject(errors) === false) {
|
|
|
+ $.each(errors.errors, function(index, value) {
|
|
|
+ str += '<li>' + value + '</li>';
|
|
|
+ });
|
|
|
+ swal.fire({title: '提示', html: str, icon: 'error', confirmButtonText: '{{trans('common.confirm')}}'});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
- // ajax同步提交
|
|
|
- function Submit() {
|
|
|
- const type = $('input[name=\'type\']:checked').val();
|
|
|
- let port;
|
|
|
- switch (type) {
|
|
|
- case '2':
|
|
|
- port = $('#v2ray_port').val();
|
|
|
- break;
|
|
|
- case '3':
|
|
|
- port = $('#trojan_port').val();
|
|
|
- break;
|
|
|
- case '1':
|
|
|
- case '4':
|
|
|
- default:
|
|
|
- port = $('#single_port').val();
|
|
|
+ return false;
|
|
|
}
|
|
|
- $.ajax({
|
|
|
- method: @isset($node) 'PUT' @else 'POST' @endisset,
|
|
|
- url: '{{isset($node)? route('admin.node.update', $node) : route('admin.node.store')}}',
|
|
|
- dataType: 'json',
|
|
|
- data: {
|
|
|
- _token: '{{csrf_token()}}',
|
|
|
- is_ddns: document.getElementById('is_ddns').checked ? 1 : 0,
|
|
|
- name: $('#name').val(),
|
|
|
- server: $('#server').val(),
|
|
|
- ip: $('#ip').val(),
|
|
|
- ipv6: $('#ipv6').val(),
|
|
|
- push_port: $('#push_port').val(),
|
|
|
- traffic_rate: $('#traffic_rate').val(),
|
|
|
- level: $('#level').val(),
|
|
|
- rule_group_id: $('#ruleGroup').val(),
|
|
|
- speed_limit: $('#speed_limit').val(),
|
|
|
- client_limit: $('#client_limit').val(),
|
|
|
- labels: $('#labels').val(),
|
|
|
- country_code: $('#country_code option:selected').val(),
|
|
|
- description: $('#description').val(),
|
|
|
- sort: $('#sort').val(),
|
|
|
- is_udp: document.getElementById('is_udp').checked ? 1 : 0,
|
|
|
- status: document.getElementById('status').checked ? 1 : 0,
|
|
|
- type: type,
|
|
|
- method: $('#method').val(),
|
|
|
- protocol: $('#protocol').val(),
|
|
|
- protocol_param: $('#protocol_param').val(),
|
|
|
- obfs: $('#obfs').val(),
|
|
|
- obfs_param: $('#obfs_param').val(),
|
|
|
- compatible: document.getElementById('compatible').checked ? 1 : 0,
|
|
|
- is_subscribe: document.getElementById('is_subscribe').checked ? 1 : 0,
|
|
|
- detection_type: $('input[name=\'detection_type\']:checked').val(),
|
|
|
- single: document.getElementById('single').checked ? 1 : 0,
|
|
|
- port: port,
|
|
|
- passwd: $('#passwd').val(),
|
|
|
- v2_alter_id: $('#v2_alter_id').val(),
|
|
|
- v2_port: $('#v2_port').val(),
|
|
|
- v2_method: $('#v2_method').val(),
|
|
|
- v2_net: $('#v2_net').val(),
|
|
|
- v2_type: $('#v2_type').val(),
|
|
|
- v2_host: $('#v2_host').val(),
|
|
|
- v2_path: $('#v2_path').val(),
|
|
|
- v2_tls: document.getElementById('v2_tls').checked ? 1 : 0,
|
|
|
- tls_provider: $('#tls_provider').val(),
|
|
|
- is_relay: document.getElementById('is_relay').checked ? 1 : 0,
|
|
|
- relay_port: $('#relay_port').val(),
|
|
|
- relay_server: $('#relay_server').val(),
|
|
|
- },
|
|
|
- success: function(ret) {
|
|
|
- if (ret.status === 'success') {
|
|
|
- swal.fire({
|
|
|
- title: ret.message,
|
|
|
- icon: 'success',
|
|
|
- timer: 1000,
|
|
|
- showConfirmButton: false,
|
|
|
- }).then(() => window.location.href = '{{route('admin.node.index').(Request::getQueryString()?('?'.Request::getQueryString()):'') }}');
|
|
|
- } else {
|
|
|
- swal.fire({title: '[错误 | Error]', text: ret.message, icon: 'error'});
|
|
|
+
|
|
|
+ function switchSetting(id) {
|
|
|
+ let check = document.getElementById(id).checked ? 1 : 0;
|
|
|
+ switch (id) {
|
|
|
+ // 设置单端口多用户
|
|
|
+ case 'single':
|
|
|
+ if (check) {
|
|
|
+ $('.single-setting').show();
|
|
|
+ $('#single_port').attr('required', true);
|
|
|
+ } else {
|
|
|
+ $('#single_port').val('').removeAttr('required');
|
|
|
+ $('#passwd').val('');
|
|
|
+ $('.single-setting').hide();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ //设置中转
|
|
|
+ case 'is_relay':
|
|
|
+ if (check) {
|
|
|
+ $('.relay-setting').show();
|
|
|
+ $('#relay_port').attr('required', true);
|
|
|
+ $('#relay_server').attr('required', true);
|
|
|
+ } else {
|
|
|
+ $('.relay-setting').hide();
|
|
|
+ $('#relay_port').removeAttr('required');
|
|
|
+ $('#relay_server').removeAttr('required');
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ // 设置是否使用DDNS
|
|
|
+ case 'is_ddns':
|
|
|
+ if (check) {
|
|
|
+ $('#ip').val('').attr('readonly', true);
|
|
|
+ $('#ipv6').val('').attr('readonly', true);
|
|
|
+ $('#server').attr('required', true);
|
|
|
+ } else {
|
|
|
+ $('#ip').removeAttr('readonly');
|
|
|
+ $('#ipv6').removeAttr('readonly');
|
|
|
+ $('#server').removeAttr('required');
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
- },
|
|
|
- error: function(data) {
|
|
|
- let str = '';
|
|
|
- const errors = data.responseJSON;
|
|
|
- if ($.isEmptyObject(errors) === false) {
|
|
|
- if ($.isEmptyObject(errors.message) === false && typeof errors.message === 'string') {
|
|
|
- str += errors.message;
|
|
|
- } else {
|
|
|
- $.each(errors.errors, function(index, value) {
|
|
|
- str += '<li>' + value + '</li>';
|
|
|
- });
|
|
|
- }
|
|
|
- swal.fire({title: '提示', html: str, icon: 'error', confirmButtonText: '{{trans('common.confirm')}}'});
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置服务类型
|
|
|
+ $('input:radio[name=\'type\']').on('change', function() {
|
|
|
+ const type = parseInt($(this).val());
|
|
|
+ const $ss_setting = $('.ss-setting');
|
|
|
+ const $ssr_setting = $('.ssr-setting');
|
|
|
+ const $v2ray_setting = $('.v2ray-setting');
|
|
|
+ const $trojan_setting = $('.trojan-setting');
|
|
|
+ $ssr_setting.hide();
|
|
|
+ $ss_setting.hide();
|
|
|
+ $v2ray_setting.hide();
|
|
|
+ $trojan_setting.hide();
|
|
|
+ $('#v2_port').removeAttr('required');
|
|
|
+ $('#trojan_port').removeAttr('required');
|
|
|
+ switch (type) {
|
|
|
+ case 0:
|
|
|
+ $ss_setting.show();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ $v2ray_setting.show();
|
|
|
+ $('#v2_port').val('').attr('required', true);
|
|
|
+ $('#v2_net').selectpicker('val', 'tcp');
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ $trojan_setting.show();
|
|
|
+ $('#trojan_port').val('').attr('required', true);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ case 4:
|
|
|
+ $ss_setting.show();
|
|
|
+ $ssr_setting.show();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
}
|
|
|
- },
|
|
|
});
|
|
|
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- function switchSetting(id) {
|
|
|
- let check = document.getElementById(id).checked ? 1 : 0;
|
|
|
- switch (id) {
|
|
|
- // 设置单端口多用户
|
|
|
- case 'single':
|
|
|
- if (check) {
|
|
|
- $('.single-setting').show();
|
|
|
+ $('#obfs').on('changed.bs.select', function() {
|
|
|
+ const obfs_param = $('.obfs_param');
|
|
|
+ if ($('#obfs').val() === 'plain') {
|
|
|
+ $('#obfs_param').val('');
|
|
|
+ obfs_param.hide();
|
|
|
} else {
|
|
|
- $('#single_port').val('');
|
|
|
- $('#passwd').val('');
|
|
|
- $('.single-setting').hide();
|
|
|
+ obfs_param.show();
|
|
|
}
|
|
|
- break;
|
|
|
- //设置中转
|
|
|
- case 'is_relay':
|
|
|
- if (check) {
|
|
|
- $('.relay-setting').show();
|
|
|
- $('#relay_port').attr('required', true);
|
|
|
- $('#relay_server').attr('required', true);
|
|
|
- } else {
|
|
|
- $('.relay-setting').hide();
|
|
|
- $('#relay_port').removeAttr('required');
|
|
|
- $('#relay_server').removeAttr('required');
|
|
|
- }
|
|
|
- break;
|
|
|
- // 设置是否使用DDNS
|
|
|
- case 'is_ddns':
|
|
|
- if (check) {
|
|
|
- $('#ip').val('').attr('readonly', true);
|
|
|
- $('#ipv6').val('').attr('readonly', true);
|
|
|
- $('#server').attr('required', true);
|
|
|
- } else {
|
|
|
- $('#ip').removeAttr('readonly');
|
|
|
- $('#ipv6').removeAttr('readonly');
|
|
|
- $('#server').removeAttr('required');
|
|
|
+ });
|
|
|
+
|
|
|
+ // 设置V2Ray详细设置
|
|
|
+ $('#v2_net').on('changed.bs.select', function() {
|
|
|
+ const type = $('.v2_type');
|
|
|
+ const type_option = $('#type_option');
|
|
|
+ const host = $('.v2_host');
|
|
|
+ const path = $('#v2_path');
|
|
|
+ const v2_other = $('[name="v2_other"]');
|
|
|
+ type.show();
|
|
|
+ host.show();
|
|
|
+ v2_other.show();
|
|
|
+ path.val('/' + string);
|
|
|
+ switch ($(this).val()) {
|
|
|
+ case 'kcp':
|
|
|
+ type_option.attr('disabled', false);
|
|
|
+ break;
|
|
|
+ case 'ws':
|
|
|
+ type.hide();
|
|
|
+ break;
|
|
|
+ case 'http':
|
|
|
+ type.hide();
|
|
|
+ break;
|
|
|
+ case 'domainsocket':
|
|
|
+ type.hide();
|
|
|
+ host.hide();
|
|
|
+ break;
|
|
|
+ case 'quic':
|
|
|
+ type_option.attr('disabled', false);
|
|
|
+ path.val(string);
|
|
|
+ break;
|
|
|
+ case 'tcp':
|
|
|
+ default:
|
|
|
+ type_option.attr('disabled', true);
|
|
|
+ break;
|
|
|
}
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ $('#v2_type').selectpicker('refresh');
|
|
|
+ });
|
|
|
|
|
|
- // 设置服务类型
|
|
|
- $('input:radio[name=\'type\']').on('change', function() {
|
|
|
- const type = parseInt($(this).val());
|
|
|
- const $ssr_setting = $('.ssr-setting');
|
|
|
- const $v2ray_setting = $('.v2ray-setting');
|
|
|
- const $trojan_setting = $('.trojan-setting');
|
|
|
- $ssr_setting.hide();
|
|
|
- $v2ray_setting.hide();
|
|
|
- $trojan_setting.hide();
|
|
|
- switch (type) {
|
|
|
- case 1:
|
|
|
- $ssr_setting.show();
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- $v2ray_setting.show();
|
|
|
- $('#v2_net').selectpicker('val', 'tcp');
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- $trojan_setting.show();
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- $ssr_setting.show();
|
|
|
- break;
|
|
|
- default:
|
|
|
- }
|
|
|
- });
|
|
|
+ // 服务条款
|
|
|
+ function showTnc() {
|
|
|
+ const content =
|
|
|
+ '<ol>' +
|
|
|
+ '<li>请勿直接复制黏贴以下配置,SSR(R)会报错的</li>' +
|
|
|
+ '<li>确保服务器时间为CST</li>' +
|
|
|
+ '</ol>' +
|
|
|
+ '  "additional_ports" : {<br />' +
|
|
|
+ '   "443": {<br />' +
|
|
|
+ '    "passwd": "ProxyPanel",<br />' +
|
|
|
+ '    "method": "none",<br />' +
|
|
|
+ '    "protocol": "auth_chain_a",<br />' +
|
|
|
+ '    "protocol_param": "#",<br />' +
|
|
|
+ '    "obfs": "plain",<br />' +
|
|
|
+ '    "obfs_param": "fe2.update.microsoft.com"<br />' +
|
|
|
+ '   }<br />' +
|
|
|
+ '  },';
|
|
|
|
|
|
- $('#obfs').on('changed.bs.select', function() {
|
|
|
- const obfs_param = $('.obfs_param');
|
|
|
- if ($('#obfs').val() === 'plain') {
|
|
|
- $('#obfs_param').val('');
|
|
|
- obfs_param.hide();
|
|
|
- } else {
|
|
|
- obfs_param.show();
|
|
|
+ swal.fire({
|
|
|
+ title: '[节点 user-config.json 配置示例]',
|
|
|
+ html: '<div class="p-10 bg-grey-900 text-white font-weight-300 text-left" style="line-height: 22px;">' +
|
|
|
+ content + '</div>',
|
|
|
+ icon: 'info',
|
|
|
+ });
|
|
|
}
|
|
|
- });
|
|
|
|
|
|
- $('#v2_ws').on('changed.bs.select', function() {
|
|
|
- $('#v2_host').val($('#v2_ws').val());
|
|
|
- });
|
|
|
+ // 模式提示
|
|
|
+ function showPortsOnlyConfig() {
|
|
|
+ const content = '严格模式:"additional_ports_only": "true"'
|
|
|
+ + '<br><br>'
|
|
|
+ + '兼容模式:"additional_ports_only": "false"';
|
|
|
|
|
|
- // 设置V2Ray详细设置
|
|
|
- $('#v2_net').on('changed.bs.select', function() {
|
|
|
- const type = $('.v2_type');
|
|
|
- const type_option = $('#type_option');
|
|
|
- const host = $('.v2_host');
|
|
|
- const path = $('#v2_path');
|
|
|
- const v2_ws = $('[name="v2_ws"]');
|
|
|
- const v2_other = $('[name="v2_other"]');
|
|
|
- type.show();
|
|
|
- host.show();
|
|
|
- v2_other.show();
|
|
|
- v2_ws.hide();
|
|
|
- path.val('/' + string);
|
|
|
- switch ($(this).val()) {
|
|
|
- case 'kcp':
|
|
|
- type_option.attr('disabled', false);
|
|
|
- break;
|
|
|
- case 'ws':
|
|
|
- v2_ws.show();
|
|
|
- type.hide();
|
|
|
- v2_other.hide();
|
|
|
- break;
|
|
|
- case 'http':
|
|
|
- type.hide();
|
|
|
- break;
|
|
|
- case 'domainsocket':
|
|
|
- type.hide();
|
|
|
- host.hide();
|
|
|
- break;
|
|
|
- case 'quic':
|
|
|
- type_option.attr('disabled', false);
|
|
|
- path.val(string);
|
|
|
- break;
|
|
|
- case 'tcp':
|
|
|
- default:
|
|
|
- type_option.attr('disabled', true);
|
|
|
- break;
|
|
|
+ swal.fire({
|
|
|
+ title: '[节点 user-config.json 配置示例]',
|
|
|
+ html: '<div class="p-10 bg-grey-900 text-white font-weight-300 text-left" style="line-height: 22px;">' +
|
|
|
+ content + '</div>',
|
|
|
+ icon: 'info',
|
|
|
+ });
|
|
|
}
|
|
|
- $('#v2_type').selectpicker('refresh');
|
|
|
- });
|
|
|
-
|
|
|
- // 服务条款
|
|
|
- function showTnc() {
|
|
|
- const content =
|
|
|
- '<ol>' +
|
|
|
- '<li>请勿直接复制黏贴以下配置,SSR(R)会报错的</li>' +
|
|
|
- '<li>确保服务器时间为CST</li>' +
|
|
|
- '</ol>' +
|
|
|
- '  "additional_ports" : {<br />' +
|
|
|
- '   "443": {<br />' +
|
|
|
- '    "passwd": "ProxyPanel",<br />' +
|
|
|
- '    "method": "none",<br />' +
|
|
|
- '    "protocol": "auth_chain_a",<br />' +
|
|
|
- '    "protocol_param": "#",<br />' +
|
|
|
- '    "obfs": "plain",<br />' +
|
|
|
- '    "obfs_param": "fe2.update.microsoft.com"<br />' +
|
|
|
- '   }<br />' +
|
|
|
- '  },';
|
|
|
-
|
|
|
- swal.fire({
|
|
|
- title: '[节点 user-config.json 配置示例]',
|
|
|
- html: '<div class="p-10 bg-grey-900 text-white font-weight-300 text-left" style="line-height: 22px;">' +
|
|
|
- content + '</div>',
|
|
|
- icon: 'info',
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- // 模式提示
|
|
|
- function showPortsOnlyConfig() {
|
|
|
- const content = '严格模式:"additional_ports_only": "true"'
|
|
|
- + '<br><br>'
|
|
|
- + '兼容模式:"additional_ports_only": "false"';
|
|
|
-
|
|
|
- swal.fire({
|
|
|
- title: '[节点 user-config.json 配置示例]',
|
|
|
- html: '<div class="p-10 bg-grey-900 text-white font-weight-300 text-left" style="line-height: 22px;">' +
|
|
|
- content + '</div>',
|
|
|
- icon: 'info',
|
|
|
- });
|
|
|
- }
|
|
|
</script>
|
|
|
@endsection
|