mirror of https://github.com/Aidaho12/haproxy-wi
parent
797a13fa83
commit
c433e2ed0a
|
@ -194,6 +194,8 @@ elif form.getvalue('mode') is not None:
|
|||
acl_if_word = 'path_beg -i '
|
||||
elif a == '4':
|
||||
acl_if_word = 'path_end -i '
|
||||
elif a == '6':
|
||||
acl_if_word = 'src ip '
|
||||
else:
|
||||
acl_if_word = ''
|
||||
|
||||
|
@ -207,6 +209,10 @@ elif form.getvalue('mode') is not None:
|
|||
elif acl_then[i] == '4':
|
||||
acl += ' http-request deny'
|
||||
acl_then_value = ''
|
||||
elif acl_then[i] == '6':
|
||||
acl += ' return '
|
||||
elif acl_then[i] == '7':
|
||||
acl += ' set-header '
|
||||
|
||||
acl += acl_then_value + ' if { ' + acl_if_word + acl_value[i] + ' } \n'
|
||||
except Exception:
|
||||
|
|
|
@ -991,7 +991,7 @@ def update_db_v_5(**kwargs):
|
|||
`type` VARCHAR ( 64 ),
|
||||
`group` VARCHAR ( 64 ),
|
||||
`key` VARCHAR ( 64 ),
|
||||
`secret` VARCHAR ( 64 ),
|
||||
`secret` VARCHAR ( 64 ),
|
||||
`create_date` DATETIME default '0000-00-00 00:00:00',
|
||||
`edit_date` DATETIME default '0000-00-00 00:00:00',
|
||||
PRIMARY KEY(`id`)
|
||||
|
@ -1053,7 +1053,7 @@ def update_db_v_51(**kwargs):
|
|||
|
||||
def update_ver():
|
||||
con, cur = get_cur()
|
||||
sql = """update version set version = '5.0.0.0'; """
|
||||
sql = """update version set version = '5.0.1.0'; """
|
||||
try:
|
||||
cur.execute(sql)
|
||||
con.commit()
|
||||
|
|
|
@ -494,7 +494,7 @@ def show_installation_output(error, output, service):
|
|||
print('error: '+error)
|
||||
else:
|
||||
for l in output:
|
||||
if "msg" in l or "FAILED" in l:
|
||||
if "FAILED" in l:
|
||||
try:
|
||||
l = l.split(':')[1]
|
||||
l = l.split('"')[1]
|
||||
|
@ -1232,4 +1232,4 @@ def get_services_status():
|
|||
except Exception:
|
||||
services.append([s, status, v, ''])
|
||||
|
||||
return services
|
||||
return services
|
|
@ -13,7 +13,7 @@
|
|||
'option smtpchk':'Check a SMTP service'} %}
|
||||
|
||||
{% set if_values = dict() %}
|
||||
{% set if_values = {'1':'Host name starts with','2':'Host name ends with','3':'Path starts with','4':'Path ends with'} %}
|
||||
{% set if_values = {'1':'Host name starts with','2':'Host name ends with','3':'Path starts with','4':'Path ends with', '6': 'Src ip'} %}
|
||||
|
||||
<script src="/inc/add.js"></script>
|
||||
<div id="tabs">
|
||||
|
@ -121,20 +121,19 @@
|
|||
<td class="addOption">
|
||||
<span title="Add ACL" id="add_listener_acl" class="link add-server"></span>
|
||||
<div id="listener_acl" style="display: none;">
|
||||
<span id="listener_acl_for_cloning">
|
||||
<p style="border-bottom: 1px solid #ddd; padding-bottom: 10px;" id="listener_acl_rule">
|
||||
<b class="padding10">if</b>
|
||||
{{ select('listener_acl_if', name='acl_if', values=if_values, first='Choose if', class='force_close', disabled=false) }}
|
||||
<b class="padding10">value</b>
|
||||
{{ input('listener_acl_value', name="acl_value") }}
|
||||
<p style="border-bottom: 1px solid #ddd; padding-bottom: 10px;">
|
||||
<b class="padding10">then</b>
|
||||
{% set values = dict() %}
|
||||
{% set values = {'2':'Redirect to','3':'Allow','4':'Deny'} %}
|
||||
{{ select('listener_acl_then', name='acl_then', values=values, first='Choose action', class='force_close', disabled=false) }}
|
||||
<b class="padding10">value</b>
|
||||
{{ input('listener_acl_then_value', name='acl_then_value', title="Required if \'then\' is \'Use backend\' or \'Redirect\'") }}
|
||||
</p>
|
||||
</span>
|
||||
<b class="padding10">then</b>
|
||||
{% set values = dict() %}
|
||||
{% set values = {'2':'Redirect to','3':'Allow','4':'Deny', '6': 'Return', '7': 'Set-header'} %}
|
||||
{{ select('listener_acl_then', name='acl_then', values=values, first='Choose action', class='force_close', disabled=false) }}
|
||||
<b class="padding10">value</b>
|
||||
{{ input('listener_acl_then_value', name='acl_then_value', title="Required if \'then\' is \'Use backend\' or \'Redirect\', \'Return\', or \'Set-header\'") }}
|
||||
<span class="minus minus-style" onclick="delete_acl_rule('listener_acl_rule')" title="Delete this rule"></span>
|
||||
</p>
|
||||
</div>
|
||||
<span>
|
||||
<a class="link add-server" id="listener_add_acl" title="Add ACL" style="cursor: pointer; display: none;"></a>
|
||||
|
@ -261,9 +260,9 @@
|
|||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Second tabs -->
|
||||
|
||||
|
||||
<div id="frontend">
|
||||
<form name="add-frontend" id="add-frontend" action="/app/add.py" method="post">
|
||||
<table>
|
||||
|
@ -335,20 +334,19 @@
|
|||
<td class="addOption">
|
||||
<span title="Add ACL" id="add_frontend_acl" class="link add-server"></span>
|
||||
<div id="frontend_acl" style="display: none;">
|
||||
<span id="frontend_acl_for_cloning">
|
||||
<p id="frontend_acl_rule" style="border-bottom: 1px solid #ddd; padding-bottom: 10px;">
|
||||
<b class="padding10">if</b>
|
||||
{{ select('frontend_acl_if', name='acl_if', values=if_values, first='Choose if', class='force_close', disabled=false) }}
|
||||
<b class="padding10">value</b>
|
||||
{{ input('frontend_acl_value', name='acl_value') }}
|
||||
<p style="border-bottom: 1px solid #ddd; padding-bottom: 10px;">
|
||||
<b class="padding10">then</b>
|
||||
{% set values = dict() %}
|
||||
{% set values = {'5':'Use backend','2':'Redirect to','3':'Allow','4':'Deny'} %}
|
||||
{{ select('frontend_acl_then', name='acl_then', values=values, first='Choose action', class='force_close', disabled=false) }}
|
||||
<b class="padding10">value</b>
|
||||
{{ input('frontend_acl_then_value', name='acl_then_value', title="Required if \'then\' is \'Use backend\' or \'Redirect\'") }}
|
||||
</p>
|
||||
</span>
|
||||
<b class="padding10">then</b>
|
||||
{% set values = dict() %}
|
||||
{% set values = {'5':'Use backend','2':'Redirect to','3':'Allow','4':'Deny', '6': 'Return', '7': 'Set-header'} %}
|
||||
{{ select('frontend_acl_then', name='acl_then', values=values, first='Choose action', class='force_close', disabled=false) }}
|
||||
<b class="padding10">value</b>
|
||||
{{ input('frontend_acl_then_value', name='acl_then_value', title="Required if \'then\' is \'Use backend\' or \'Redirect\', \'Return\', or \'Set-header\'") }}
|
||||
<span class="minus minus-style" onclick="delete_acl_rule('frontend_acl_rule')" title="Delete this rule"></span>
|
||||
</p>
|
||||
</div>
|
||||
<span>
|
||||
<a class="link add-server" id="frontend_add_acl" title="Add ACL" style="cursor: pointer; display: none;"></a>
|
||||
|
@ -432,9 +430,9 @@
|
|||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Third tabs -->
|
||||
|
||||
|
||||
<div id="backend">
|
||||
<form name="add-backend" id="add-backend" action="/app/add.py" method="post">
|
||||
<table>
|
||||
|
@ -505,20 +503,19 @@
|
|||
<td class="addOption">
|
||||
<span title="Add ACL" id="add_backend_acl" class="link add-server"></span>
|
||||
<div id="backend_acl" style="display: none;">
|
||||
<span id="backend_acl_for_cloning">
|
||||
<b class="padding10">if</b>
|
||||
{{ select('backend_acl_if', name='acl_if', values=if_values, first='Choose if', class='force_close', disabled=false) }}
|
||||
<b class="padding10">value</b>
|
||||
{{ input('backend_acl_value', name="acl_value") }}
|
||||
<p style="border-bottom: 1px solid #ddd; padding-bottom: 10px;">
|
||||
<b class="padding10">then</b>
|
||||
{% set values = dict() %}
|
||||
{% set values = {'2':'Redirect to','3':'Allow','4':'Deny'} %}
|
||||
{{ select('backend_acl_then', name='acl_then', values=values, first='Choose action', class='force_close', disabled=false) }}
|
||||
<b class="padding10">value</b>
|
||||
{{ input('backend_acl_then_value', name='acl_then_value', title="Required if \'then\' is \'Use backend\' or \'Redirect\'") }}
|
||||
</p>
|
||||
</span>
|
||||
<p id="backend_acl_rule" style="border-bottom: 1px solid #ddd; padding-bottom: 10px;">
|
||||
<b class="padding10">if</b>
|
||||
{{ select('backend_acl_if', name='acl_if', values=if_values, first='Choose if', class='force_close', disabled=false) }}
|
||||
<b class="padding10">value</b>
|
||||
{{ input('backend_acl_value', name="acl_value") }}
|
||||
<b class="padding10">then</b>
|
||||
{% set values = dict() %}
|
||||
{% set values = {'2':'Redirect to','3':'Allow','4':'Deny', '6': 'Return', '7': 'Set-header'} %}
|
||||
{{ select('backend_acl_then', name='acl_then', values=values, first='Choose action', class='force_close', disabled=false) }}
|
||||
<b class="padding10">value</b>
|
||||
{{ input('backend_acl_then_value', name='acl_then_value', title="Required if \'then\' is \'Use backend\', \'Redirect\', \'Return\', or \'Set-header\'") }}
|
||||
<span class="minus minus-style" onclick="delete_acl_rule('backend_acl_rule')" title="Delete this rule"></span>
|
||||
</p>
|
||||
</div>
|
||||
<span>
|
||||
<a class="link add-server" id="backend_add_acl" title="Add ACL" style="cursor: pointer; display: none;"></a>
|
||||
|
@ -629,7 +626,7 @@
|
|||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="ssl">
|
||||
<table>
|
||||
<caption><h3>SSL</h3></caption>
|
||||
|
@ -647,7 +644,7 @@
|
|||
<option value="{{ select.2 }}">{{ select.1 }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<button id="ssl_key_view" title="View certificates">View</button>
|
||||
<button id="ssl_key_view" title="View certificates">View</button>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<span id="ajax-show-ssl"></span>
|
||||
|
@ -676,8 +673,8 @@
|
|||
</td>
|
||||
<td style="padding-top: 15px; padding-bottom: 15px;">
|
||||
<textarea id="ssl_cert" cols="50" rows="5"></textarea><br /><br />
|
||||
<button id="ssl_key_upload" title="Upload ssl certificates">Upload</button>
|
||||
</td>
|
||||
<button id="ssl_key_upload" title="Upload ssl certificates">Upload</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
|
@ -724,11 +721,11 @@
|
|||
<td></td>
|
||||
</tr>
|
||||
{% for option in options %}
|
||||
<tr id="option-{{ option.0 }}" class="{{ loop.cycle('odd', 'even') }}">
|
||||
<tr id="option-{{ option.0 }}" class="{{ loop.cycle('odd', 'even') }}">
|
||||
{% if option.2 == group or group == '1' %}
|
||||
<td class="padding10 first-collumn">
|
||||
{{ option.0 }}
|
||||
</td>
|
||||
</td>
|
||||
<td class="padding10 first-collumn" style="width: 77%;">
|
||||
<input type="text" id="option-body-{{ option.0 }}" value="{{ option.1 }}" size="60" class="form-control">
|
||||
</td>
|
||||
|
@ -762,15 +759,15 @@
|
|||
<div id="ajax-option"></div>
|
||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||
In this section you can create, edit and delete options with given parameters. And after use them as autocomplete in the "Add" sections
|
||||
<br />
|
||||
<br />
|
||||
How to use pre saved option you can see in
|
||||
<a href="https://haproxy-wi.org/description.py?description=saved" title="How to use pre saved options" target="_blank">
|
||||
</div>
|
||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||
How to use pre saved option you can see in
|
||||
<a href="https://haproxy-wi.org/description.py?description=saved" title="How to use pre saved options" target="_blank">
|
||||
<b>this video</b>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="add-servers">
|
||||
<table class="overview" id="servers_table">
|
||||
<tr class="overviewHead">
|
||||
|
@ -779,11 +776,11 @@
|
|||
<td></td>
|
||||
</tr>
|
||||
{% for s in saved_servers %}
|
||||
<tr id="servers-saved-{{ s.0 }}" class="{{ loop.cycle('odd', 'even') }}">
|
||||
<tr id="servers-saved-{{ s.0 }}" class="{{ loop.cycle('odd', 'even') }}">
|
||||
{% if s.3 == group or group == '1' %}
|
||||
<td class="padding10 first-collumn">
|
||||
<input type="text" id="servers-ip-{{ s.0 }}" value="{{ s.1 }}" size="15" class="form-control">
|
||||
</td>
|
||||
</td>
|
||||
<td class="padding10 first-collumn" style="width: 77%;">
|
||||
<input type="text" id="servers-desc-{{ s.0 }}" value="{{ s.2 }}" size="50" class="form-control">
|
||||
</td>
|
||||
|
@ -817,10 +814,10 @@
|
|||
<div id="ajax-servers"></div>
|
||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||
In this section you can create, edit and delete servers. And after use them as autocomplete in the "Add" sections
|
||||
<br />
|
||||
<br />
|
||||
How to use pre saved servers you can see in
|
||||
<a href="https://haproxy-wi.org/description.py?description=saved" title="How to use pre saved servers" target="_blank">
|
||||
</div>
|
||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||
How to use pre saved servers you can see in
|
||||
<a href="https://haproxy-wi.org/description.py?description=saved" title="How to use pre saved servers" target="_blank">
|
||||
<b>this video</b>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -856,7 +853,7 @@
|
|||
<td class="addName">Groups:</td>
|
||||
<td class="addOption">
|
||||
<span id="userlist-groups">
|
||||
{{ input('userlist-group', title="User`s group", placeholder="group_name") }}
|
||||
{{ input('userlist-group', title="User`s group", placeholder="group_name") }}
|
||||
</span>
|
||||
<span>
|
||||
<span class="add-server" id="add-userlist-group" title="Add extra group" style="cursor: pointer;"></span>
|
||||
|
@ -868,9 +865,9 @@
|
|||
<td class="addName">User:</td>
|
||||
<td class="addOption">
|
||||
<span id="userlist-users">
|
||||
{{ input('userlist-user', required='required', title="User name", placeholder="user_name") }}
|
||||
{{ input('userlist-password', required='required', title="User password. By default it insecure-password", placeholder="password") }}
|
||||
{{ input('userlist-user-group', title="User`s group", placeholder="user`s group") }}
|
||||
{{ input('userlist-user', required='required', title="User name", placeholder="user_name") }}
|
||||
{{ input('userlist-password', required='required', title="User password. By default it insecure-password", placeholder="password") }}
|
||||
{{ input('userlist-user-group', title="User`s group", placeholder="user`s group") }}
|
||||
</span>
|
||||
<span>
|
||||
<span class="add-server" id="add-userlist-user" title="Add extra user" style="cursor: pointer;"></span>
|
||||
|
@ -890,14 +887,14 @@
|
|||
</form>
|
||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||
In this section you can create userlists. And after use them in the "Add" sections
|
||||
<br />
|
||||
<br />
|
||||
How to use userlists you can read
|
||||
<a href="https://haproxy-wi.org/description.py?description=userlist" title="How to use userlists" target="_blank">
|
||||
</div>
|
||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||
How to use userlists you can read
|
||||
<a href="https://haproxy-wi.org/description.py?description=userlist" title="How to use userlists" target="_blank">
|
||||
<b>here</b>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="lists">
|
||||
<table class="overview">
|
||||
<tr class="overviewHead">
|
||||
|
@ -916,7 +913,7 @@
|
|||
<option value="all">ALL</option>
|
||||
{% for select in selects %}
|
||||
<option value="{{ select.2 }}">{{ select.1 }}</option>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
<td style="width: 30%;">
|
||||
|
@ -924,7 +921,7 @@
|
|||
<a onclick="editList('{{ list }}', 'black')" style="cursor: pointer;" title="Edit list {{ list }}">{{ list }}</a>
|
||||
{% endfor %}
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
{{ input('group', value=group, type='hidden') }}
|
||||
</table>
|
||||
|
@ -945,7 +942,7 @@
|
|||
<option value="all">ALL</option>
|
||||
{% for select in selects %}
|
||||
<option value="{{ select.2 }}">{{ select.1 }}</option>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
<td style="width: 30%;">
|
||||
|
@ -963,7 +960,7 @@
|
|||
<div id="dialog-confirm-cert-edit" title="View certificate " style="display: none;">
|
||||
<span><b>Note:</b> Each new address must be specified from a new line</span>
|
||||
<textarea id="edit_lists" style="width: 100%" rows=20></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'include/del_confirm.html' %}
|
||||
<div id="dialog-confirm-cert" title="View certificate " style="display: none;">
|
||||
|
@ -984,17 +981,7 @@ $( function() {
|
|||
});
|
||||
}
|
||||
});
|
||||
function makeid(length) {
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for ( var i = 0; i < length; i++ ) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
var serv_ports = $('.send_proxy');
|
||||
console.log(serv_ports)
|
||||
|
||||
for (var i = 0; i <= serv_ports.length; i++) {
|
||||
var uniqId = makeid(3);
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
</div>
|
||||
<div id="show-updates" style="display: none;">
|
||||
<div>
|
||||
There is a new version HAProxy-WI. Check the <a href="/app/users.py#updatehapwi">Update page</a>
|
||||
There is a new version HAProxy-WI. Check the <a href="/app/users.py#updatehapwi" class="link">Update page</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
{% endif %}
|
||||
</p>
|
||||
</form>
|
||||
<div class="alert alert-info"><b>Note:</b> When reconfiguring the master server, the slave will be reconfigured automatically</div>
|
||||
<div class="alert alert-info alert-two-rows"><b>Note:</b> When reconfiguring the master server, the slave will be reconfigured automatically</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</center>
|
||||
|
@ -87,15 +87,17 @@
|
|||
showConfig();
|
||||
}
|
||||
if (cur_url[1].split('&')[0] == 'service=haproxy' || cur_url[1].split('&')[0] == 'service=None') {
|
||||
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("config_text_area"), {mode: "haproxy", lineNumbers: true});
|
||||
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("config_text_area"),
|
||||
{mode: "haproxy", lineNumbers: true, autocapitalize: true, autocorrect: true, spellcheck: true});
|
||||
} else {
|
||||
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("config_text_area"), {mode: "nginx", lineNumbers: true});
|
||||
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById("config_text_area"),
|
||||
{mode: "nginx", lineNumbers: true, autocapitalize: true, autocorrect: true, spellcheck: true});
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.CodeMirror {
|
||||
line-height: 1.2em;
|
||||
height: 60%;
|
||||
line-height: 1.2em;
|
||||
height: 70%;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<option disabled selected>Choose log</option>
|
||||
{% for select in selects %}
|
||||
{% if page == 'for_editor' %}
|
||||
{% if select.1.startswith('haproxy-wi') or select.1.startswith('config_edit') %}
|
||||
{% if select.1.startswith('haproxy-wi') or select.1.startswith('config_edit') or select.1.startswith('port_sca') %}
|
||||
{% if select.0|int() == serv|int() %}
|
||||
<option value="{{ select.0 }}" selected>{{ select.1 }}</option>
|
||||
{% else %}
|
||||
|
|
|
@ -23,24 +23,20 @@
|
|||
<ul id='browse_histroy'></ul>
|
||||
<div id="users">
|
||||
{% include 'include/admin_users.html' %}
|
||||
{% include 'include/servers_group_error.html' %}
|
||||
</div>
|
||||
|
||||
<div id="servers">
|
||||
{% include 'include/admin_servers.html' %}
|
||||
{% include 'include/servers_group_error.html' %}
|
||||
</div>
|
||||
|
||||
<div id="ssh">
|
||||
{% include 'include/admin_ssh.html' %}
|
||||
{% include 'include/servers_group_error.html' %}
|
||||
</div>
|
||||
|
||||
<div id="checker"></div>
|
||||
|
||||
<div id="settings">
|
||||
{% include 'include/admin_settings.html' %}
|
||||
{% include 'include/servers_group_error.html' %}
|
||||
</div>
|
||||
|
||||
<div id="installproxy">
|
||||
|
@ -167,39 +163,11 @@
|
|||
|
||||
<div id="backup">
|
||||
{% include 'include/admin_backup.html' %}
|
||||
{% include 'include/servers_group_error.html' %}
|
||||
</div>
|
||||
</div>
|
||||
{% include 'include/admins_dialogs.html' %}
|
||||
{% include 'include/change_pass_form.html' %}
|
||||
<script>
|
||||
if($('#new-server-group-add').val() == 1) {
|
||||
$('.group_error').css('display', 'block');
|
||||
$('#add-user-button').css('display', 'none');
|
||||
$('#add-server-button').css('display', 'none');
|
||||
$('.passwordChange').css('display', 'none');
|
||||
$('#add-ssh-button').css('display', 'none');
|
||||
$('#ssh_key_upload').css('display', 'none');
|
||||
$('#add-telegram-button').css('display', 'none');
|
||||
$('input').css('color', 'rgba(0, 0, 0, 0.3)');
|
||||
setTimeout(function() {
|
||||
$("input[type=checkbox]").checkboxradio( "disable" );
|
||||
$("select").selectmenu( "disable" );
|
||||
$("button").button( "disable" );
|
||||
$("input").attr( "readonly", "readonly" );
|
||||
$('.delete').remove()
|
||||
$('#hapver').selectmenu('enable');
|
||||
$('#haproxyaddserv').selectmenu('enable');
|
||||
$('#nginxaddserv').selectmenu('enable');
|
||||
$('#haproxy_exp_addserv').selectmenu('enable');
|
||||
$('#nginx_exp_addserv').selectmenu('enable');
|
||||
$('#geoipserv').selectmenu('enable');
|
||||
$('#syn_flood').checkboxradio('enable');
|
||||
$('#nginx_syn_flood').checkboxradio('enable');
|
||||
$('#updating_geoip').checkboxradio('enable');
|
||||
}, 500 );
|
||||
|
||||
}
|
||||
$( function() {
|
||||
{% for user in users %}
|
||||
$("#role-{{user.0}}" ).selectmenu({
|
||||
|
|
110
inc/add.js
110
inc/add.js
|
@ -1097,45 +1097,15 @@ $( function() {
|
|||
$( "#backend_add_acl" ).show();
|
||||
$( "#add_backend_acl" ).hide();
|
||||
} );
|
||||
var acl_option = '<b class="padding10">if</b>\n' +
|
||||
'<select name="acl_if">\n' +
|
||||
'\t<option selected>Choose if</option>\n' +
|
||||
'\t<option value="1">Host name starts with</option>\n' +
|
||||
'\t<option value="2">Host name ends with</option>\n' +
|
||||
'\t<option value="3">Path starts with</option>\n' +
|
||||
'\t<option value="4">Path ends with</option>\n' +
|
||||
'</select>' +
|
||||
'<b class="padding10">value</b>\n' +
|
||||
'<input type="text" name="acl_value" class="form-control">\n' +
|
||||
'<p style="border-bottom: 1px solid #ddd; padding-bottom: 10px;">\n' +
|
||||
'<b class="padding10">then</b>\n' +
|
||||
'<select name="acl_then">\n' +
|
||||
'\t<option selected>Choose then</option>\n' +
|
||||
'\t<option value="5">Use backend</option>\n' +
|
||||
'\t<option value="2">Redirect to</option>\n' +
|
||||
'\t<option value="3">Allow</option>\n' +
|
||||
'\t<option value="4">Deny</option>\n' +
|
||||
'</select>\n' +
|
||||
'<b class="padding10">value</b>\n' +
|
||||
'<input type="text" name="acl_then_value" class="form-control" value="" title="Required if \"then\" is \"Use backend\" or \"Redirect\""></p>'
|
||||
$("#listener_add_acl").click(function(){
|
||||
$("#listener_acl").append(acl_option);
|
||||
make_actions_for_adding_acl_rule('#listener_acl');
|
||||
$("#listener_acl").find('option[value=5]').remove();
|
||||
$( "select" ).selectmenu();
|
||||
$('[name=acl_if]').selectmenu({width: 180});
|
||||
$('[name=acl_then]').selectmenu({width: 180});
|
||||
});
|
||||
$("#frontend_add_acl").click(function(){
|
||||
$("#frontend_acl").append(acl_option);
|
||||
$( "select" ).selectmenu();
|
||||
$('[name=acl_if]').selectmenu({width: 180});
|
||||
$('[name=acl_then]').selectmenu({width: 180});
|
||||
make_actions_for_adding_acl_rule('#frontend_acl');
|
||||
});
|
||||
$("#backend_add_acl").click(function(){
|
||||
$("#backend_acl").append(acl_option);
|
||||
$( "select" ).selectmenu();
|
||||
$('[name=acl_if]').selectmenu({width: 180});
|
||||
$('[name=acl_then]').selectmenu({width: 180});
|
||||
make_actions_for_adding_acl_rule('#backend_acl');
|
||||
});
|
||||
});
|
||||
function resetProxySettings() {
|
||||
|
@ -1324,6 +1294,10 @@ function view_ssl(id) {
|
|||
buttons: {
|
||||
Close: function() {
|
||||
$( this ).dialog( "close" );
|
||||
},
|
||||
Delete: function () {
|
||||
$( this ).dialog( "close" );
|
||||
confirmDeleting("SSL cert", id, $( this ), "");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1331,6 +1305,26 @@ function view_ssl(id) {
|
|||
}
|
||||
} );
|
||||
}
|
||||
function deleteSsl(id) {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
serv: $('#serv5').val(),
|
||||
delcert: id,
|
||||
token: $('#token').val()
|
||||
},
|
||||
type: "POST",
|
||||
success: function( data ) {
|
||||
if (data.indexOf('error: ') != '-1') {
|
||||
toastr.error(data);
|
||||
} else {
|
||||
toastr.clear();
|
||||
toastr.success('SSL cert ' + id + ' has been deleted');
|
||||
$("#ssl_key_view").trigger( "click" );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
function change_select_acceleration(id) {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
|
@ -1607,4 +1601,54 @@ function confirmDeleting(deleting_thing, id, dialog_id, color) {
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function delete_acl_rule(id) {
|
||||
$('#'+id).remove();
|
||||
}
|
||||
var acl_option = '<p id="new_acl_p" style="border-bottom: 1px solid #ddd; padding-bottom: 10px;">\n' +
|
||||
'<b class="padding10">if</b>\n' +
|
||||
'<select name="acl_if">\n' +
|
||||
'\t<option selected>Choose if</option>\n' +
|
||||
'\t<option value="1">Host name starts with</option>\n' +
|
||||
'\t<option value="2">Host name ends with</option>\n' +
|
||||
'\t<option value="3">Path starts with</option>\n' +
|
||||
'\t<option value="4">Path ends with</option>\n' +
|
||||
'\t<option value="6">Src ip</option>\n' +
|
||||
'</select> ' +
|
||||
'<b class="padding10">value</b>\n' +
|
||||
'<input type="text" name="acl_value" class="form-control">\n' +
|
||||
'<b class="padding10">then</b>\n' +
|
||||
'<select name="acl_then">\n' +
|
||||
'\t<option selected>Choose then</option>\n' +
|
||||
'\t<option value="5">Use backend</option>\n' +
|
||||
'\t<option value="2">Redirect to</option>\n' +
|
||||
'\t<option value="3">Allow</option>\n' +
|
||||
'\t<option value="4">Deny</option>\n' +
|
||||
'\t<option value="6">Return</option>\n' +
|
||||
'\t<option value="7">Set-header</option>\n' +
|
||||
'</select>\n' +
|
||||
'<b class="padding10">value</b>\n' +
|
||||
'<input type="text" name="acl_then_value" class="form-control" value="" title="Required if \"then\" is \"Use backend\" or \"Redirect\"">\n' +
|
||||
'<span class="minus minus-style" id="new_acl_rule_minus" title="Delete this ACL"></span>' +
|
||||
'</p>'
|
||||
function make_actions_for_adding_acl_rule(section_id) {
|
||||
var random_id = makeid(3);
|
||||
$(section_id).append(acl_option);
|
||||
$('#new_acl_rule_minus').attr('onclick', 'delete_acl_rule(\''+random_id+'\')');
|
||||
$('#new_acl_rule_minus').attr('id', '');
|
||||
$('#new_acl_p').attr('id', random_id);
|
||||
$('#new_acl_rule_minus').attr('id', '');
|
||||
$.getScript("/inc/fontawesome.min.js");
|
||||
$( "select" ).selectmenu();
|
||||
$('[name=acl_if]').selectmenu({width: 180});
|
||||
$('[name=acl_then]').selectmenu({width: 180});
|
||||
}
|
||||
function makeid(length) {
|
||||
var result = '';
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for ( var i = 0; i < length; i++ ) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
}
|
|
@ -954,6 +954,9 @@ label {
|
|||
background-color: grey;
|
||||
color: #aaa;
|
||||
}
|
||||
.minus-style {
|
||||
cursor: pointer;
|
||||
}
|
||||
@media (max-width: 1920px) {
|
||||
#logo_span {
|
||||
margin-left: 17%;
|
||||
|
|
Loading…
Reference in New Issue