v3.4.9.2
Improved the Overview page, improved the "Add Proxy" page, improved the admin page, bugs fixpull/161/head
|
@ -401,7 +401,7 @@ def update_db_v_3_4_7(**kwargs):
|
|||
|
||||
def update_ver(**kwargs):
|
||||
con, cur = get_cur()
|
||||
sql = """update version set version = '3.4.9.1'; """
|
||||
sql = """update version set version = '3.4.9.2'; """
|
||||
try:
|
||||
cur.execute(sql)
|
||||
con.commit()
|
||||
|
|
|
@ -605,9 +605,9 @@ def check_new_version():
|
|||
try:
|
||||
if proxy:
|
||||
proxyDict = { "https" : proxy, "http" : proxy }
|
||||
response = requests.get('https://haproxy-wi.org/update.py?last_ver=1', verify=False, timeout=1, proxies=proxyDict)
|
||||
response = requests.get('https://haproxy-wi.org/update.py?last_ver=1', timeout=1, proxies=proxyDict)
|
||||
else:
|
||||
response = requests.get('https://haproxy-wi.org/update.py?last_ver=1', verify=False, timeout=1)
|
||||
response = requests.get('https://haproxy-wi.org/update.py?last_ver=1', timeout=1)
|
||||
|
||||
res = response.content.decode(encoding='UTF-8')
|
||||
except requests.exceptions.RequestException as e:
|
||||
|
|
|
@ -55,9 +55,9 @@ def ban():
|
|||
c["ban"]["path"] = "/app/"
|
||||
c["ban"]["expires"] = expires.strftime("%a, %d %b %Y %H:%M:%S GMT")
|
||||
try:
|
||||
funct.logging('locahost', login+' Failed log in', haproxywi=1, login=1)
|
||||
funct.logging('locahost', login+' failed log in', haproxywi=1, login=1)
|
||||
except:
|
||||
funct.logging('locahost', ' Failed log in', haproxywi=1)
|
||||
funct.logging('locahost', ' Failed log in. Wrong username', haproxywi=1)
|
||||
print(c)
|
||||
print("Content-type: text/html\n")
|
||||
print('ban')
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<script src="/inc/add.js"></script>
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#create">Create proxy</a></li>
|
||||
|
@ -14,39 +15,131 @@
|
|||
<a href=/app/login.py title="Login" class="login"> Login</a>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<div id="create" style="height: 50%;">
|
||||
<div class="div-pannel">
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create Listen" class="redirectListen span-link">Create Listen</span>
|
||||
<div id="create" style="height: 95%;">
|
||||
<div id="left-collumn">
|
||||
<div class="div-pannel">
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create Listen" class="redirectListen span-link">Create Listen</span>
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
A "listen" section defines a complete proxy with its frontend and backend parts combined in one section. It is generally useful for TCP-only traffic.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
A "listen" section defines a complete proxy with its frontend and backend parts combined in one section. It is generally useful for TCP-only traffic.
|
||||
</div>
|
||||
<div class="div-pannel">
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create HTTP Listen" class="redirectListen span-link" id="create-http-listen">Create HTTP Listen</span>
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
Create HTTP proxy
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-pannel">
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create SSL Listen" class="redirectListen span-link" id="create-ssl-listen">Create SSL Listen</span>
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
Create HTTPS Proxy with the SSL termination on HAProxy and SSL offload. HAProxy will send to backends HTTP traffic. You need have <span title="Upload SSL" class="redirectSsl span-link" style="color: #5d9ceb">uploaded a PEM certificat</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-pannel">
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create SSL Listen" class="redirectListen span-link" id="create-https-listen">Create HTTPS Listen</span>
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
Create HTTPS Proxy without the SSL termination on HAProxy and SSL offload. HAProxy will send to backends HTTPS traffic
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-pannel">
|
||||
<div id="middle-collumn">
|
||||
<div class="div-pannel">
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create Frontend" class="redirectFrontend span-link">Create Frontend</span>
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
A "frontend" section describes a set of listening sockets accepting client connections.
|
||||
And forwards them to backend
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create Frontend" class="redirectFrontend span-link">Create Frontend</span>
|
||||
<span title="Create HTTP Frontend" class="redirectListen span-link" id="create-http-frontend">Create HTTP Frontend</span>
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
A "frontend" section describes a set of listening sockets accepting client connections.
|
||||
And forwards them to backend
|
||||
</div>
|
||||
Create HTTP Frontend
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-pannel">
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create SSL Frontend" class="redirectListen span-link" id="create-ssl-frontend">Create SSL Frontend</span>
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
Create HTTPS Frontend with the SSL termination on HAProxy and SSL offload. HAProxy will send to backends HTTP traffic. You need have <span title="Upload SSL" class="redirectSsl span-link" style="color: #5d9ceb">uploaded a PEM certificat</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-pannel">
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create HTTPS Frontend" class="redirectListen span-link" id="create-https-frontend">Create HTTPS Frontend</span>
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
Create HTTPS Frontend without the SSL termination on HAProxy and SSL offload. HAProxy will send to backends HTTPS traffic
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-pannel">
|
||||
<div id="right-collumn">
|
||||
<div class="div-pannel">
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create Backend" class="redirectBackend span-link">Create Backend</span>
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
A "backend" section describes a set of servers to which the proxy will connect to forward incoming connections.
|
||||
<br />
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create Backend" class="redirectBackend span-link">Create Backend</span>
|
||||
<span title="Create SSL Backend" class="redirectListen span-link" id="create-http-backend">Create HTTP Backend</span>
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
A "backend" section describes a set of servers to which the proxy will connect to forward incoming connections.
|
||||
<br />
|
||||
<br />
|
||||
</div>
|
||||
Create HTTP Backend
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-pannel">
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create HTTPS Backend" class="redirectListen span-link" id="create-ssl-backend">Create SSL Backend</span>
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
Create HTTPS Backend with the SSL termination on HAProxy and SSL offload. HAProxy will send to backends HTTP traffic. You need have <span title="Upload SSL" class="redirectSsl span-link" style="color: #5d9ceb">uploaded a PEM certificat</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="div-pannel">
|
||||
<div class="div-server">
|
||||
<div class="server-name">
|
||||
<span title="Create SSL Backend" class="redirectListen span-link" id="create-https-backend">Create HTTPS Backend</span>
|
||||
</div>
|
||||
<div class="server-desc">
|
||||
Create HTTPS Backend without the SSL termination on HAProxy and SSL offload. HAProxy will send to backends HTTPS traffic
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if add %}
|
||||
|
@ -724,7 +817,7 @@
|
|||
</div>
|
||||
|
||||
<div id="dialog-confirm-delete" title="Are you sure you want to delete?" style="display: none;">
|
||||
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Deleting irreversibly all data will be lost?</p>
|
||||
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Deleting all data will be lost?</p>
|
||||
</div>
|
||||
<div id="dialog-confirm" title="View certificate " style="display: none;">
|
||||
<center><pre id="dialog-confirm-body"></pre></center>
|
||||
|
|
|
@ -48,8 +48,12 @@
|
|||
{% if role %}
|
||||
<span class="accordion-link">
|
||||
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit</a>
|
||||
</span>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% set backend = line.split(' ') %}
|
||||
<span class="accordion-link">
|
||||
<a href="/app/viewsttats.py?serv={{serv}}#{{ backend[1]}}">Stats</a>
|
||||
</span>
|
||||
</span><div>
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
@ -59,7 +63,11 @@
|
|||
<span class="accordion-link">
|
||||
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% set backend = line.split(' ') %}
|
||||
<span class="accordion-link">
|
||||
<a href="/app/viewsttats.py?serv={{serv}}#{{ backend[1]}}">Stats</a>
|
||||
</span>
|
||||
</span><div>
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
@ -70,6 +78,10 @@
|
|||
<a href="/app/sections.py?serv={{serv}}§ion={{ line }}">Edit</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% set backend = line.split(' ') %}
|
||||
<span class="accordion-link">
|
||||
<a href="/app/viewsttats.py?serv={{serv}}#{{ backend[1]}}">Stats</a>
|
||||
</span>
|
||||
</span><div>
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<input type="hidden" id="token" value="{{ token }}">
|
||||
<div class="top-menu">
|
||||
<div class="LogoText">
|
||||
<span id="logo_text">HAproxy-WI</span>
|
||||
<span id="logo_text">HAProxy-WI</span>
|
||||
</div>
|
||||
<div id="top-link" class="top-link">
|
||||
<nav id="menu">
|
||||
|
@ -44,6 +44,7 @@
|
|||
<ul class="v_menu">
|
||||
<li><a href=/app/hapservers.py title="Working with Haproxy Configs" class="overview-link head-submenu">Overview</a> </li>
|
||||
{% if role <= 2 %}
|
||||
<li><a href=/app/config.py title="Working with HAProxy configs" class="edit head-submenu">Configs</a></li>
|
||||
<li><a href=/app/add.py#proxy title="Add proxy" class="add head-submenu" id="add1">Add proxy</a></li>
|
||||
<!-- <li><a href=/app/add.py#frontend title="Add single frontend" class="add head-submenu" id="add2">Add frontend</a></li> -->
|
||||
<!-- <li><a href=/app/add.py#frontend title="Add single frontend" class="add head-submenu" id="add2">Add frontend</a></li> -->
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<h3>Choose server</h3>
|
||||
<p>
|
||||
<form action="{{ action }}" method="get">
|
||||
<a class="ui-button ui-widget ui-corner-all" title="Return back" id="back" onclick="history.go(-2)">Back</a>
|
||||
<select autofocus required name="serv" id="{{ select_id }}">
|
||||
<option disabled>Choose server</option>
|
||||
{% for select in selects %}
|
||||
|
@ -86,4 +87,15 @@
|
|||
<script>window.history.pushState("Config", "Config", cur_url[0])</script>
|
||||
{% endif %}
|
||||
</center>
|
||||
{% endblock %}
|
||||
<script>
|
||||
if (cur_url[1].split('&')[1] == 'showMap') {
|
||||
showMap();
|
||||
}
|
||||
if (cur_url[1].split('&')[1] == 'showCompare') {
|
||||
showCompareConfigs();
|
||||
}
|
||||
if (cur_url[1].split('&')[1] == 'showConfig') {
|
||||
showConfig();
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -4,6 +4,7 @@
|
|||
<h3>Choose server</h3>
|
||||
<p>
|
||||
<form action="{{ action }}" method="get">
|
||||
<a class="ui-button ui-widget ui-corner-all" title="Return back" onclick="history.back()">Back</a>
|
||||
<select autofocus required name="serv" id="{{ select_id }}">
|
||||
<option disabled>Choose server</option>
|
||||
{% for select in selects %}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<h3>Choose server</h3>
|
||||
<p>
|
||||
<form action="{{ action }}" method="get">
|
||||
<a class="ui-button ui-widget ui-corner-all" title="Return back" onclick="history.back()">Back</a>
|
||||
<select autofocus required name="serv" id="{{ select_id }}">
|
||||
<option disabled>Choose server</option>
|
||||
{% for select in selects %}
|
||||
|
@ -30,7 +31,7 @@
|
|||
<input type="checkbox" id="select_all"><br />
|
||||
{% for file in return_files %}
|
||||
<label for="{{file}}"> {{file.split('-', maxsplit=1)[1]}} </label><input type="checkbox" value="{{file}}" name="{{file}}" id="{{file}}">
|
||||
<a href="/app/versions.py?serv={{serv}}&open=open&configver={{file}}" class="ui-button ui-widget ui-corner-all" target="_blanc" title="View and upload this version of the config" style="margin-top: -6px;">
|
||||
<a href="/app/versions.py?serv={{serv}}&open=open&configver={{file}}" class="ui-button ui-widget ui-corner-all" title="View and upload this version of the config" style="margin-top: -6px;">
|
||||
Upload
|
||||
</a><br />
|
||||
{% endfor %}
|
||||
|
@ -42,7 +43,7 @@
|
|||
</p>
|
||||
</form>
|
||||
</center>
|
||||
<div class="alert alert-info"><b>Note:</b> If you reconfigure Master server, Slave will reconfigured automatically</div>
|
||||
|
||||
{% endif %}
|
||||
{% if aftersave %}
|
||||
<div class="alert alert-info"><b>The following files were deleted:</b><br /> </div>
|
||||
|
|
|
@ -30,16 +30,20 @@
|
|||
</div>
|
||||
<div class="server-desc">
|
||||
{{s.3}}
|
||||
{% if s.5.0 is defined %}
|
||||
<br />
|
||||
{{s.5.0.0}} {{s.5.0.1}}
|
||||
<br />
|
||||
IP: {{s.2}}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="server-act-links">
|
||||
<a href="/app/config.py?serv={{s.2}}&showConfig" class="ui-button ui-widget ui-corner-all" title="Open running config" target="_blank">Open</a>
|
||||
<a href="/app/config.py?serv={{s.2}}&showCompare" class="ui-button ui-widget ui-corner-all" title="Compare configs" target="_blank">Compare</a>
|
||||
<a href="/app/config.py?serv={{s.2}}&showMap" class="ui-button ui-widget ui-corner-all" title="Show map" target="_blank">Map</a>
|
||||
<a href="/app/viewsttats.py?serv={{s.2}}" class="ui-button ui-widget ui-corner-all" title="View stat" target="_blank">Stat</a>
|
||||
<a href="/app/config.py?serv={{s.2}}&showConfig" class="ui-button ui-widget ui-corner-all" title="Open running config">Open</a>
|
||||
<a href="/app/config.py?serv={{s.2}}&showCompare" class="ui-button ui-widget ui-corner-all" title="Compare configs">Compare</a>
|
||||
<a href="/app/config.py?serv={{s.2}}&showMap" class="ui-button ui-widget ui-corner-all" title="Show map">Map</a>
|
||||
<a href="/app/viewsttats.py?serv={{s.2}}" class="ui-button ui-widget ui-corner-all" title="View stat">Stat</a>
|
||||
{% if role <= 2 %}
|
||||
<a href="/app/versions.py?serv={{s.2}}&open=open" class="ui-button ui-widget ui-corner-all" title="Show versions">Versions</a>
|
||||
<a href="/app/versions.py?serv={{s.2}}&open=open" class="ui-button ui-widget ui-corner-all">Versions</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -52,4 +56,4 @@
|
|||
</div>
|
||||
<script src="/inc/overview.js"></script>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
|
@ -1,24 +1,55 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<center>
|
||||
<form name="auth" id="auth" action="login.py" class="form-horizontal" method="post">
|
||||
{{error_log}}
|
||||
<style>
|
||||
body, .container {
|
||||
background-color: #fff;
|
||||
}
|
||||
.top-menu, .footer {
|
||||
display: none !important;
|
||||
}
|
||||
.container {
|
||||
margin: 0 !important;
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
.form-control {
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
padding: 10px;
|
||||
width: 220px;
|
||||
background-size: 0 !important;
|
||||
border: 0 !important;
|
||||
}
|
||||
#enter {
|
||||
width: 220px !important;
|
||||
padding: 10px !important;
|
||||
background-color: #ededee !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
</style>
|
||||
<center style="margin-top: 15%; background-color: #5d9ceb;">
|
||||
{{error_log}}
|
||||
{{error}}
|
||||
{{db_create}}
|
||||
<br>
|
||||
<label for="login">Login: </label><input type="text" name="login" id="login" required class="form-control"><br /><br />
|
||||
<label for="pass">Pass: </label><input type="password" name="pass" id="pass" required class="form-control"><br /><br />
|
||||
<input type="hidden" value="{{reff}}" name="ref" id="ref">
|
||||
<button type="submit" name="Login" value="Enter" id="enter">Sign Up</button>
|
||||
</form>
|
||||
<div class="alert alert-danger" style="display: none;">
|
||||
Your login or password is incorrect
|
||||
<br />
|
||||
<span id="ban_10">
|
||||
<div id="login-form" style="padding-top: 40px; padding-bottom: 50px; height: 250px; color: #000;">
|
||||
<span style="font-size: 50px; font-weight: bold; color: #fff;">HAProxy-WI</span>
|
||||
<!-- <span><img src="/inc/images/logo_big1.png" width=300 style="margin-top: -100px; margin-bottom: -100px; padding-left: 70px;"></span> -->
|
||||
<form name="auth" id="auth" action="login.py" class="form-horizontal" method="post" >
|
||||
<br>
|
||||
<input type="text" name="login" id="login" required class="form-control" placeholder="Login"><br /><br />
|
||||
<input type="password" name="pass" id="pass" required class="form-control" placeholder="Password"><br /><br />
|
||||
<input type="hidden" value="{{reff}}" name="ref" id="ref">
|
||||
<button type="submit" name="Login" value="Enter" id="enter">Login</button>
|
||||
</form>
|
||||
<div class="alert alert-danger" style="display: none;">
|
||||
Your login or password is incorrect
|
||||
<br />
|
||||
You can try again in <span id="ban_timer">10</span> seconds
|
||||
</span>
|
||||
</div><br /><br />
|
||||
<span id="ban_10">
|
||||
<br />
|
||||
You can try again in <span id="ban_timer">10</span> seconds
|
||||
</span>
|
||||
</div>
|
||||
<br /><br />
|
||||
</center>
|
||||
<div id="dialog-confirm" title="View certificate " style="display: none;">
|
||||
<center>
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<tbody id="ajaxwafstatus"></tbody>
|
||||
</table>
|
||||
<table class="overview-wi" style="height: 172;">
|
||||
<tr class="overviewHead">
|
||||
<tr class="overviewHead" style="height: 48px;">
|
||||
<th class="padding10 first-collumn-wi" colspan=4>
|
||||
Tools status
|
||||
</th>
|
||||
|
@ -67,7 +67,7 @@
|
|||
{% endif %}
|
||||
<span>Checker master</span>
|
||||
</td>
|
||||
<td class="third-collumn-wi" style="border-right: 1px solid #ddd;">
|
||||
<td class="third-collumn-wi">
|
||||
{% if keep_alive|int() >= 1 %}
|
||||
<span title="Keep alive is run"><span class="serverUp"> UP</span>
|
||||
{% else %}
|
||||
|
@ -93,7 +93,7 @@
|
|||
{% endif %}
|
||||
<span>Checker workers</span>
|
||||
</td>
|
||||
<td style="border-right: 1px solid #ddd;"></td>
|
||||
<td></td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
<h3>Choose a section</h3>
|
||||
<p>
|
||||
<form action="{{ action }}" method="get">
|
||||
{% if aftersave %}
|
||||
<a class="ui-button ui-widget ui-corner-all" title="Return back" onclick="history.go(-3)">Back</a>
|
||||
{% else %}
|
||||
<a class="ui-button ui-widget ui-corner-all" title="Return back" onclick="history.back()">Back</a>
|
||||
{% endif %}
|
||||
<select autofocus required name="section" id="{{ select_id }}">
|
||||
<option disabled>Choose a section</option>
|
||||
{% for s in sections %}
|
||||
|
|
Before Width: | Height: | Size: 375 KiB After Width: | Height: | Size: 401 KiB |
Before Width: | Height: | Size: 342 KiB After Width: | Height: | Size: 294 KiB |
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 287 KiB |
Before Width: | Height: | Size: 364 KiB After Width: | Height: | Size: 276 KiB |
Before Width: | Height: | Size: 340 KiB After Width: | Height: | Size: 285 KiB |
Before Width: | Height: | Size: 588 KiB After Width: | Height: | Size: 477 KiB |
|
@ -0,0 +1,909 @@
|
|||
var ssl_offloading_var = "http-request set-header X-Forwarded-Port %[dst_port] \n"+
|
||||
"http-request add-header X-Forwarded-Proto https if { ssl_fc } \n"+
|
||||
"redirect scheme https if !{ ssl_fc } \n"
|
||||
$( function() {
|
||||
$( "#listen-mode-select" ).on('selectmenuchange',function() {
|
||||
if ($( "#listen-mode-select option:selected" ).val() == "tcp") {
|
||||
$( "#https-listen-span" ).hide("fast");
|
||||
$( "#https-hide-listen" ).hide("fast");
|
||||
$("#compression").checkboxradio( "disable" );
|
||||
$("#cache").checkboxradio( "disable" );
|
||||
$("#ssl_offloading").checkboxradio( "disable" );
|
||||
$("#cookie").checkboxradio( "disable" );
|
||||
$("#slow_atack").checkboxradio( "disable" );
|
||||
$( "#https-listen" ).prop("checked", false);
|
||||
} else {
|
||||
$( "#https-listen-span" ).show("fast");
|
||||
$("#compression").checkboxradio( "enable" );
|
||||
$("#cache").checkboxradio( "enable" );
|
||||
$("#ssl_offloading").checkboxradio( "enable" );
|
||||
$("#cookie").checkboxradio( "enable" );
|
||||
$("#slow_atack").checkboxradio( "enable" );
|
||||
}
|
||||
});
|
||||
$( "#frontend-mode-select" ).on('selectmenuchange',function() {
|
||||
if ($( "#frontend-mode-select option:selected" ).val() == "tcp") {
|
||||
$( "#https-frontend-span" ).hide("fast");
|
||||
$( "#https-hide-frontend" ).hide("fast");
|
||||
$("#compression2").checkboxradio( "disable" );
|
||||
$("#cache2").checkboxradio( "disable" );
|
||||
$("#ssl_offloading2").checkboxradio( "disable" );
|
||||
$("#cookie2").checkboxradio( "disable" );
|
||||
$("#slow_atack1").checkboxradio( "disable" );
|
||||
} else {
|
||||
$( "#https-frontend-span" ).show("fast");
|
||||
$("#compression2").checkboxradio( "enable" );
|
||||
$("#cache2").checkboxradio( "enable" );
|
||||
$("#ssl_offloading2").checkboxradio( "enable" );
|
||||
$("#cookie2").checkboxradio( "enable" );
|
||||
$("#slow_atack1").checkboxradio( "enable" );
|
||||
}
|
||||
});
|
||||
$( "#backend-mode-select" ).on('selectmenuchange',function() {
|
||||
if ($( "#backend-mode-select option:selected" ).val() == "tcp") {
|
||||
$( "#https-backend-span" ).hide("fast");
|
||||
$( "#https-hide-backend" ).hide("fast");
|
||||
$("#compression3").checkboxradio( "disable" );
|
||||
$("#cache3").checkboxradio( "disable" );
|
||||
$("#ssl_offloading3").checkboxradio( "disable" );
|
||||
$("#cookie3").checkboxradio( "disable" );
|
||||
$("#slow_atack2").checkboxradio( "disable" );
|
||||
} else {
|
||||
$( "#https-backend-span" ).show("fast");
|
||||
$("#compression3").checkboxradio( "enable" );
|
||||
$("#cache3").checkboxradio( "enable" );
|
||||
$("#ssl_offloading3").checkboxradio( "enable" );
|
||||
$("#cookie3").checkboxradio( "enable" );
|
||||
$("#slow_atack2").checkboxradio( "enable" );
|
||||
}
|
||||
});
|
||||
$( "#https-listen" ).click( function(){
|
||||
if ($('#https-listen').is(':checked')) {
|
||||
$( "#https-hide-listen" ).show( "fast" );
|
||||
$( "#path-cert-listen" ).attr('required',true);
|
||||
} else {
|
||||
$( "#https-hide-listen" ).hide( "fast" );
|
||||
$( "#path-cert-listen" ).prop('required',false);
|
||||
}
|
||||
});
|
||||
$( "#https-frontend" ).click( function(){
|
||||
if ($('#https-frontend').is(':checked')) {
|
||||
$( "#https-hide-frontend" ).show( "fast" );
|
||||
$( "#path-cert-frontend" ).attr('required',true);
|
||||
} else {
|
||||
$( "#https-hide-frontend" ).hide( "fast" );
|
||||
$( "#path-cert-frontend" ).prop('required',false);
|
||||
}
|
||||
});
|
||||
$( "#https-backend" ).click( function(){
|
||||
if ($('#https-backend').is(':checked')) {
|
||||
$( "#https-hide-backend" ).show( "fast" );
|
||||
} else {
|
||||
$( "#https-hide-backend" ).hide( "fast" );
|
||||
}
|
||||
});
|
||||
$( "#options-listen-show" ).click( function(){
|
||||
if ($('#options-listen-show').is(':checked')) {
|
||||
$( "#options-listen-show-div" ).show( "fast" );
|
||||
} else {
|
||||
$( "#options-listen-show-div" ).hide( "fast" );
|
||||
}
|
||||
});
|
||||
$( "#options-frontend-show" ).click( function(){
|
||||
if ($('#options-frontend-show').is(':checked')) {
|
||||
$( "#options-frontend-show-div" ).show( "fast" );
|
||||
} else {
|
||||
$( "#options-frontend-show-div" ).hide( "fast" );
|
||||
}
|
||||
});
|
||||
$( "#options-backend-show" ).click( function(){
|
||||
if ($('#options-backend-show').is(':checked')) {
|
||||
$( "#options-backend-show-div" ).show( "fast" );
|
||||
} else {
|
||||
$( "#options-backend-show-div" ).hide( "fast" );
|
||||
}
|
||||
});
|
||||
$( "#controlgroup-listen-show" ).click( function(){
|
||||
if ($('#controlgroup-listen-show').is(':checked')) {
|
||||
$( "#controlgroup-listen" ).show( "fast" );
|
||||
if ($('#check-servers-listen').is(':checked')) {
|
||||
$( "#rise-listen" ).attr('required',true);
|
||||
$( "#fall-listen" ).attr('required',true);
|
||||
$( "#inter-listen" ).attr('required',true);
|
||||
$( "#inter-listen" ).attr('disable',false);
|
||||
}
|
||||
} else {
|
||||
$( "#controlgroup-listen" ).hide( "fast" );
|
||||
}
|
||||
$( "#check-servers-listen" ).click( function(){
|
||||
if ($('#check-servers-listen').is(':checked')) {
|
||||
$( "#rise-listen" ).attr('required',true);
|
||||
$( "#fall-listen" ).attr('required',true);
|
||||
$( "#inter-listen" ).attr('required',true);
|
||||
$( "#inter-listen" ).selectmenu( "option", "disabled", false );
|
||||
$( "#fall-listen" ).selectmenu( "option", "disabled", false );
|
||||
$( "#rise-listen" ).selectmenu( "option", "disabled", false );
|
||||
} else {
|
||||
$( "#rise-listen" ).attr('required',false);
|
||||
$( "#fall-listen" ).attr('required',false);
|
||||
$( "#inter-listen" ).attr('required',false);
|
||||
$( "#inter-listen" ).selectmenu( "option", "disabled", true );
|
||||
$( "#fall-listen" ).selectmenu( "option", "disabled", true );
|
||||
$( "#rise-listen" ).selectmenu( "option", "disabled", true );
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
$( "#controlgroup-backend-show" ).click( function(){
|
||||
if ($('#controlgroup-backend-show').is(':checked')) {
|
||||
$( "#controlgroup-backend" ).show( "fast" );
|
||||
if ($('#check-servers-backend').is(':checked')) {
|
||||
$( "#rise-backend" ).attr('required',true);
|
||||
$( "#fall-backend" ).attr('required',true);
|
||||
$( "#inter-backend" ).attr('required',true);
|
||||
}
|
||||
} else {
|
||||
$( "#controlgroup-backend" ).hide( "fast" );
|
||||
}
|
||||
});
|
||||
$( "#cookie" ).click( function(){
|
||||
if ($('#cookie').is(':checked')) {
|
||||
$("#cookie_name" ).attr('required',true);
|
||||
$("#cookie_div").show( "fast" );
|
||||
} else {
|
||||
$("#cookie_name" ).attr('required',false);
|
||||
$("#cookie_div").hide( "fast" );
|
||||
$("#dynamic-cookie-key" ).attr('required',false);
|
||||
}
|
||||
});
|
||||
$( "#cookie2" ).click( function(){
|
||||
if ($('#cookie2').is(':checked')) {
|
||||
$("#cookie_name2" ).attr('required',true);
|
||||
$("#cookie_div2").show( "fast" );
|
||||
} else {
|
||||
$("#cookie_name2" ).attr('required',false);
|
||||
$("#cookie_div2").hide( "fast" );
|
||||
$("#dynamic-cookie-key2" ).attr('required',false);
|
||||
}
|
||||
});
|
||||
$( "#rewrite" ).on('selectmenuchange',function() {
|
||||
if ($( "#rewrite option:selected" ).val() == "insert" || $( "#rewrite option:selected" ).val() == "rewrite") {
|
||||
$( "#prefix" ).checkboxradio( "disable" );
|
||||
} else {
|
||||
$( "#prefix" ).checkboxradio( "enable" );
|
||||
}
|
||||
});
|
||||
$( "#rewrite2" ).on('selectmenuchange',function() {
|
||||
if ($( "#rewrite2 option:selected" ).val() == "insert" || $( "#rewrite2 option:selected" ).val() == "rewrite") {
|
||||
$( "#prefix2" ).checkboxradio( "disable" );
|
||||
} else {
|
||||
$( "#prefix2" ).checkboxradio( "enable" );
|
||||
}
|
||||
});
|
||||
$( "#dynamic" ).click( function(){
|
||||
if ($('#dynamic').is(':checked')) {
|
||||
$("#dynamic-cookie-key" ).attr('required',true);
|
||||
$("#dynamic_div").show("slide", "fast" );
|
||||
} else {
|
||||
$("#dynamic-cookie-key" ).attr('required',false);
|
||||
$("#dynamic_div").hide("slide", "fast" );
|
||||
}
|
||||
});
|
||||
$( "#dynamic2" ).click( function(){
|
||||
if ($('#dynamic2').is(':checked')) {
|
||||
$("#dynamic-cookie-key2" ).attr('required',true);
|
||||
$("#dynamic_div2").show("slide", "fast" );
|
||||
} else {
|
||||
$("#dynamic-cookie-key2" ).attr('required',false);
|
||||
$("#dynamic_div2").hide("slide", "fast" );
|
||||
}
|
||||
});
|
||||
$( "#check-servers-backend" ).click( function(){
|
||||
if ($('#check-servers-backend').is(':checked')) {
|
||||
$( "#rise-backend" ).attr('required',true);
|
||||
$( "#fall-backend" ).attr('required',true);
|
||||
$( "#inter-backend" ).attr('required',true);
|
||||
$( "#inter-backend" ).selectmenu( "option", "disabled", false );
|
||||
$( "#fall-backend" ).selectmenu( "option", "disabled", false );
|
||||
$( "#rise-backend" ).selectmenu( "option", "disabled", false );
|
||||
} else {
|
||||
$( "#rise-backend" ).attr('required',false);
|
||||
$( "#fall-backend" ).attr('required',false);
|
||||
$( "#inter-backend" ).attr('required',false);
|
||||
$( "#inter-backend" ).selectmenu( "option", "disabled", true );
|
||||
$( "#fall-backend" ).selectmenu( "option", "disabled", true );
|
||||
$( "#rise-backend" ).selectmenu( "option", "disabled", true );
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var availableTags = [
|
||||
"acl", "http-request", "http-response", "set-uri", "set-url", "set-header", "add-header", "del-header", "replace-header", "path_beg", "url_beg()", "urlp_sub()", "set cookie", "dynamic-cookie-key", "mysql-check", "tcpka", "tcplog", "forwardfor", "option"
|
||||
];
|
||||
|
||||
$( "#ip" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
if ( request.term == "" ) {
|
||||
request.term = 1
|
||||
}
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
ip: request.term,
|
||||
serv: $("#serv").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
response(data.split(" "));
|
||||
}
|
||||
} );
|
||||
},
|
||||
autoFocus: true,
|
||||
minLength: -1,
|
||||
select: function( event, ui ) {
|
||||
$('#listen-port').focus();
|
||||
}
|
||||
});
|
||||
$( "#ip1" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
if ( request.term == "" ) {
|
||||
request.term = 1
|
||||
}
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
ip: request.term,
|
||||
serv: $("#serv2").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
response(data.split(" "));
|
||||
}
|
||||
} );
|
||||
},
|
||||
autoFocus: true,
|
||||
minLength: -1
|
||||
});
|
||||
$( "#backends" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
if ( request.term == "" ) {
|
||||
request.term = 1
|
||||
}
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
backend: request.term,
|
||||
serv: $("#serv2").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
success: function( data ) {
|
||||
response(data.split('<br>'));
|
||||
}
|
||||
} );
|
||||
},
|
||||
autoFocus: true,
|
||||
minLength: -1
|
||||
});
|
||||
$( "#blacklist-hide-input" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
if ( request.term == "" ) {
|
||||
request.term = 1
|
||||
}
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
get_lists: request.term,
|
||||
color: "black",
|
||||
group: $("#group").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
response(data.split(" "));
|
||||
}
|
||||
} );
|
||||
},
|
||||
autoFocus: true,
|
||||
minLength: -1
|
||||
});
|
||||
$( "#blacklist-hide-input1" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
if ( request.term == "" ) {
|
||||
request.term = 1
|
||||
}
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
get_lists: request.term,
|
||||
color: "black",
|
||||
group: $("#group").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
response(data.split(" "));
|
||||
}
|
||||
} );
|
||||
},
|
||||
autoFocus: true,
|
||||
minLength: -1
|
||||
});
|
||||
$( "#new-option" ).autocomplete({
|
||||
source: availableTags,
|
||||
autoFocus: true,
|
||||
minLength: -1,
|
||||
select: function( event, ui ) {
|
||||
$("#new-option").append(ui.item.value + " ")
|
||||
}
|
||||
});
|
||||
$( "#option_table input" ).change(function() {
|
||||
var id = $(this).attr('id').split('-');
|
||||
updateOptions(id[2])
|
||||
console.log(id)
|
||||
});
|
||||
$( "#options" ).autocomplete({
|
||||
source: availableTags,
|
||||
autoFocus: true,
|
||||
minLength: -1,
|
||||
select: function( event, ui ) {
|
||||
$("#optionsInput").append(ui.item.value + " ");
|
||||
$("#options").empty();
|
||||
}
|
||||
});
|
||||
$( "#saved-options" ).autocomplete({
|
||||
dataType: "json",
|
||||
source: "sql.py?getoption="+$('#newoptiongroup').val(),
|
||||
autoFocus: true,
|
||||
minLength: -1,
|
||||
select: function( event, ui ) {
|
||||
$("#optionsInput").append(ui.item.value + " \n");
|
||||
$( "#saved-options" ).reset();
|
||||
}
|
||||
});
|
||||
$( "#options1" ).autocomplete({
|
||||
source: availableTags,
|
||||
autoFocus: true,
|
||||
minLength: -1,
|
||||
select: function( event, ui ) {
|
||||
$("#optionsInput1").append(ui.item.value + " ")
|
||||
}
|
||||
});
|
||||
$( "#saved-options1" ).autocomplete({
|
||||
dataType: "json",
|
||||
source: "sql.py?getoption="+$('#newoptiongroup').val(),
|
||||
autoFocus: true,
|
||||
minLength: -1,
|
||||
select: function( event, ui ) {
|
||||
$("#optionsInput1").append(ui.item.value + " \n");
|
||||
$( "#options1" ).reset();
|
||||
}
|
||||
});
|
||||
$( "#options2" ).autocomplete({
|
||||
source: availableTags,
|
||||
autoFocus: true,
|
||||
minLength: -1,
|
||||
select: function( event, ui ) {
|
||||
$("#optionsInput2").append(ui.item.value + " ")
|
||||
}
|
||||
});
|
||||
$( "#saved-options2" ).autocomplete({
|
||||
dataType: "json",
|
||||
source: "sql.py?getoption="+$('#newoptiongroup').val(),
|
||||
autoFocus: true,
|
||||
minLength: -1,
|
||||
select: function( event, ui ) {
|
||||
$("#optionsInput2").append(ui.item.value + " \n");
|
||||
$( "#saved-options2" ).reset();
|
||||
}
|
||||
});
|
||||
$('#add-option-button').click(function() {
|
||||
if ($('#option-add-table').css('display', 'none')) {
|
||||
$('#option-add-table').show("blind", "fast");
|
||||
}
|
||||
});
|
||||
$('#add-option-new').click(function() {
|
||||
$('#error').remove();
|
||||
$('.alert-danger').remove();
|
||||
$.ajax( {
|
||||
|
||||
url: "sql.py",
|
||||
data: {
|
||||
newtoption: $('#new-option').val(),
|
||||
newoptiongroup: $('#newoptiongroup').val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
if (data.indexOf('error') != '-1') {
|
||||
$("#ajax-option").append(data);
|
||||
$('#errorMess').click(function() {
|
||||
$('#error').remove();
|
||||
$('.alert-danger').remove();
|
||||
});
|
||||
} else {
|
||||
$("#option_table").append(data);
|
||||
setTimeout(function() {
|
||||
$( ".newoption" ).removeClass( "update" );
|
||||
}, 2500 );
|
||||
$.getScript("/inc/fontawesome.min.js");
|
||||
}
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
||||
var forward_for_var = "option forwardfor if-none\n";
|
||||
$('#forward_for').click(function() {
|
||||
if($('#optionsInput').val().indexOf(forward_for_var) == '-1') {
|
||||
$("#optionsInput").append(forward_for_var)
|
||||
} else {
|
||||
replace_text("#optionsInput", forward_for_var);
|
||||
}
|
||||
});
|
||||
$('#forward_for1').click(function() {
|
||||
if($('#optionsInput1').val().indexOf(forward_for_var) == '-1') {
|
||||
$("#optionsInput1").append(forward_for_var)
|
||||
} else {
|
||||
replace_text("#optionsInput1", forward_for_var);
|
||||
}
|
||||
});
|
||||
$('#forward_for2').click(function() {
|
||||
if($('#optionsInput2').val().indexOf(forward_for_var) == '-1') {
|
||||
$("#optionsInput2").append(forward_for_var)
|
||||
} else {
|
||||
replace_text("#optionsInput2", forward_for_var);
|
||||
}
|
||||
});
|
||||
var redispatch_var = "option redispatch\n";
|
||||
$('#redispatch').click(function() {
|
||||
if($('#optionsInput').val().indexOf(redispatch_var) == '-1') {
|
||||
$("#optionsInput").append(redispatch_var)
|
||||
} else {
|
||||
replace_text("#optionsInput", redispatch_var);
|
||||
}
|
||||
});
|
||||
$('#redispatch2').click(function() {
|
||||
if($('#optionsInput2').val().indexOf(redispatch_var) == '-1') {
|
||||
$("#optionsInput2").append(redispatch_var)
|
||||
} else {
|
||||
replace_text("#optionsInput2", redispatch_var);
|
||||
}
|
||||
});
|
||||
var slow_atack = "option http-buffer-request\ntimeout http-request 10s\n"
|
||||
$('#slow_atack').click(function() {
|
||||
if($('#optionsInput').val().indexOf(slow_atack) == '-1') {
|
||||
$("#optionsInput").append(slow_atack)
|
||||
} else {
|
||||
replace_text("#optionsInput", slow_atack);
|
||||
}
|
||||
});
|
||||
$('#slow_atack1').click(function() {
|
||||
if($('#optionsInput1').val().indexOf(slow_atack) == '-1') {
|
||||
$("#optionsInput1").append(slow_atack)
|
||||
} else {
|
||||
replace_text("#optionsInput1", slow_atack);
|
||||
}
|
||||
});
|
||||
$("#ddos").checkboxradio( "disable" );
|
||||
$("#ddos1").checkboxradio( "disable" );
|
||||
$("#ddos2").checkboxradio( "disable" );
|
||||
$( "#name" ).change(function() {
|
||||
table_name = $('#name').val();
|
||||
table_name = $.trim(table_name)
|
||||
if($('#name').val() != "") {
|
||||
$("#ddos").checkboxradio( "enable" );
|
||||
} else {
|
||||
$("#ddos").checkboxradio( "disable" );
|
||||
}
|
||||
});
|
||||
$( "#new_frontend" ).change(function() {
|
||||
table_name = $('#new_frontend').val();
|
||||
table_name = $.trim(table_name)
|
||||
if($('#new_frontend').val() != "") {
|
||||
$("#ddos1").checkboxradio( "enable" );
|
||||
} else {
|
||||
$("#ddos1").checkboxradio( "disable" );
|
||||
}
|
||||
});
|
||||
|
||||
$('#ddos').click(function() {
|
||||
if($('#name').val() == "") {
|
||||
$("#optionsInput").append(ddos_var)
|
||||
}
|
||||
var ddos_var = "#Start config for DDOS atack protecte\n"+
|
||||
"stick-table type ip size 1m expire 1m store gpc0,http_req_rate(10s),http_err_rate(10s)\n"+
|
||||
"tcp-request connection track-sc1 src\n"+
|
||||
"tcp-request connection reject if { sc1_get_gpc0 gt 0 }\n"+
|
||||
"# Abuser means more than 100reqs/10s\n"+
|
||||
"acl abuse sc1_http_req_rate("+table_name+") ge 100\n"+
|
||||
"acl flag_abuser sc1_inc_gpc0("+table_name+")\n"+
|
||||
"tcp-request content reject if abuse flag_abuser\n"+
|
||||
"#End config for DDOS\n";
|
||||
if($('#optionsInput').val().indexOf(ddos_var) == '-1') {
|
||||
if($('#name').val() == "") {
|
||||
alert("First set Listen name")
|
||||
} else {
|
||||
$("#optionsInput").append(ddos_var);
|
||||
}
|
||||
} else {
|
||||
replace_text("#optionsInput", ddos_var);
|
||||
}
|
||||
});
|
||||
$('#ddos1').click(function() {
|
||||
if($('#new_frontend').val() == "") {
|
||||
$("#optionsInput1").append(ddos_var)
|
||||
}
|
||||
var ddos_var = "#Start config for DDOS atack protecte\n"+
|
||||
"stick-table type ip size 1m expire 1m store gpc0,http_req_rate(10s),http_err_rate(10s)\n"+
|
||||
"tcp-request connection track-sc1 src\n"+
|
||||
"tcp-request connection reject if { sc1_get_gpc0 gt 0 }\n"+
|
||||
"# Abuser means more than 100reqs/10s\n"+
|
||||
"acl abuse sc1_http_req_rate("+table_name+") ge 100\n"+
|
||||
"acl flag_abuser sc1_inc_gpc0("+table_name+")\n"+
|
||||
"tcp-request content reject if abuse flag_abuser\n"+
|
||||
"#End config for DDOS\n";
|
||||
if($('#optionsInput1').val().indexOf(ddos_var) == '-1') {
|
||||
if($('#new_frontend').val() == "") {
|
||||
alert("First set Frontend name")
|
||||
} else {
|
||||
$("#optionsInput1").append(ddos_var)
|
||||
}
|
||||
} else {
|
||||
replace_text("#optionsInput1", ddos_var);
|
||||
}
|
||||
});
|
||||
|
||||
$( "#blacklist_checkbox" ).click( function(){
|
||||
if ($('#blacklist_checkbox').is(':checked')) {
|
||||
$( "#blacklist-hide" ).show( "fast" );
|
||||
$( "#blacklist-hide-input" ).attr('required',true);
|
||||
} else {
|
||||
$( "#blacklist-hide" ).hide( "fast" );
|
||||
$( "#blacklist-hide-input" ).prop('required',false);
|
||||
}
|
||||
});
|
||||
$( "#blacklist_checkbox1" ).click( function(){
|
||||
if ($('#blacklist_checkbox1').is(':checked')) {
|
||||
$( "#blacklist-hide1" ).show( "fast" );
|
||||
$( "#blacklist-hide-input1" ).attr('required',true);
|
||||
} else {
|
||||
$( "#blacklist-hide1" ).hide( "fast" );
|
||||
$( "#blacklist-hide-input1" ).prop('required',false);
|
||||
}
|
||||
});
|
||||
var location = window.location.href;
|
||||
var cur_url = '/app/' + location.split('/').pop();
|
||||
cur_url = cur_url.split('?');
|
||||
cur_url = cur_url[0].split('#');
|
||||
if (cur_url[0] == "/app/add.py") {
|
||||
$("#cache").checkboxradio( "disable" );
|
||||
$("#waf").checkboxradio( "disable" );
|
||||
$( "#serv" ).on('selectmenuchange',function() {
|
||||
change_select_acceleration("");
|
||||
change_select_waf("");
|
||||
});
|
||||
|
||||
$("#cache2").checkboxradio( "disable" );
|
||||
$("#waf2").checkboxradio( "disable" );
|
||||
$( "#serv2" ).on('selectmenuchange',function() {
|
||||
change_select_acceleration("2");
|
||||
change_select_waf("2");
|
||||
});
|
||||
|
||||
$("#cache3").checkboxradio( "disable" );
|
||||
$( "#serv3" ).on('selectmenuchange',function() {
|
||||
change_select_acceleration("3");
|
||||
});
|
||||
|
||||
$( "#add1" ).on( "click", function() {
|
||||
$('.menu li ul li').each(function () {
|
||||
$(this).find('a').css('padding-left', '20px')
|
||||
$(this).find('a').css('border-left', '0px solid #5D9CEB');
|
||||
$(this).children("#add1").css('padding-left', '30px');
|
||||
$(this).children("#add1").css('border-left', '4px solid #5D9CEB');
|
||||
});
|
||||
$( "#tabs" ).tabs( "option", "active", 0 );
|
||||
} );
|
||||
// $( "#add2" ).on( "click", function() {
|
||||
// $('.menu li ul li').each(function () {
|
||||
// $(this).find('a').css('padding-left', '20px')
|
||||
// $(this).find('a').css('border-left', '0px solid #5D9CEB');
|
||||
// $(this).children("#add2").css('padding-left', '30px');
|
||||
// $(this).children("#add2").css('border-left', '4px solid #5D9CEB');
|
||||
// });
|
||||
// $( "#tabs" ).tabs( "option", "active", 1 );
|
||||
// } );
|
||||
// $( "#add3" ).on( "click", function() {
|
||||
// $('.menu li ul li').each(function () {
|
||||
// $(this).find('a').css('padding-left', '20px')
|
||||
// $(this).find('a').css('border-left', '0px solid #5D9CEB');
|
||||
// $(this).children("#add3").css('padding-left', '30px');
|
||||
// $(this).children("#add3").css('border-left', '4px solid #5D9CEB');
|
||||
// });
|
||||
// $( "#tabs" ).tabs( "option", "active", 2 );
|
||||
// } );
|
||||
$( "#add4" ).on( "click", function() {
|
||||
$('.menu li ul li').each(function () {
|
||||
$(this).find('a').css('padding-left', '20px')
|
||||
$(this).find('a').css('border-left', '0px solid #5D9CEB');
|
||||
$(this).children("#add4").css('padding-left', '30px');;
|
||||
$(this).children("#add4").css('border-left', '4px solid #5D9CEB');
|
||||
});
|
||||
$( "#tabs" ).tabs( "option", "active", 4 );
|
||||
} );
|
||||
$( "#add5" ).on( "click", function() {
|
||||
$('.menu li ul li').each(function () {
|
||||
$(this).find('a').css('padding-left', '20px')
|
||||
$(this).find('a').css('border-left', '0px solid #5D9CEB');
|
||||
$(this).children("#add5").css('padding-left', '30px');;
|
||||
$(this).children("#add5").css('border-left', '4px solid #5D9CEB');
|
||||
});
|
||||
$( "#tabs" ).tabs( "option", "active", 5 );
|
||||
} );
|
||||
}
|
||||
|
||||
$( "#path-cert-listen" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
getcerts:1,
|
||||
serv: $("#serv").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
response(data.split(" "));
|
||||
}
|
||||
} );
|
||||
},
|
||||
autoFocus: true,
|
||||
minLength: -1
|
||||
});
|
||||
$( "#path-cert-frontend" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
getcerts:1,
|
||||
serv: $("#serv2").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
response(data.split(" "));
|
||||
}
|
||||
} );
|
||||
},
|
||||
autoFocus: true,
|
||||
minLength: -1
|
||||
});
|
||||
$( "#interface" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
showif:1,
|
||||
serv: $("#master").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
response(data.split(" "));
|
||||
}
|
||||
} );
|
||||
},
|
||||
autoFocus: true,
|
||||
minLength: -1
|
||||
});
|
||||
$( "#interface-add" ).autocomplete({
|
||||
source: function( request, response ) {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
showif:1,
|
||||
serv: $("#master-add").val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
response(data.split(" "));
|
||||
}
|
||||
} );
|
||||
},
|
||||
autoFocus: true,
|
||||
minLength: -1
|
||||
});
|
||||
$( "#ssl_key_upload" ).click(function() {
|
||||
$('.alert-danger').remove();
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
serv: $('#serv4').val(),
|
||||
ssl_cert: $('#ssl_cert').val(),
|
||||
ssl_name: $('#ssl_name').val(),
|
||||
token: $('#token').val()
|
||||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if (data.indexOf('danger') != '-1') {
|
||||
$("#ajax-ssl").html(data);
|
||||
} else if (data.indexOf('success') != '-1') {
|
||||
$('.alert-danger').remove();
|
||||
$( "#ajax-ssl").html(data);
|
||||
setTimeout(function() {
|
||||
$( "#ajax-ssl").html("");
|
||||
}, 2500 );
|
||||
} else {
|
||||
$("#ajax-ssl").html('<div class="alert alert-danger">Something wrong, check and try again</div>');
|
||||
}
|
||||
}
|
||||
} );
|
||||
});
|
||||
$('#ssl_key_view').click(function() {
|
||||
$.ajax( {
|
||||
url: "options.py",
|
||||
data: {
|
||||
serv: $('#serv5').val(),
|
||||
getcerts: "viewcert",
|
||||
token: $('#token').val()
|
||||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
if (data.indexOf('danger') != '-1') {
|
||||
$("#ajax-show-ssl").html(data);
|
||||
} else {
|
||||
$('.alert-danger').remove();
|
||||
var i;
|
||||
var new_data = "";
|
||||
data = data.split("\n");
|
||||
|
||||
for (i = 0; i < data.length; i++) {
|
||||
|
||||
new_data += ' <a onclick="view_ssl(\''+data[i]+'\')" style="cursor: pointer;" title="View this cert">'+data[i]+'</a> '
|
||||
}
|
||||
$("#ajax-show-ssl").html("<b>"+new_data+"</b>");
|
||||
}
|
||||
}
|
||||
} );
|
||||
});
|
||||
var add_server_var = '<br /><input name="servers" title="Backend port" size=14 placeholder="xxx.xxx.xxx.xxx" class="form-control">: <input name="server_port" title="Backend port" size=1 placeholder="yyy" class="form-control">'
|
||||
$('#add-server-input').click(function() {
|
||||
$('#servers').append(add_server_var);
|
||||
});
|
||||
$('#add-server-input2').click(function() {
|
||||
$('#servers2').append(add_server_var);
|
||||
});
|
||||
$('.advance-show').click(function() {
|
||||
$('.advance-show').fadeOut();
|
||||
$('.advance').fadeIn();
|
||||
});
|
||||
$('#ssl_offloading').click(function() {
|
||||
if($('#optionsInput').val().indexOf('ssl_fc ') == '-1') {
|
||||
$("#optionsInput").append(ssl_offloading_var)
|
||||
} else {
|
||||
replace_text("#optionsInput", ssl_offloading_var);
|
||||
}
|
||||
});
|
||||
$('#ssl_offloading1').click(function() {
|
||||
if($('#optionsInput1').val().indexOf('ssl_fc ') == '-1') {
|
||||
$("#optionsInput1").append(ssl_offloading_var)
|
||||
} else {
|
||||
replace_text("#optionsInput1", ssl_offloading_var);
|
||||
}
|
||||
|
||||
});
|
||||
$('#ssl_offloading2').click(function() {
|
||||
if($('#optionsInput2').val().indexOf('ssl_fc ') == '-1') {
|
||||
$("#optionsInput2").append(ssl_offloading_var)
|
||||
} else {
|
||||
replace_text("#optionsInput2", ssl_offloading_var);
|
||||
}
|
||||
});
|
||||
|
||||
$( ".redirectListen" ).on( "click", function() {
|
||||
resetProxySettings()
|
||||
$( "#tabs" ).tabs( "option", "active", 1 );
|
||||
} );
|
||||
$( ".redirectFrontend" ).on( "click", function() {
|
||||
resetProxySettings()
|
||||
$( "#tabs" ).tabs( "option", "active", 2 );
|
||||
} );
|
||||
$( ".redirectBackend" ).on( "click", function() {
|
||||
resetProxySettings()
|
||||
$( "#tabs" ).tabs( "option", "active", 3 );
|
||||
} );
|
||||
$( ".redirectSsl" ).on( "click", function() {
|
||||
$( "#tabs" ).tabs( "option", "active", 4 );
|
||||
} );
|
||||
|
||||
$( "#create-http-listen" ).on( "click", function() {
|
||||
resetProxySettings();
|
||||
createHttp(1, 'listen');
|
||||
});
|
||||
$( "#create-http-frontend" ).on( "click", function() {
|
||||
resetProxySettings();
|
||||
createHttp(2, 'frontend');
|
||||
});
|
||||
$( "#create-http-backend" ).on( "click", function() {
|
||||
resetProxySettings();
|
||||
createHttp(3, 'backend');
|
||||
});
|
||||
$( "#create-ssl-listen" ).on( "click", function() {
|
||||
resetProxySettings();
|
||||
createSsl(1, 'listen');
|
||||
$('#ssl_offloading').prop( "checked", true );
|
||||
$('#ssl_offloading').checkboxradio("refresh")
|
||||
$("#optionsInput").append(ssl_offloading_var)
|
||||
});
|
||||
$( "#create-ssl-frontend" ).on( "click", function() {
|
||||
resetProxySettings();
|
||||
createSsl(2, 'frontend');
|
||||
$('#ssl_offloading1').prop( "checked", true );
|
||||
$('#ssl_offloading1').checkboxradio("refresh")
|
||||
$("#optionsInput1").append(ssl_offloading_var)
|
||||
});
|
||||
$( "#create-ssl-backend" ).on( "click", function() {
|
||||
resetProxySettings();
|
||||
createSsl(3, 'backend');
|
||||
$('#ssl_offloading2').prop( "checked", true );
|
||||
$('#ssl_offloading2').checkboxradio("refresh");
|
||||
$("#optionsInput2").append(ssl_offloading_var);
|
||||
});
|
||||
$( "#create-https-listen" ).on( "click", function() {
|
||||
resetProxySettings();
|
||||
createHttps(1, 'listen');
|
||||
});
|
||||
$( "#create-https-frontend" ).on( "click", function() {
|
||||
resetProxySettings();
|
||||
createHttps(2, 'frontend');
|
||||
});
|
||||
$( "#create-https-backend" ).on( "click", function() {
|
||||
resetProxySettings();
|
||||
createHttps(3, 'backend');
|
||||
});
|
||||
});
|
||||
function resetProxySettings() {
|
||||
$('[name=port]').val('');
|
||||
$('[name=server_port]').val('');
|
||||
$('input:checkbox').prop( "checked", false );
|
||||
$('[name=ssl-check').prop( "checked", true );
|
||||
$('input:checkbox').checkboxradio("refresh");
|
||||
$('.advance-show').fadeIn();
|
||||
$('.advance').fadeOut();
|
||||
$('[name=mode').val('http');
|
||||
$('select').selectmenu('refresh');
|
||||
replace_text("#optionsInput", ssl_offloading_var);
|
||||
replace_text("#optionsInput1", ssl_offloading_var);
|
||||
replace_text("#optionsInput2", ssl_offloading_var);
|
||||
}
|
||||
function createHttp(TabId, proxy) {
|
||||
$('[name=port]').val('80');
|
||||
$('[name=server_port]').val('80');
|
||||
$( "#tabs" ).tabs( "option", "active", TabId );
|
||||
history.pushState('Add '+proxy, 'Add '+proxy, 'add.py#'+proxy)
|
||||
}
|
||||
function createSsl(TabId, proxy) {
|
||||
$('[name=port]').val('443');
|
||||
$('[name=server_port]').val('80');
|
||||
$('.advance-show').fadeOut();
|
||||
$('.advance').fadeIn()
|
||||
$( "#tabs" ).tabs( "option", "active", TabId );
|
||||
$( "#https-hide-"+proxy).show("fast");
|
||||
$('#https-'+proxy).prop( "checked", true );
|
||||
$('#https-'+proxy).checkboxradio("refresh")
|
||||
history.pushState('Add'+proxy, 'Add'+proxy, 'add.py#'+proxy)
|
||||
}
|
||||
function createHttps(TabId, proxy) {
|
||||
$('[name=port]').val('443');
|
||||
$('[name=server_port]').val('443');
|
||||
$('.advance-show').fadeOut();
|
||||
$('.advance').fadeIn();
|
||||
$( "#tabs" ).tabs( "option", "active", TabId );
|
||||
$('#'+proxy+'-mode-select').val('tcp');
|
||||
$('#'+proxy+'-mode-select').selectmenu('refresh');
|
||||
history.pushState('Add'+proxy, 'Add'+proxy, 'add.py#'+proxy)
|
||||
}
|
||||
|
969
inc/script.js
|
@ -35,7 +35,6 @@ form {
|
|||
pre {
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.icon {
|
||||
max-width: 20px;
|
||||
margin-left: 2px;
|
||||
|
@ -325,19 +324,20 @@ pre {
|
|||
width: 46%;
|
||||
min-width: 600px;
|
||||
max-width: 50%;
|
||||
border: 1px solid #ddd;
|
||||
/* border: 1px solid #A4C7F5; */
|
||||
height: 160px;
|
||||
float: left;
|
||||
margin: 20px;
|
||||
}
|
||||
.overviewHead {
|
||||
border-radius: 5px;
|
||||
background-color: #F9FFF8;
|
||||
background-color: #fbfbfb;
|
||||
font-weight: bold;
|
||||
}
|
||||
.overview-wi .overviewHead {
|
||||
border: 1px solid #ddd;
|
||||
border-bottom: 1px solid #A4C7F5;
|
||||
}
|
||||
|
||||
.overview tr{
|
||||
border-bottom: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
|
@ -529,8 +529,7 @@ ul{
|
|||
background-size: 0 100%,100% 100%;
|
||||
border: 0;
|
||||
transition: background 1s ease-out;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
font-size: 15px;
|
||||
}
|
||||
.ui-button {
|
||||
padding-left: 10px !important;
|
||||
|
@ -696,8 +695,8 @@ label {
|
|||
background-color: #f3f8fb;
|
||||
}
|
||||
.div-server {
|
||||
background-color: #f9fff8;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #fbfbfb;
|
||||
border: 1px solid #A4C7F5;
|
||||
width: 25em;
|
||||
padding: 20px;
|
||||
margin: 20px;
|
||||
|
@ -707,9 +706,10 @@ label {
|
|||
float: left;
|
||||
}
|
||||
.server-name {
|
||||
padding-bottom: 5px;
|
||||
font-size: 1.4em;
|
||||
color: #5d9ceb;
|
||||
padding-bottom: 3px;
|
||||
font-size: 1.4em;
|
||||
color: #5d9ceb;
|
||||
border-bottom: 1px solid #A4C7F5;
|
||||
}
|
||||
.server-status {
|
||||
border-radius: 50% 50%;
|
||||
|
@ -724,8 +724,9 @@ label {
|
|||
margin-top: 6px;
|
||||
}
|
||||
.server-desc {
|
||||
padding-bottom: 2em;
|
||||
color: #999;
|
||||
padding-bottom: 10px;
|
||||
color: #999;
|
||||
padding-top: 10px;;
|
||||
}
|
||||
.server-act-links a {
|
||||
margin-right: 4.3px !important
|
||||
|
@ -733,6 +734,10 @@ label {
|
|||
.server-act-links a:last-child {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
#left-collumn, #middle-collumn, #right-collumn {
|
||||
width: 30%;
|
||||
float: left;
|
||||
}
|
||||
.ajax-server {
|
||||
margin: 25px;
|
||||
margin-left: 32em;
|
||||
|
|
76
inc/users.js
|
@ -290,7 +290,9 @@ $( function() {
|
|||
$('#add-group-button').click(function() {
|
||||
if ($('#group-add-table').css('display', 'none')) {
|
||||
$('#group-add-table').show("blind", "fast");
|
||||
}
|
||||
} else {
|
||||
$('#group-add-table').hide("blind", "fast");
|
||||
}
|
||||
});
|
||||
var addUserDialog = $( "#user-add-table" ).dialog({
|
||||
autoOpen: false,
|
||||
|
@ -893,7 +895,6 @@ function updateUser(id) {
|
|||
url: "sql.py",
|
||||
data: {
|
||||
updateuser: $('#login-'+id).val(),
|
||||
password: $('#password-'+id).val(),
|
||||
email: $('#email-'+id).val(),
|
||||
role: $('#role-'+id).val(),
|
||||
usergroup: usergroup,
|
||||
|
@ -1030,10 +1031,7 @@ function uploadSsh() {
|
|||
$("#ajax-ssh").html(data);
|
||||
} else if (data.indexOf('success') != '-1') {
|
||||
$('.alert-danger').remove();
|
||||
$("#ajax-ssh").html(data);
|
||||
setTimeout(function() {
|
||||
$( "#ajax-ssh").html( "" );
|
||||
}, 2500 );
|
||||
$("#ajax-ssh").html(data);
|
||||
} else {
|
||||
$("#ajax-ssh").html('<div class="alert alert-danger">Something wrong, check and try again</div>');
|
||||
}
|
||||
|
@ -1152,4 +1150,70 @@ function checkSshConnect(ip) {
|
|||
});
|
||||
}
|
||||
} );
|
||||
}
|
||||
function openChangeUserPasswordDialog(id) {
|
||||
changeUserPasswordDialog(id);
|
||||
}
|
||||
function changeUserPasswordDialog(id) {
|
||||
$( "#user-change-password-table" ).dialog({
|
||||
autoOpen: true,
|
||||
resizable: false,
|
||||
height: "auto",
|
||||
width: 600,
|
||||
modal: true,
|
||||
title: "Change "+$('#login-'+id).val()+" password",
|
||||
show: {
|
||||
effect: "fade",
|
||||
duration: 200
|
||||
},
|
||||
hide: {
|
||||
effect: "fade",
|
||||
duration: 200
|
||||
},
|
||||
// beforeClose: function( event, ui ) {return changeUserPassword(id);},
|
||||
buttons: {
|
||||
"Change": function() {
|
||||
changeUserPassword(id, $(this));
|
||||
},
|
||||
Cancel: function() {
|
||||
$( this ).dialog( "close" );
|
||||
$('#missmatchpass').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function changeUserPassword(id, d) {
|
||||
var pass = $('#change-password').val();
|
||||
var pass2 = $('#change2-password').val();
|
||||
if(pass != pass2) {
|
||||
$('#missmatchpass').show();
|
||||
} else {
|
||||
$('#missmatchpass').hide();
|
||||
$('#error').remove();
|
||||
$.ajax( {
|
||||
url: "sql.py",
|
||||
data: {
|
||||
updatepassowrd: pass,
|
||||
id: id
|
||||
},
|
||||
type: "GET",
|
||||
success: function( data ) {
|
||||
data = data.replace(/\s+/g,' ');
|
||||
if (data.indexOf('error') != '-1') {
|
||||
$("#ajax-users").append(data);
|
||||
$('#errorMess').click(function() {
|
||||
$('#error').remove();
|
||||
$('.alert-danger').remove();
|
||||
});
|
||||
} else {
|
||||
$('.alert-danger').remove();
|
||||
$("#user-"+id).addClass( "update", 1000 );
|
||||
setTimeout(function() {
|
||||
$( "#user-"+id ).removeClass( "update" );
|
||||
}, 2500 );
|
||||
d.dialog( "close" );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|