forked from XX-net/XX-Net
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscan_setting.html
More file actions
136 lines (128 loc) · 5.28 KB
/
scan_setting.html
File metadata and controls
136 lines (128 loc) · 5.28 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
<form method="POST" onSubmit="return false;">
<div class="row-fluid">
<div class="span3">
<label for="auto-adjust-scan-ip-thread-num">{{ _("Auto-adjust scan thread count") }}<a href="https://github.com/XX-net/XX-Net/wiki/GoAgent-Auto-adjust-scan-ip-thread-num" target="_blank">({{ _("Help") }})</a></label>
</div> <!-- .span3 -->
<div class="span9">
<input id="auto-adjust-scan-ip-thread-num" type="checkbox" data-toggle="switch" />
</div> <!-- .span9 -->
</div> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span3">
<label for="scan-ip-thread-num">{{ _("Max scan thread count") }}</label>
</div> <!-- .span3 -->
<div class="span6">
<input id="scan-ip-thread-num" type="text" />
</div> <!-- .span6 -->
<div class="span3" >
<button class="btn btn-primary " id="update-thread-num">{{ _("Update") }}</button>
</div>
</div> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span3">
<label for="ip-range-content">{{ _("IP range list") }}(<a href="https://github.com/XX-net/XX-Net/wiki/GoAgent-Scan-Ip-Range-Format" target="_blank">{{ _("Supporting formats") }}</a>)</label>
</div> <!-- .span3 -->
<div class="span9">
<textarea id="ip-range-content" rows="10"></textarea>
</div> <!-- .span9 -->
</div> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span12">
<button class="btn btn-primary btn-block" id="submit-ip-range" type="submit">{{ _("Submit") }}</button>
</div> <!-- .span12 -->
</div> <!-- .row-fluid -->
</form>
<script type="text/javascript">
$(function() {
$('[data-toggle=switch]').wrap('<div class="switch" />').parent().bootstrapSwitch();
});
$('#auto-adjust-scan-ip-thread-num').change(function() {
var isChecked = $(this).is(':checked'),
key = 'auto_adjust_scan_ip_thread_num',
value = isChecked ? 1 : 0;
return setConfig(key, value);
});
function setConfig(key, value) {
var pageRequests = {};
pageRequests[key] = value;
$.ajax({
type: 'POST',
url: '/module/gae_proxy/control/scan_ip?cmd=set_auto_adjust_scan_ip_thread_num',
data: pageRequests,
dataType: 'JSON',
success: function(result) {
if ( result['res'] == 'success' ) {
tip('{{ _("Settings saved successfully") }}', 'success');
} else {
displayErrorMessage();
}
},
error: function() {
displayErrorMessage();
}
});
}
</script>
<script type="text/javascript">
$(function() {
$.ajax({
type: 'POST',
url: '/module/gae_proxy/control/config?cmd=get_config',
dataType: 'JSON',
success: function(result) {
if ( result['auto_adjust_scan_ip_thread_num'] != 0 ) {
$( "#auto-adjust-scan-ip-thread-num").parent().removeClass('switch-off');
$( "#auto-adjust-scan-ip-thread-num").parent().addClass('switch-on');
$( "#auto-adjust-scan-ip-thread-num").prop('checked', true);
}
$('#scan-ip-thread-num').val(result['scan_ip_thread_num']);
},
error: function(){
tip('{{ _("Failed reading the settings") }}', 'error');
}
});
});
$('#ip-range-content').load('/module/gae_proxy/control/scan_ip?cmd=get_range');
</script>
<script type="text/javascript">
$('#update-thread-num').click(function(){
var scanIpThreadNum = $('#scan-ip-thread-num').val();
var config = {
'scan_ip_thread_num': scanIpThreadNum
};
$.ajax({
type: 'POST',
url: '/module/gae_proxy/control/scan_ip?cmd=set_scan_thread_num',
data: config,
dataType: 'JSON',
success: function(result) {
if ( result['res'] == 'success' ) {
tip('{{ _("Settings saved successfully") }}', 'success');
} else {
tip('{{ _("Unkown error occurred") }}', 'error');
}
}
});
});
</script>
<script type="text/javascript">
$('#submit-ip-range').click(function(){
var ipRangeContent = $('#ip-range-content').val();
var config = {
'ip_range': ipRangeContent
};
$.ajax({
type: 'POST',
url: '/module/gae_proxy/control/scan_ip?cmd=set_range',
data: config,
dataType: 'JSON',
success: function(result) {
if ( result['res'] == 'success' ) {
tip('{{ _("Settings saved successfully") }}', 'success');
} else {
tip('{{ _("Unkown error occurred") }}', 'error');
}
}
});
});
</script>