forked from XX-net/XX-Net
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.html
More file actions
162 lines (156 loc) · 6.52 KB
/
Copy pathconfig.html
File metadata and controls
162 lines (156 loc) · 6.52 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
<form id="goagent-php-config" method="POST" onSubmit="onSubmit(); return false;">
<div class="row-fluid">
<div class="span4">
<label for="php-server">{{ _("PHP Server URL") }}</label>
</div> <!-- .span4 -->
<div class="span8">
<input id="php-server" type="text" placeholder="Example: http://zjhzxhz.com/index.php" />
</div> <!-- .span8 -->
</div> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span4">
<label for="php-password">{{ _("Password") }}</label>
</div> <!-- .span4 -->
<div class="span8">
<input id="php-password" type="password" placeholder="{{ _("Default: ") }}123456" />
</div> <!-- .span8 -->
</div> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span4">
<label for="enable-front-proxy">{{ _("Frontend Proxy") }}</label>
</div> <!-- .span4 -->
<div class="span8">
<input id="enable-front-proxy" type="checkbox" data-toggle="switch" />
</div> <!-- .span8 -->
</div> <!-- .row-fluid -->
<div id="front-proxy-options" style="display: none;">
<div class="row-fluid">
<div class="span4">
<label for="proxy-host">{{ _("Address") }}</label>
</div> <!-- .span4 -->
<div class="span8">
<input id="proxy-host" type="text" placeholder="{{ _("Example: ") }}127.0.0.1" />
</div> <!-- .span8 -->
</div> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span4">
<label for="proxy-port">{{ _("Port") }}</label>
</div> <!-- .span4 -->
<div class="span8">
<input id="proxy-port" type="text" placeholder="{{ _("Example: ") }}808" />
</div> <!-- .span8 -->
</div> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span4">
<label for="proxy-username">{{ _("Username") }}</label>
</div> <!-- .span4 -->
<div class="span8">
<input id="proxy-username" type="text" />
</div> <!-- .span8 -->
</div> <!-- .row-fluid -->
<div class="row-fluid">
<div class="span4">
<label for="proxy-password">{{ _("Password") }}</label>
</div> <!-- .span4 -->
<div class="span8">
<input id="proxy-password" type="password" />
</div> <!-- .span8 -->
</div> <!-- .row-fluid -->
</div> <!-- #front-proxy-options -->
<div class="row-fluid">
<div class="span12">
<button class="btn btn-primary btn-block" type="submit">{{ _("Save and Restart PHP Proxy") }}</button>
</div> <!-- .span12 -->
</div>
<div>
<p>{{ _("Help: ") }}<a href="https://github.com/XX-net/XX-Net/wiki/PHP-proxy">https://github.com/XX-net/XX-Net/wiki/PHP-proxy</a></p>
</div> <!-- .row-fluid -->
</form> <!-- #goagent-php-config -->
<!-- JavaScript -->
<script type="text/javascript">
title('{{ _("PHP Proxy Config") }}');
</script>
<script type="text/javascript">
$(function() {
$('[data-toggle=switch]').wrap('<div class="switch" />').parent().bootstrapSwitch();
});
</script>
<script type="text/javascript">
$('#enable-front-proxy').change(function() {
var isChecked = $(this).is(':checked');
if ( isChecked ) {
$('#front-proxy-options').slideDown();
} else {
$('#front-proxy-options').slideUp();
}
});
</script>
<script type="text/javascript">
$(function() {
$.ajax({
type: 'POST',
url: 'http://127.0.0.1:8083/config?cmd=get_config',
dataType: 'JSON',
success: function(result) {
$('#php-server').val(result['php_server']);
$('#php-password').val(result['php_password']);
if ( typeof(result['proxy_enable']) != 'undefined' && result['proxy_enable'] != 0 ) {
$('#enable-front-proxy').parent().removeClass('switch-off');
$('#enable-front-proxy').parent().addClass('switch-on');
$('#enable-front-proxy').prop('checked', true);
$('#front-proxy-options').slideDown();
}
$('#proxy-host').val(result['proxy_host']);
$('#proxy-port').val(result['proxy_port']);
$('#proxy-username').val(result['proxy_username']);
$('#proxy-password').val(result['proxy_password']);
},
error: function() {
tip('{{ _("PHP proxy is disabled. Please enable it in <a href=\"/?module=launcher&menu=config\">system settings</a>.") }}', 'warning');
}
});
});
</script>
<script type="text/javascript">
function onSubmit() {
var phpServer = $('#php-server').val(),
phpPassword = $('#php-password').val(),
enableFrontProxy = $('#enable-front-proxy').is(':checked') ? 1 : 0,
proxyHost = $('#proxy-host').val(),
proxyPort = $('#proxy-port').val(),
proxyUsername = $('#proxy-username').val(),
proxyPassword = $('#proxy-password').val();
return setConfig(phpServer, phpPassword, enableFrontProxy,
proxyHost, proxyPort, proxyUsername, proxyPassword);
}
</script>
<script type="text/javascript">
function setConfig(phpServer, phpPassword, enableFrontProxy,
proxyHost, proxyPort, proxyUsername, proxyPassword) {
var config = {
'php_server': phpServer,
'php_password': phpPassword,
'proxy_enable': enableFrontProxy,
'proxy_host': proxyHost,
'proxy_port': proxyPort,
'proxy_username': proxyUsername,
'proxy_password': proxyPassword
};
$.ajax({
type: 'POST',
url: 'http://127.0.0.1:8083/config?cmd=set_config',
data: config,
dataType: 'JSON',
success: function(result) {
if ( result['res'] == 'success' ) {
tip('{{ _("Settings saved.") }}', 'success');
} else {
tip('{{ _("Unknown error occurred.") }}', 'error');
}
},
error: function() {
tip('{{ _("PHP proxy is disabled. Please enable it in <a href=\"/?module=launcher&menu=config\">system settings</a>.") }}', 'warning');
}
});
}
</script>