Browse Source

v3.8.1

pull/189/head
Pavel Loginov 5 years ago
parent
commit
cf7e15f00b
  1. 2
      README.md
  2. 6
      app/create_db.py
  3. 3
      app/funct.py
  4. 3
      app/templates/base.html
  5. 8
      app/templates/runtimeapi.html
  6. 36
      inc/add.js
  7. 3
      inc/js.cookie.min.js
  8. 107
      inc/script.js
  9. 50
      inc/style.css

2
README.md

@ -60,6 +60,8 @@ After install HAProxy-WI:
yum install haproxy-wi
```
Supports EL7 and EL8
#### Before uses RPM repository you should donate to support project on [Patreon](https://www.patreon.com/haproxy_wi/overview) or on [PayPal](https://www.paypal.me/loginovpavel) and I will send you credentials for access. Actual prices you can see on [Patreon](https://www.patreon.com/haproxy_wi/overview)
## Manual install

6
app/create_db.py

@ -185,6 +185,8 @@ def update_db_v_31(**kwargs):
sql.append("INSERT INTO settings (param, value, section, `desc`) values('ldap_password', '', 'ldap', 'Password for connect to LDAP server');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('ldap_base', '', 'ldap', 'Base domain. Example: dc=domain, dc=com');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('ldap_domain', '', 'ldap', 'Domain for login, that after @, like user@domain.com, without user@');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('ldap_class_search', 'user', 'ldap', 'Class to search user');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('ldap_user_attribute', 'sAMAccountName', 'ldap', 'User\'s attribute for search');")
sql.append("INSERT INTO settings (param, value, section, `desc`) values('ldap_search_field', 'mail', 'ldap', 'Field where user e-mail saved');")
for i in sql:
@ -409,7 +411,7 @@ def update_db_v_3_4_9_5(**kwargs):
if e.args[0] == 'duplicate column name: param' or e == "1060 (42S21): Duplicate column name 'param' ":
print('DB was update to 3.4.9.5')
else:
print("DB was update to 3.4.9.5")
print("Updating... go to version 3.8.1")
return False
else:
return True
@ -438,7 +440,7 @@ def update_db_v_3_5_3(**kwargs):
def update_ver(**kwargs):
con, cur = get_cur()
sql = """update version set version = '3.8'; """
sql = """update version set version = '3.8.1'; """
try:
cur.execute(sql)
con.commit()

3
app/funct.py

@ -636,6 +636,7 @@ def ssh_command(serv, commands, **kwargs):
for line in stderr.read().decode(encoding='UTF-8'):
if line:
print("<div class='alert alert-warning'>"+line+"</div>")
logging('localhost', ' '+line, haproxywi=1)
try:
ssh.close()
except:
@ -663,6 +664,8 @@ def show_backends(serv, **kwargs):
haproxy_sock_port = sql.get_setting('haproxy_sock_port')
cmd='echo "show backend" |nc %s %s' % (serv, haproxy_sock_port)
output, stderr = subprocess_execute(cmd)
if stderr:
logging('localhost', ' '+stderr, haproxywi=1)
if kwargs.get('ret'):
ret = list()
else:

3
app/templates/base.html

@ -198,6 +198,9 @@
</div>
</div>
{% endif %}
{% if h2 %}
<span id='browse_histroy'></span>
{% endif %}
{% if role %}
{% if role <= 2 %}
<div id="apply" style="display: none;">

8
app/templates/runtimeapi.html

@ -43,6 +43,14 @@
if($('#servbackend').val()) {
window.onload = {{ onclick }}
}
if (window.matchMedia('(max-width: 786px)').matches || window.matchMedia('(max-width: 1024px)').matches || window.matchMedia('(max-width: 667px)').matches) {
$( "#servaction" ).selectmenu({
width: 150
});
$( "#serv" ).selectmenu({
width: 150
});
}
</script>
<div id="ajaxruntime"></div>
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">

36
inc/add.js

@ -1088,4 +1088,40 @@ function view_ssl(id) {
}
}
} );
}
function change_select_acceleration(id) {
$.ajax( {
url: "options.py",
data: {
get_hap_v: 1,
serv: $('#serv'+id+' option:selected').val(),
token: $('#token').val()
},
type: "GET",
success: function( data ) {
if(parseFloat(data) < parseFloat('1.8')) {
$("#cache"+id).checkboxradio( "disable" );
} else {
$("#cache"+id).checkboxradio( "enable" );
}
}
} );
}
function change_select_waf(id) {
$.ajax( {
url: "options.py",
data: {
get_hap_v: 1,
serv: $('#serv'+id+' option:selected').val(),
token: $('#token').val()
},
type: "GET",
success: function( data ) {
if(parseFloat(data) < parseFloat('1.8')) {
$("#waf"+id).checkboxradio( "disable" );
} else {
$("#waf"+id).checkboxradio( "enable" );
}
}
} );
}

3
inc/js.cookie.min.js vendored

@ -4,5 +4,4 @@
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
!function(e){var n=!1;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var o=window.Cookies,t=window.Cookies=e();t.noConflict=function(){return window.Cookies=o,t}}}(function(){function e(){for(var e=0,n={};e<arguments.length;e++){var o=arguments[e];for(var t in o)n[t]=o[t]}return n}return function n(o){function t(n,r,i){var c;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(i=e({path:"/"},t.defaults,i)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*i.expires),i.expires=a}i.expires=i.expires?i.expires.toUTCString():"";try{c=JSON.stringify(r),/^[\{\[]/.test(c)&&(r=c)}catch(e){}r=o.write?o.write(r,n):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=(n=(n=encodeURIComponent(String(n))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var s="";for(var f in i)i[f]&&(s+="; "+f,!0!==i[f]&&(s+="="+i[f]));return document.cookie=n+"="+r+s}n||(c={});for(var p=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,u=0;u<p.length;u++){var l=p[u].split("="),C=l.slice(1).join("=");this.json||'"'!==C.charAt(0)||(C=C.slice(1,-1));try{var g=l[0].replace(d,decodeURIComponent);if(C=o.read?o.read(C,g):o(C,g)||C.replace(d,decodeURIComponent),this.json)try{C=JSON.parse(C)}catch(e){}if(n===g){c=C;break}n||(c[g]=C)}catch(e){}}return c}}return t.set=t,t.get=function(e){return t.call(t,e)},t.getJSON=function(){return t.apply({json:!0},[].slice.call(arguments))},t.defaults={},t.remove=function(n,o){t(n,"",e(o,{expires:-1}))},t.withConverter=n,t}(function(){})});
//# sourceMappingURL=/sm/203d9606ffea7a776ef56994ac4d4a1ab0a18611bf5f22fd2f82e9b682eea54f.map
!function(e){var n=!1;if("function"==typeof define&&define.amd&&(define(e),n=!0),"object"==typeof exports&&(module.exports=e(),n=!0),!n){var o=window.Cookies,t=window.Cookies=e();t.noConflict=function(){return window.Cookies=o,t}}}(function(){function e(){for(var e=0,n={};e<arguments.length;e++){var o=arguments[e];for(var t in o)n[t]=o[t]}return n}return function n(o){function t(n,r,i){var c;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(i=e({path:"/"},t.defaults,i)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*i.expires),i.expires=a}i.expires=i.expires?i.expires.toUTCString():"";try{c=JSON.stringify(r),/^[\{\[]/.test(c)&&(r=c)}catch(e){}r=o.write?o.write(r,n):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=(n=(n=encodeURIComponent(String(n))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var s="";for(var f in i)i[f]&&(s+="; "+f,!0!==i[f]&&(s+="="+i[f]));return document.cookie=n+"="+r+s}n||(c={});for(var p=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,u=0;u<p.length;u++){var l=p[u].split("="),C=l.slice(1).join("=");this.json||'"'!==C.charAt(0)||(C=C.slice(1,-1));try{var g=l[0].replace(d,decodeURIComponent);if(C=o.read?o.read(C,g):o(C,g)||C.replace(d,decodeURIComponent),this.json)try{C=JSON.parse(C)}catch(e){}if(n===g){c=C;break}n||(c[g]=C)}catch(e){}}return c}}return t.set=t,t.get=function(e){return t.call(t,e)},t.getJSON=function(){return t.apply({json:!0},[].slice.call(arguments))},t.defaults={},t.remove=function(n,o){t(n,"",e(o,{expires:-1}))},t.withConverter=n,t}(function(){})});

107
inc/script.js

@ -102,7 +102,6 @@ function autoRefreshStyle(autoRefresh) {
$('.auto-refresh-resume').css('margin-left', "-25px");
$('.auto-refresh img').remove();
}
function setRefreshInterval(interval) {
if (interval == "0") {
Cookies.remove('auto-refresh');
@ -123,7 +122,6 @@ function setRefreshInterval(interval) {
autoRefreshStyle(interval);
}
}
function startSetInterval(interval) {
if(Cookies.get('auto-refresh-pause') == "0") {
if (cur_url[0] == "logs.py") {
@ -194,7 +192,6 @@ $( document ).ajaxComplete(function( event, request, settings ) {
$('#cover').fadeOut('fast');
NProgress.done();
});
function showOverview() {
showOverviewHapWI()
$.ajax( {
@ -878,42 +875,6 @@ async function ban() {
$( "input[type=submit], button" ).button('enable');
$('#ban_10').hide();
}
function change_select_acceleration(id) {
$.ajax( {
url: "options.py",
data: {
get_hap_v: 1,
serv: $('#serv'+id+' option:selected').val(),
token: $('#token').val()
},
type: "GET",
success: function( data ) {
if(parseFloat(data) < parseFloat('1.8')) {
$("#cache"+id).checkboxradio( "disable" );
} else {
$("#cache"+id).checkboxradio( "enable" );
}
}
} );
}
function change_select_waf(id) {
$.ajax( {
url: "options.py",
data: {
get_hap_v: 1,
serv: $('#serv'+id+' option:selected').val(),
token: $('#token').val()
},
type: "GET",
success: function( data ) {
if(parseFloat(data) < parseFloat('1.8')) {
$("#waf"+id).checkboxradio( "disable" );
} else {
$("#waf"+id).checkboxradio( "enable" );
}
}
} );
}
function replace_text(id_textarea, text_var) {
var str = $(id_textarea).val();
var len = str.length;
@ -923,26 +884,6 @@ function replace_text(id_textarea, text_var) {
var text_val = str.substring(0, beg) + str.substring(end, len);
$(id_textarea).text(text_val);
}
function changeWafMode(id) {
var waf_mode = $('#'+id+' option:selected').val();
var server_hostname = id.split('_')[0];
$.ajax( {
url: "options.py",
data: {
change_waf_mode: waf_mode,
server_hostname: server_hostname,
token: $('#token').val()
},
type: "GET",
success: function( data ) {
alert('Do not forget restart WAF server: '+server_hostname)
$( '#'+server_hostname+'-select-line' ).addClass( "update", 1000 );
setTimeout(function() {
$( '#'+server_hostname+'-select-line' ).removeClass( "update" );
}, 2500 );
}
} );
}
function createList(color) {
if(color == 'white') {
list = $('#new_whitelist_name').val()
@ -1023,3 +964,51 @@ function saveList(action, list, color) {
}
} );
}
function createHistroy() {
try {
var get_history_array = JSON.parse(Cookies.get('history'));
}
catch {
var get_history_array = ['login.py', 'login.py','login.py'];
Cookies.set('history', JSON.stringify(get_history_array), { expires: 1 });
}
}
function listHistroy() {
var browse_history = JSON.parse(Cookies.get('history'));
Cookies.remove('history');
var history_link = '';
var title = []
var link_text = []
for(let i = 0; i < browse_history.length; i++){
if (i == 0) {
if(browse_history[0] == browse_history[1]) {
continue
}
browse_history[0] = browse_history[1];
}
if (i == 1) {
if(browse_history[1] == browse_history[2]) {
continue
}
browse_history[1] = browse_history[2]
}
if (i == 2) {
browse_history[2] = cur_url[0]
}
$( function() {
$('.menu li ul li').each(function () {
var link1 = $(this).find('a').attr('href');
var link2 = link1.split('/')[2]
if (browse_history[i] == link2) {
title[i] = $(this).find('a').attr('title');
link_text[i] = $(this).find('a').text();
history_link = '<a href="'+browse_history[i]+'" title="'+title[i]+'"> > '+link_text[i]+'</a>'
$('#browse_histroy').append(history_link);
}
});
});
}
Cookies.set('history', JSON.stringify(browse_history), { expires: 1 });
}
createHistroy()
listHistroy()

50
inc/style.css

@ -29,6 +29,17 @@ h3 {
font-size: 1.6em;
border-bottom: 1px solid #ddd;
}
#browse_histroy {
padding-left: 10px;
margin-bottom: 5px;
display: block;
margin-top: 5px;
}
#browse_histroy a {
font-size: 9.1px;
color: #000;
font-weight: bold;
}
form {
margin: 0;
}
@ -119,7 +130,6 @@ pre {
text-align: right;
margin-right: 20px;
}
.footer-link, .footer-copyright {
padding: 20px;
color: #5d9ceb;
@ -346,7 +356,6 @@ pre {
.overview-wi .overviewHead {
border-bottom: 1px solid #A4C7F5;
}
.overview tr{
border-bottom: 1px solid #ddd;
border-radius: 5px;
@ -529,7 +538,6 @@ ul{
50% {text-shadow: 0 0 30px black;}
to {box-shadow: 0 -5px 5px -5px #5D9CEB inset}
}
.form-control:hover {
animation: shadow-red 0.3s forwards;
}
@ -564,15 +572,6 @@ ul{
border: none !important;
border-color: #5D9CEB !important;
}
/* .ui-tooltip, .arrow:after { */
/* background: #33414E !important; */
/* border: 1px solid #33414E !important; */
/* border-radius: 5px !important; */
/* color: #fff !important; */
/* font-size: 10px !important; */
/* padding: 2px !important; */
/* margin-bottom: -20px !important; */
/* } */
.ui-tabs-nav {
border-radius: 0 !important;
padding-left: 25px !important;
@ -611,18 +610,16 @@ a {
a:active, a:hover {
outline: 0;
}
a,
a:visited {
a, a:visited {
text-decoration: underline;
}
a {
color: #9d9d9d;
text-decoration: none;
}
a:hover,
a:focus {
a:hover, a:focus {
color: #23527c;
text-decoration: underline;
text-decoration: derline;
}
a:focus {
outline: 5px auto -webkit-focus-ring-color;
@ -646,7 +643,6 @@ td,th {
text-align: left;
min-width: 25px;
}
.row {
margin-right: -15px;
margin-left: -15px;
@ -919,6 +915,12 @@ label {
.div-backends {
width: 84.2% !important
}
#rows {
width: 50px;
}
#grep {
width: 100px;
}
}
@media (max-width: 768px) {
#logo_span {
@ -953,6 +955,12 @@ label {
.div-backends {
width: 82.5% !important
}
#rows {
width: 50px;
}
#grep {
width: 100px;
}
}
@media (max-width: 667px) {
#logo_span {
@ -981,6 +989,12 @@ label {
.div-backends {
width: 84.6% !important
}
#rows {
width: 50px;
}
#grep {
width: 100px;
}
}
.loading, .loading_full_page, .loading_hapwi_overview {
width: 100px;

Loading…
Cancel
Save