Pavel Loginov 2021-03-03 19:47:42 +06:00
parent 797a13fa83
commit c433e2ed0a
10 changed files with 165 additions and 155 deletions

View File

@ -194,6 +194,8 @@ elif form.getvalue('mode') is not None:
acl_if_word = 'path_beg -i ' acl_if_word = 'path_beg -i '
elif a == '4': elif a == '4':
acl_if_word = 'path_end -i ' acl_if_word = 'path_end -i '
elif a == '6':
acl_if_word = 'src ip '
else: else:
acl_if_word = '' acl_if_word = ''
@ -207,6 +209,10 @@ elif form.getvalue('mode') is not None:
elif acl_then[i] == '4': elif acl_then[i] == '4':
acl += ' http-request deny' acl += ' http-request deny'
acl_then_value = '' 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' acl += acl_then_value + ' if { ' + acl_if_word + acl_value[i] + ' } \n'
except Exception: except Exception:

View File

@ -991,7 +991,7 @@ def update_db_v_5(**kwargs):
`type` VARCHAR ( 64 ), `type` VARCHAR ( 64 ),
`group` VARCHAR ( 64 ), `group` VARCHAR ( 64 ),
`key` VARCHAR ( 64 ), `key` VARCHAR ( 64 ),
`secret` VARCHAR ( 64 ), `secret` VARCHAR ( 64 ),
`create_date` DATETIME default '0000-00-00 00:00:00', `create_date` DATETIME default '0000-00-00 00:00:00',
`edit_date` DATETIME default '0000-00-00 00:00:00', `edit_date` DATETIME default '0000-00-00 00:00:00',
PRIMARY KEY(`id`) PRIMARY KEY(`id`)
@ -1053,7 +1053,7 @@ def update_db_v_51(**kwargs):
def update_ver(): def update_ver():
con, cur = get_cur() con, cur = get_cur()
sql = """update version set version = '5.0.0.0'; """ sql = """update version set version = '5.0.1.0'; """
try: try:
cur.execute(sql) cur.execute(sql)
con.commit() con.commit()

View File

@ -494,7 +494,7 @@ def show_installation_output(error, output, service):
print('error: '+error) print('error: '+error)
else: else:
for l in output: for l in output:
if "msg" in l or "FAILED" in l: if "FAILED" in l:
try: try:
l = l.split(':')[1] l = l.split(':')[1]
l = l.split('"')[1] l = l.split('"')[1]
@ -1232,4 +1232,4 @@ def get_services_status():
except Exception: except Exception:
services.append([s, status, v, '']) services.append([s, status, v, ''])
return services return services

View File

@ -13,7 +13,7 @@
'option smtpchk':'Check a SMTP service'} %} 'option smtpchk':'Check a SMTP service'} %}
{% set if_values = dict() %} {% 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> <script src="/inc/add.js"></script>
<div id="tabs"> <div id="tabs">
@ -121,20 +121,19 @@
<td class="addOption"> <td class="addOption">
<span title="Add ACL" id="add_listener_acl" class="link add-server"></span> <span title="Add ACL" id="add_listener_acl" class="link add-server"></span>
<div id="listener_acl" style="display: none;"> <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> <b class="padding10">if</b>
{{ select('listener_acl_if', name='acl_if', values=if_values, first='Choose if', class='force_close', disabled=false) }} {{ select('listener_acl_if', name='acl_if', values=if_values, first='Choose if', class='force_close', disabled=false) }}
<b class="padding10">value</b> <b class="padding10">value</b>
{{ input('listener_acl_value', name="acl_value") }} {{ input('listener_acl_value', name="acl_value") }}
<p style="border-bottom: 1px solid #ddd; padding-bottom: 10px;"> <b class="padding10">then</b>
<b class="padding10">then</b> {% set values = dict() %}
{% set values = dict() %} {% set values = {'2':'Redirect to','3':'Allow','4':'Deny', '6': 'Return', '7': 'Set-header'} %}
{% 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) }}
{{ select('listener_acl_then', name='acl_then', values=values, first='Choose action', class='force_close', disabled=false) }} <b class="padding10">value</b>
<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\'") }}
{{ input('listener_acl_then_value', name='acl_then_value', title="Required if \'then\' is \'Use backend\' or \'Redirect\'") }} <span class="minus minus-style" onclick="delete_acl_rule('listener_acl_rule')" title="Delete this rule"></span>
</p> </p>
</span>
</div> </div>
<span> <span>
<a class="link add-server" id="listener_add_acl" title="Add ACL" style="cursor: pointer; display: none;"></a> <a class="link add-server" id="listener_add_acl" title="Add ACL" style="cursor: pointer; display: none;"></a>
@ -261,9 +260,9 @@
</table> </table>
</form> </form>
</div> </div>
<!-- Second tabs --> <!-- Second tabs -->
<div id="frontend"> <div id="frontend">
<form name="add-frontend" id="add-frontend" action="/app/add.py" method="post"> <form name="add-frontend" id="add-frontend" action="/app/add.py" method="post">
<table> <table>
@ -335,20 +334,19 @@
<td class="addOption"> <td class="addOption">
<span title="Add ACL" id="add_frontend_acl" class="link add-server"></span> <span title="Add ACL" id="add_frontend_acl" class="link add-server"></span>
<div id="frontend_acl" style="display: none;"> <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> <b class="padding10">if</b>
{{ select('frontend_acl_if', name='acl_if', values=if_values, first='Choose if', class='force_close', disabled=false) }} {{ select('frontend_acl_if', name='acl_if', values=if_values, first='Choose if', class='force_close', disabled=false) }}
<b class="padding10">value</b> <b class="padding10">value</b>
{{ input('frontend_acl_value', name='acl_value') }} {{ input('frontend_acl_value', name='acl_value') }}
<p style="border-bottom: 1px solid #ddd; padding-bottom: 10px;"> <b class="padding10">then</b>
<b class="padding10">then</b> {% set values = dict() %}
{% set values = dict() %} {% set values = {'5':'Use backend','2':'Redirect to','3':'Allow','4':'Deny', '6': 'Return', '7': 'Set-header'} %}
{% 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) }}
{{ select('frontend_acl_then', name='acl_then', values=values, first='Choose action', class='force_close', disabled=false) }} <b class="padding10">value</b>
<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\'") }}
{{ input('frontend_acl_then_value', name='acl_then_value', title="Required if \'then\' is \'Use backend\' or \'Redirect\'") }} <span class="minus minus-style" onclick="delete_acl_rule('frontend_acl_rule')" title="Delete this rule"></span>
</p> </p>
</span>
</div> </div>
<span> <span>
<a class="link add-server" id="frontend_add_acl" title="Add ACL" style="cursor: pointer; display: none;"></a> <a class="link add-server" id="frontend_add_acl" title="Add ACL" style="cursor: pointer; display: none;"></a>
@ -432,9 +430,9 @@
</table> </table>
</form> </form>
</div> </div>
<!-- Third tabs --> <!-- Third tabs -->
<div id="backend"> <div id="backend">
<form name="add-backend" id="add-backend" action="/app/add.py" method="post"> <form name="add-backend" id="add-backend" action="/app/add.py" method="post">
<table> <table>
@ -505,20 +503,19 @@
<td class="addOption"> <td class="addOption">
<span title="Add ACL" id="add_backend_acl" class="link add-server"></span> <span title="Add ACL" id="add_backend_acl" class="link add-server"></span>
<div id="backend_acl" style="display: none;"> <div id="backend_acl" style="display: none;">
<span id="backend_acl_for_cloning"> <p id="backend_acl_rule" style="border-bottom: 1px solid #ddd; padding-bottom: 10px;">
<b class="padding10">if</b> <b class="padding10">if</b>
{{ select('backend_acl_if', name='acl_if', values=if_values, first='Choose if', class='force_close', disabled=false) }} {{ select('backend_acl_if', name='acl_if', values=if_values, first='Choose if', class='force_close', disabled=false) }}
<b class="padding10">value</b> <b class="padding10">value</b>
{{ input('backend_acl_value', name="acl_value") }} {{ input('backend_acl_value', name="acl_value") }}
<p style="border-bottom: 1px solid #ddd; padding-bottom: 10px;"> <b class="padding10">then</b>
<b class="padding10">then</b> {% set values = dict() %}
{% set values = dict() %} {% set values = {'2':'Redirect to','3':'Allow','4':'Deny', '6': 'Return', '7': 'Set-header'} %}
{% 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) }}
{{ select('backend_acl_then', name='acl_then', values=values, first='Choose action', class='force_close', disabled=false) }} <b class="padding10">value</b>
<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\'") }}
{{ input('backend_acl_then_value', name='acl_then_value', title="Required if \'then\' is \'Use backend\' or \'Redirect\'") }} <span class="minus minus-style" onclick="delete_acl_rule('backend_acl_rule')" title="Delete this rule"></span>
</p> </p>
</span>
</div> </div>
<span> <span>
<a class="link add-server" id="backend_add_acl" title="Add ACL" style="cursor: pointer; display: none;"></a> <a class="link add-server" id="backend_add_acl" title="Add ACL" style="cursor: pointer; display: none;"></a>
@ -629,7 +626,7 @@
</table> </table>
</form> </form>
</div> </div>
<div id="ssl"> <div id="ssl">
<table> <table>
<caption><h3>SSL</h3></caption> <caption><h3>SSL</h3></caption>
@ -647,7 +644,7 @@
<option value="{{ select.2 }}">{{ select.1 }}</option> <option value="{{ select.2 }}">{{ select.1 }}</option>
{% endfor %} {% endfor %}
</select> </select>
<button id="ssl_key_view" title="View certificates">View</button> <button id="ssl_key_view" title="View certificates">View</button>
</td> </td>
<td colspan="2"> <td colspan="2">
<span id="ajax-show-ssl"></span> <span id="ajax-show-ssl"></span>
@ -676,8 +673,8 @@
</td> </td>
<td style="padding-top: 15px; padding-bottom: 15px;"> <td style="padding-top: 15px; padding-bottom: 15px;">
<textarea id="ssl_cert" cols="50" rows="5"></textarea><br /><br /> <textarea id="ssl_cert" cols="50" rows="5"></textarea><br /><br />
<button id="ssl_key_upload" title="Upload ssl certificates">Upload</button> <button id="ssl_key_upload" title="Upload ssl certificates">Upload</button>
</td> </td>
</tr> </tr>
</table> </table>
<table> <table>
@ -724,11 +721,11 @@
<td></td> <td></td>
</tr> </tr>
{% for option in options %} {% 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' %} {% if option.2 == group or group == '1' %}
<td class="padding10 first-collumn"> <td class="padding10 first-collumn">
{{ option.0 }} {{ option.0 }}
</td> </td>
<td class="padding10 first-collumn" style="width: 77%;"> <td class="padding10 first-collumn" style="width: 77%;">
<input type="text" id="option-body-{{ option.0 }}" value="{{ option.1 }}" size="60" class="form-control"> <input type="text" id="option-body-{{ option.0 }}" value="{{ option.1 }}" size="60" class="form-control">
</td> </td>
@ -762,15 +759,15 @@
<div id="ajax-option"></div> <div id="ajax-option"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;"> <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 In this section you can create, edit and delete options with given parameters. And after use them as autocomplete in the "Add" sections
<br /> </div>
<br /> <div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
How to use pre saved option you can see in 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"> <a href="https://haproxy-wi.org/description.py?description=saved" title="How to use pre saved options" target="_blank">
<b>this video</b> <b>this video</b>
</a> </a>
</div> </div>
</div> </div>
<div id="add-servers"> <div id="add-servers">
<table class="overview" id="servers_table"> <table class="overview" id="servers_table">
<tr class="overviewHead"> <tr class="overviewHead">
@ -779,11 +776,11 @@
<td></td> <td></td>
</tr> </tr>
{% for s in saved_servers %} {% 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' %} {% if s.3 == group or group == '1' %}
<td class="padding10 first-collumn"> <td class="padding10 first-collumn">
<input type="text" id="servers-ip-{{ s.0 }}" value="{{ s.1 }}" size="15" class="form-control"> <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%;"> <td class="padding10 first-collumn" style="width: 77%;">
<input type="text" id="servers-desc-{{ s.0 }}" value="{{ s.2 }}" size="50" class="form-control"> <input type="text" id="servers-desc-{{ s.0 }}" value="{{ s.2 }}" size="50" class="form-control">
</td> </td>
@ -817,10 +814,10 @@
<div id="ajax-servers"></div> <div id="ajax-servers"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;"> <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 In this section you can create, edit and delete servers. And after use them as autocomplete in the "Add" sections
<br /> </div>
<br /> <div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
How to use pre saved servers you can see in 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"> <a href="https://haproxy-wi.org/description.py?description=saved" title="How to use pre saved servers" target="_blank">
<b>this video</b> <b>this video</b>
</a> </a>
</div> </div>
@ -856,7 +853,7 @@
<td class="addName">Groups:</td> <td class="addName">Groups:</td>
<td class="addOption"> <td class="addOption">
<span id="userlist-groups"> <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> <span>
<span class="add-server" id="add-userlist-group" title="Add extra group" style="cursor: pointer;"></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="addName">User:</td>
<td class="addOption"> <td class="addOption">
<span id="userlist-users"> <span id="userlist-users">
{{ input('userlist-user', required='required', title="User name", placeholder="user_name") }} {{ 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-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-group', title="User`s group", placeholder="user`s group") }}
</span> </span>
<span> <span>
<span class="add-server" id="add-userlist-user" title="Add extra user" style="cursor: pointer;"></span> <span class="add-server" id="add-userlist-user" title="Add extra user" style="cursor: pointer;"></span>
@ -890,14 +887,14 @@
</form> </form>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;"> <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 In this section you can create userlists. And after use them in the "Add" sections
<br /> </div>
<br /> <div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
How to use userlists you can read How to use userlists you can read
<a href="https://haproxy-wi.org/description.py?description=userlist" title="How to use userlists" target="_blank"> <a href="https://haproxy-wi.org/description.py?description=userlist" title="How to use userlists" target="_blank">
<b>here</b> <b>here</b>
</a> </a>
</div> </div>
</div> </div>
<div id="lists"> <div id="lists">
<table class="overview"> <table class="overview">
<tr class="overviewHead"> <tr class="overviewHead">
@ -916,7 +913,7 @@
<option value="all">ALL</option> <option value="all">ALL</option>
{% for select in selects %} {% for select in selects %}
<option value="{{ select.2 }}">{{ select.1 }}</option> <option value="{{ select.2 }}">{{ select.1 }}</option>
{% endfor %} {% endfor %}
</select> </select>
</td> </td>
<td style="width: 30%;"> <td style="width: 30%;">
@ -924,7 +921,7 @@
<a onclick="editList('{{ list }}', 'black')" style="cursor: pointer;" title="Edit list {{ list }}">{{ list }}</a> <a onclick="editList('{{ list }}', 'black')" style="cursor: pointer;" title="Edit list {{ list }}">{{ list }}</a>
{% endfor %} {% endfor %}
</td> </td>
</tr> </tr>
{{ input('group', value=group, type='hidden') }} {{ input('group', value=group, type='hidden') }}
</table> </table>
@ -945,7 +942,7 @@
<option value="all">ALL</option> <option value="all">ALL</option>
{% for select in selects %} {% for select in selects %}
<option value="{{ select.2 }}">{{ select.1 }}</option> <option value="{{ select.2 }}">{{ select.1 }}</option>
{% endfor %} {% endfor %}
</select> </select>
</td> </td>
<td style="width: 30%;"> <td style="width: 30%;">
@ -963,7 +960,7 @@
<div id="dialog-confirm-cert-edit" title="View certificate " style="display: none;"> <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> <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> <textarea id="edit_lists" style="width: 100%" rows=20></textarea>
</div> </div>
</div> </div>
{% include 'include/del_confirm.html' %} {% include 'include/del_confirm.html' %}
<div id="dialog-confirm-cert" title="View certificate " style="display: none;"> <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'); var serv_ports = $('.send_proxy');
console.log(serv_ports)
for (var i = 0; i <= serv_ports.length; i++) { for (var i = 0; i <= serv_ports.length; i++) {
var uniqId = makeid(3); var uniqId = makeid(3);

View File

@ -215,7 +215,7 @@
</div> </div>
<div id="show-updates" style="display: none;"> <div id="show-updates" style="display: none;">
<div> <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> </div>
<div class="footer"> <div class="footer">

View File

@ -72,7 +72,7 @@
{% endif %} {% endif %}
</p> </p>
</form> </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 %}
{% endif %} {% endif %}
</center> </center>
@ -87,15 +87,17 @@
showConfig(); showConfig();
} }
if (cur_url[1].split('&')[0] == 'service=haproxy' || cur_url[1].split('&')[0] == 'service=None') { 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 { } 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> </script>
<style> <style>
.CodeMirror { .CodeMirror {
line-height: 1.2em; line-height: 1.2em;
height: 60%; height: 70%;
} }
</style> </style>
<script> <script>

View File

@ -33,7 +33,7 @@
<option disabled selected>Choose log</option> <option disabled selected>Choose log</option>
{% for select in selects %} {% for select in selects %}
{% if page == 'for_editor' %} {% 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() %} {% if select.0|int() == serv|int() %}
<option value="{{ select.0 }}" selected>{{ select.1 }}</option> <option value="{{ select.0 }}" selected>{{ select.1 }}</option>
{% else %} {% else %}

View File

@ -23,24 +23,20 @@
<ul id='browse_histroy'></ul> <ul id='browse_histroy'></ul>
<div id="users"> <div id="users">
{% include 'include/admin_users.html' %} {% include 'include/admin_users.html' %}
{% include 'include/servers_group_error.html' %}
</div> </div>
<div id="servers"> <div id="servers">
{% include 'include/admin_servers.html' %} {% include 'include/admin_servers.html' %}
{% include 'include/servers_group_error.html' %}
</div> </div>
<div id="ssh"> <div id="ssh">
{% include 'include/admin_ssh.html' %} {% include 'include/admin_ssh.html' %}
{% include 'include/servers_group_error.html' %}
</div> </div>
<div id="checker"></div> <div id="checker"></div>
<div id="settings"> <div id="settings">
{% include 'include/admin_settings.html' %} {% include 'include/admin_settings.html' %}
{% include 'include/servers_group_error.html' %}
</div> </div>
<div id="installproxy"> <div id="installproxy">
@ -167,39 +163,11 @@
<div id="backup"> <div id="backup">
{% include 'include/admin_backup.html' %} {% include 'include/admin_backup.html' %}
{% include 'include/servers_group_error.html' %}
</div> </div>
</div> </div>
{% include 'include/admins_dialogs.html' %} {% include 'include/admins_dialogs.html' %}
{% include 'include/change_pass_form.html' %} {% include 'include/change_pass_form.html' %}
<script> <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() { $( function() {
{% for user in users %} {% for user in users %}
$("#role-{{user.0}}" ).selectmenu({ $("#role-{{user.0}}" ).selectmenu({

View File

@ -1097,45 +1097,15 @@ $( function() {
$( "#backend_add_acl" ).show(); $( "#backend_add_acl" ).show();
$( "#add_backend_acl" ).hide(); $( "#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_add_acl").click(function(){
$("#listener_acl").append(acl_option); make_actions_for_adding_acl_rule('#listener_acl');
$("#listener_acl").find('option[value=5]').remove(); $("#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_add_acl").click(function(){
$("#frontend_acl").append(acl_option); make_actions_for_adding_acl_rule('#frontend_acl');
$( "select" ).selectmenu();
$('[name=acl_if]').selectmenu({width: 180});
$('[name=acl_then]').selectmenu({width: 180});
}); });
$("#backend_add_acl").click(function(){ $("#backend_add_acl").click(function(){
$("#backend_acl").append(acl_option); make_actions_for_adding_acl_rule('#backend_acl');
$( "select" ).selectmenu();
$('[name=acl_if]').selectmenu({width: 180});
$('[name=acl_then]').selectmenu({width: 180});
}); });
}); });
function resetProxySettings() { function resetProxySettings() {
@ -1324,6 +1294,10 @@ function view_ssl(id) {
buttons: { buttons: {
Close: function() { Close: function() {
$( this ).dialog( "close" ); $( 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) { function change_select_acceleration(id) {
$.ajax( { $.ajax( {
url: "options.py", 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;
} }

View File

@ -954,6 +954,9 @@ label {
background-color: grey; background-color: grey;
color: #aaa; color: #aaa;
} }
.minus-style {
cursor: pointer;
}
@media (max-width: 1920px) { @media (max-width: 1920px) {
#logo_span { #logo_span {
margin-left: 17%; margin-left: 17%;