Repository navigation
Expand file tree
/
Copy pathaddNode.blade.php
More file actions
446 lines (435 loc) · 33.1 KB
/
Copy pathaddNode.blade.php
File metadata and controls
446 lines (435 loc) · 33.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
@extends('admin.layouts')
@section('css')
<link href="/assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet" type="text/css" />
<link href="/assets/global/plugins/select2/css/select2.min.css" rel="stylesheet" type="text/css" />
<link href="/assets/global/plugins/select2/css/select2-bootstrap.min.css" rel="stylesheet" type="text/css" />
@endsection
@section('title', '控制面板')
@section('content')
<!-- BEGIN CONTENT BODY -->
<div class="page-content" style="padding-top:0;">
<!-- BEGIN PAGE BASE CONTENT -->
<div class="row">
<div class="col-md-12">
<div class="tab-pane active">
<div class="portlet light bordered">
<div class="portlet-body form">
<!-- BEGIN FORM-->
<form action="{{url('admin/addNode')}}" method="post" class="form-horizontal" onsubmit="return do_submit();">
<div class="form-body">
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button>
<strong>注意:</strong> 添加节点后自动生成的<code>ID</code>,即为该节点后端部署SSR时<code>usermysql.json</code>的<code>node_id</code>的值
</div>
<div class="row">
<div class="col-md-6">
<!-- BEGIN SAMPLE FORM PORTLET-->
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption">
<span class="caption-subject font-dark bold uppercase">基础信息</span>
</div>
</div>
<div class="portlet-body">
<div class="form-group">
<label for="name" class="col-md-3 control-label"> 节点名称 </label>
<div class="col-md-8">
<input type="text" class="form-control" name="name" id="name" placeholder="" autofocus required>
</div>
</div>
<div class="form-group">
<label for="server" class="col-md-3 control-label"> 域名地址 </label>
<div class="col-md-8">
<input type="text" class="form-control" name="server" id="server" placeholder="服务器域名地址,填写则优先取域名地址">
</div>
</div>
<div class="form-group">
<label for="ip" class="col-md-3 control-label"> IP地址 </label>
<div class="col-md-8">
<input type="text" class="form-control" name="ip" id="ip" placeholder="服务器IP地址" required>
</div>
</div>
<div class="form-group">
<label for="status" class="col-md-3 control-label">标签</label>
<div class="col-md-8">
<select id="labels" class="form-control select2-multiple" name="labels[]" multiple>
@foreach($label_list as $label)
<option value="{{$label->id}}">{{$label->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label for="group_id" class="col-md-3 control-label"> 所属分组 </label>
<div class="col-md-8">
<select class="form-control" name="group_id" id="group_id">
<option value="0">请选择</option>
@if(!$group_list->isEmpty())
@foreach($group_list as $group)
<option value="{{$group->id}}">{{$group->name}}</option>
@endforeach
@endif
</select>
<span class="help-block">没有关联任何分组时则节点对于用户不可见</span>
</div>
</div>
<div class="form-group">
<label for="country_code" class="col-md-3 control-label"> 国家/地区 </label>
<div class="col-md-8">
<select class="form-control" name="country_code" id="country_code">
<option value="">请选择</option>
@if(!$country_list->isEmpty())
@foreach($country_list as $country)
<option value="{{$country->country_code}}">{{$country->country_code}} - {{$country->country_name}}</option>
@endforeach
@endif
</select>
</div>
</div>
<div class="form-group">
<label for="desc" class="col-md-3 control-label"> 描述 </label>
<div class="col-md-8">
<input type="text" class="form-control" name="desc" id="desc" placeholder="简单描述">
</div>
</div>
<div class="form-group">
<label for="sort" class="col-md-3 control-label">排序</label>
<div class="col-md-8">
<input type="text" class="form-control" name="sort" value="1" id="sort" placeholder="">
<span class="help-block"> 值越大排越前 </span>
</div>
</div>
<div class="form-group">
<label for="status" class="col-md-3 control-label">状态</label>
<div class="col-md-8">
<select class="form-control" name="status" id="status">
<option value="1" selected>正常</option>
<option value="0">维护</option>
</select>
</div>
</div>
<hr />
<div class="form-group">
<label for="single" class="col-md-3 control-label">单端口</label>
<div class="col-md-8">
<select class="form-control" name="single" id="single">
<option value="0" selected>关闭</option>
<option value="1">启用</option>
</select>
<span class="help-block"> 如果启用请配置服务端的<span style="color:red"> <a href="javascript:showTnc();">additional_ports</a> </span>信息 </span>
</div>
</div>
<div class="form-group hidden single-setting">
<label for="single_force" class="col-md-3 control-label">[单] 模式</label>
<div class="col-md-8">
<select class="form-control" name="single_force" id="single_force">
<option value="0" selected>兼容模式</option>
<option value="1">严格模式</option>
</select>
<span class="help-block"> 严格模式:用户的端口无法连接,只能通过以下指定的端口号进行连接(<a href="javascript:showPortsOnlyConfig();">如何配置</a>)</span>
</div>
</div>
<div class="form-group hidden single-setting">
<label for="single_port" class="col-md-3 control-label">[单] 端口号</label>
<div class="col-md-8">
<input type="text" class="form-control" name="single_port" value="" id="single_port" placeholder="443">
<span class="help-block"> 推荐80或443,后端需要配置 </span>
</div>
</div>
<div class="form-group hidden single-setting">
<label for="single_passwd" class="col-md-3 control-label">[单] 密码</label>
<div class="col-md-8">
<input type="text" class="form-control" name="single_passwd" value="" id="single_passwd" placeholder="password">
<span class="help-block"> 展示和生成配置用,后端配置注意保持一致 </span>
</div>
</div>
<div class="form-group hidden single-setting">
<label for="single_method" class="col-md-3 control-label">[单] 加密方式</label>
<div class="col-md-8">
<select class="form-control" name="single_method" id="single_method">
@foreach ($method_list as $method)
<option value="{{$method->name}}" @if($method->is_default) selected @endif>{{$method->name}}</option>
@endforeach
</select>
<span class="help-block"> 展示和生成配置用,后端配置注意保持一致 </span>
</div>
</div>
<div class="form-group hidden single-setting">
<label for="single_protocol" class="col-md-3 control-label">[单] 协议</label>
<div class="col-md-8">
<select class="form-control" name="single_protocol" id="single_protocol">
<option value="origin">origin</option>
<option value="verify_deflate">verify_deflate</option>
<option value="auth_sha1_v4">auth_sha1_v4</option>
<option value="auth_aes128_md5">auth_aes128_md5</option>
<option value="auth_aes128_sha1">auth_aes128_sha1</option>
<option value="auth_chain_a" selected>auth_chain_a</option>
</select>
<span class="help-block"> 展示和生成配置用,后端配置注意保持一致 </span>
</div>
</div>
<div class="form-group hidden single-setting">
<label for="single_obfs" class="col-md-3 control-label">[单] 混淆</label>
<div class="col-md-8">
<select class="form-control" name="single_obfs" id="single_obfs">
<option value="plain">plain</option>
<option value="http_simple">http_simple</option>
<option value="random_head">random_head</option>
<option value="tls1.2_ticket_auth" selected>tls1.2_ticket_auth</option>
</select>
<span class="help-block"> 展示和生成配置用,后端配置注意保持一致 </span>
</div>
</div>
</div>
</div>
<!-- END SAMPLE FORM PORTLET-->
</div>
<div class="col-md-6">
<!-- BEGIN SAMPLE FORM PORTLET-->
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption">
<span class="caption-subject font-dark bold">扩展信息</span>
</div>
</div>
<div class="portlet-body">
<div class="form-group">
<label for="compatible" class="col-md-3 control-label">兼容SS</label>
<div class="col-md-8">
<select class="form-control" name="compatible" id="compatible">
<option value="0" selected>否</option>
<option value="1">是</option>
</select>
<span class="help-block"> 如果兼容请在服务端配置协议和混淆时加上<span style="color:red">_compatible</span> </span>
</div>
</div>
<div class="form-group">
<label for="traffic_rate" class="col-md-3 control-label"> 流量比例 </label>
<div class="col-md-8">
<input type="text" class="form-control" name="traffic_rate" value="1.0" id="traffic_rate" placeholder="" required>
<span class="help-block"> 举例:0.1用100M结算10M,5用100M结算500M </span>
</div>
</div>
<div class="form-group">
<label for="method" class="col-md-3 control-label">加密方式</label>
<div class="col-md-8">
<select class="form-control" name="method" id="method">
@foreach ($method_list as $method)
<option value="{{$method->name}}" @if($method->is_default) selected @endif>{{$method->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label for="protocol" class="col-md-3 control-label">协议</label>
<div class="col-md-8">
<select class="form-control" name="protocol" id="protocol">
@foreach ($protocol_list as $protocol)
<option value="{{$protocol->name}}" @if($protocol->is_default) selected @endif>{{$protocol->name}}</option>
@endforeach
</select>
</div>
</div>
<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="">
</div>
</div>
<div class="form-group">
<label for="obfs" class="col-md-3 control-label">混淆</label>
<div class="col-md-8">
<select class="form-control" name="obfs" id="obfs">
@foreach ($obfs_list as $obfs)
<option value="{{$obfs->name}}" @if($obfs->is_default) selected @endif>{{$obfs->name}}</option>
@endforeach
</select>
</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"></textarea>
</div>
</div>
<div class="form-group">
<label for="bandwidth" class="col-md-3 control-label">出口带宽</label>
<div class="col-md-8">
<div class="input-group">
<input type="text" class="form-control" name="bandwidth" value="1000" id="bandwidth" placeholder="" required>
<span class="input-group-addon">M</span>
</div>
</div>
</div>
<div class="form-group">
<label for="traffic" class="col-md-3 control-label">每月可用流量</label>
<div class="col-md-8">
<div class="input-group">
<input type="text" class="form-control right" name="traffic" value="1000" id="traffic" placeholder="" required>
<span class="input-group-addon">G</span>
</div>
</div>
</div>
<div class="form-group">
<label for="monitor_url" class="col-md-3 control-label">监控地址</label>
<div class="col-md-8">
<input type="text" class="form-control right" name="monitor_url" value="" id="monitor_url" placeholder="">
<span class="help-block"> 例如:http://us1.xxx.com/monitor.php </span>
</div>
</div>
</div>
</div>
<!-- END SAMPLE FORM PORTLET-->
</div>
</div>
</div>
<div class="form-actions">
<div class="row">
<div class="col-md-offset-6">
<button type="submit" class="btn green">提 交</button>
</div>
</div>
</div>
</form>
<!-- END FORM-->
</div>
</div>
</div>
</div>
</div>
<!-- END PAGE BASE CONTENT -->
</div>
<!-- END CONTENT BODY -->
@endsection
@section('script')
<script src="/assets/global/plugins/select2/js/select2.full.min.js" type="text/javascript"></script>
<script src="/js/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript">
// 用户标签选择器
$('#labels').select2({
placeholder: '设置后则可见相同标签的节点',
allowClear: true
});
// ajax同步提交
function do_submit() {
var name = $('#name').val();
var labels = $("#labels").val();
var group_id = $("#group_id option:selected").val();
var country_code = $("#country_code option:selected").val();
var server = $('#server').val();
var ip = $('#ip').val();
var desc = $('#desc').val();
var method = $('#method').val();
var traffic_rate = $('#traffic_rate').val();
var protocol = $('#protocol').val();
var protocol_param = $('#protocol_param').val();
var obfs = $('#obfs').val();
var obfs_param = $('#obfs_param').val();
var bandwidth = $('#bandwidth').val();
var traffic = $('#traffic').val();
var monitor_url = $('#monitor_url').val();
var compatible = $('#compatible').val();
var single = $('#single').val();
var single_force = $('#single_force').val();
var single_port = $('#single_port').val();
var single_passwd = $('#single_passwd').val();
var single_method = $('#single_method').val();
var single_protocol = $('#single_protocol').val();
var single_obfs = $('#single_obfs').val();
var sort = $('#sort').val();
var status = $('#status').val();
$.ajax({
type: "POST",
url: "{{url('admin/addNode')}}",
async: false,
data: {_token:'{{csrf_token()}}', name: name, labels:labels, group_id:group_id, country_code:country_code, server:server, ip:ip, desc:desc, method:method, traffic_rate:traffic_rate, protocol:protocol, protocol_param:protocol_param, obfs:obfs, obfs_param:obfs_param, bandwidth:bandwidth, traffic:traffic, monitor_url:monitor_url, compatible:compatible, single:single, single_force:single_force, single_port:single_port, single_passwd:single_passwd, single_method:single_method, single_protocol:single_protocol, single_obfs:single_obfs, sort:sort, status:status},
dataType: 'json',
success: function (ret) {
layer.msg(ret.message, {time:1000}, function() {
if (ret.status == 'success') {
window.location.href = '{{url('admin/nodeList')}}';
}
});
}
});
return false;
}
// 设置单端口多用户
$("#single").on('change', function() {
var single = parseInt($(this).val());
if (single) {
$(".single-setting").removeClass('hidden');
} else {
$(".single-setting").removeClass('hidden');
$(".single-setting").addClass('hidden');
}
});
// 服务条款
function showTnc() {
var content = '1、请勿直接复制黏贴以下配置,SSR(R)会报错的;'
+ '<br>2、确保服务器时间为CST或UTC;'
+ '<br>3、请看<a href="https://github.com/ssrpanel/SSRPanel/wiki/%E5%8D%95%E7%AB%AF%E5%8F%A3%E5%A4%9A%E7%94%A8%E6%88%B7%E7%9A%84%E5%9D%91" target="_blank">WIKI</a>;'
+ '<br>'
+ '<br>additional_ports" : {'
+ '<br>    "80": {'
+ '<br>        "passwd": "password",'
+ '<br>        "method": "aes-128-ctr",'
+ '<br>        "protocol": "auth_aes128_md5",'
+ '<br>        "protocol_param": "#",'
+ '<br>        "obfs": "tls1.2_ticket_auth",'
+ '<br>        "obfs_param": ""'
+ '<br>    },'
+ '<br>    "443": {'
+ '<br>        "passwd": "password",'
+ '<br>        "method": "aes-128-ctr",'
+ '<br>        "protocol": "auth_aes128_sha1",'
+ '<br>        "protocol_param": "#",'
+ '<br>        "obfs": "tls1.2_ticket_auth",'
+ '<br>        "obfs_param": ""'
+ '<br>    }'
+ '<br>},';
layer.open({
type: 1
,title: '[节点 user-config.json 配置示例]'
,closeBtn: false
,area: '400px;'
,shade: 0.8
,id: 'tnc' //设定一个id,防止重复弹出
,resize: false
,btn: ['确定']
,btnAlign: 'c'
,moveType: 1 //拖拽模式,0或者1
,content: '<div style="padding: 20px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">' + content + '</div>'
,success: function(layero){
//
}
});
}
// 模式提示
function showPortsOnlyConfig() {
var content = '严格模式:'
+ '<br>'
+ '"additional_ports_only": "true"'
+ '<br><br>'
+ '兼容模式:'
+ '<br>'
+ '"additional_ports_only": "false"';
layer.open({
type: 1
,title: '[节点 user-config.json 配置示例]'
,closeBtn: false
,area: '400px;'
,shade: 0.8
,id: 'po-cfg' //设定一个id,防止重复弹出
,resize: false
,btn: ['确定']
,btnAlign: 'c'
,moveType: 1 //拖拽模式,0或者1
,content: '<div style="padding: 20px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">' + content + '</div>'
,success: function(layero){
//
}
});
}
</script>
@endsection