mirror of https://github.com/Aidaho12/haproxy-wi
parent
2558528a40
commit
f87ec83348
|
@ -180,8 +180,16 @@ elif form.getvalue('mode') is not None:
|
||||||
try:
|
try:
|
||||||
if a == '1':
|
if a == '1':
|
||||||
acl_if_word = 'hdr_beg(host) -i '
|
acl_if_word = 'hdr_beg(host) -i '
|
||||||
|
if form.getvalue('ssl') == "https" and form.getvalue('mode') != "tcp":
|
||||||
|
acl_if_word = 'ssl_fc_sni -i '
|
||||||
|
if form.getvalue('mode') == "tcp":
|
||||||
|
acl_if_word = 'req.ssl_sni -i '
|
||||||
elif a == '2':
|
elif a == '2':
|
||||||
acl_if_word = 'hdr_end(host) -i '
|
acl_if_word = 'hdr_end(host) -i '
|
||||||
|
if form.getvalue('ssl') == "https" and form.getvalue('mode') != "tcp":
|
||||||
|
acl_if_word = 'ssl_fc_sni -i '
|
||||||
|
if form.getvalue('mode') == "tcp":
|
||||||
|
acl_if_word = 'req.ssl_sni -i '
|
||||||
elif a == '3':
|
elif a == '3':
|
||||||
acl_if_word = 'path_beg -i '
|
acl_if_word = 'path_beg -i '
|
||||||
elif a == '4':
|
elif a == '4':
|
||||||
|
|
|
@ -127,13 +127,13 @@ def create_table(**kwargs):
|
||||||
);
|
);
|
||||||
CREATE TABLE IF NOT EXISTS `uuid` (`user_id` INTEGER NOT NULL, `uuid` varchar ( 64 ),`exp` timestamp default '0000-00-00 00:00:00');
|
CREATE TABLE IF NOT EXISTS `uuid` (`user_id` INTEGER NOT NULL, `uuid` varchar ( 64 ),`exp` timestamp default '0000-00-00 00:00:00');
|
||||||
CREATE TABLE IF NOT EXISTS `token` (`user_id` INTEGER, `token` varchar(64), `exp` timestamp default '0000-00-00 00:00:00');
|
CREATE TABLE IF NOT EXISTS `token` (`user_id` INTEGER, `token` varchar(64), `exp` timestamp default '0000-00-00 00:00:00');
|
||||||
CREATE TABLE IF NOT EXISTS `telegram` (`id` integer primary key autoincrement, `token` VARCHAR ( 64 ), `chanel_name` INTEGER NOT NULL DEFAULT 1, `groups` INTEGER NOT NULL DEFAULT 1);
|
CREATE TABLE IF NOT EXISTS `telegram` (`id` integer primary key autoincrement, `token` VARCHAR (64), `chanel_name` INTEGER NOT NULL DEFAULT 1, `groups` INTEGER NOT NULL DEFAULT 1);
|
||||||
CREATE TABLE IF NOT EXISTS `metrics` (`serv` varchar(64), curr_con INTEGER, cur_ssl_con INTEGER, sess_rate INTEGER, max_sess_rate INTEGER,`date` timestamp default '0000-00-00 00:00:00');
|
CREATE TABLE IF NOT EXISTS `metrics` (`serv` varchar(64), curr_con INTEGER, cur_ssl_con INTEGER, sess_rate INTEGER, max_sess_rate INTEGER,`date` timestamp default '0000-00-00 00:00:00');
|
||||||
CREATE TABLE IF NOT EXISTS `settings` (`param` varchar(64), value varchar(64), section varchar(64), `desc` varchar(100), `group` INTEGER NOT NULL DEFAULT 1, UNIQUE(param, `group`));
|
CREATE TABLE IF NOT EXISTS `settings` (`param` varchar(64), value varchar(64), section varchar(64), `desc` varchar(100), `group` INTEGER NOT NULL DEFAULT 1, UNIQUE(param, `group`));
|
||||||
CREATE TABLE IF NOT EXISTS `version` (`version` varchar(64));
|
CREATE TABLE IF NOT EXISTS `version` (`version` varchar(64));
|
||||||
CREATE TABLE IF NOT EXISTS `options` ( `id` INTEGER NOT NULL, `options` VARCHAR ( 64 ), `groups` VARCHAR ( 120 ), PRIMARY KEY(`id`));
|
CREATE TABLE IF NOT EXISTS `options` (`id` INTEGER NOT NULL, `options` VARCHAR ( 64 ), `groups` VARCHAR ( 120 ), PRIMARY KEY(`id`));
|
||||||
CREATE TABLE IF NOT EXISTS `saved_servers` ( `id` INTEGER NOT NULL, `server` VARCHAR ( 64 ), `description` VARCHAR ( 120 ), `groups` VARCHAR ( 120 ), PRIMARY KEY(`id`));
|
CREATE TABLE IF NOT EXISTS `saved_servers` (`id` INTEGER NOT NULL, `server` VARCHAR ( 64 ), `description` VARCHAR ( 120 ), `groups` VARCHAR ( 120 ), PRIMARY KEY(`id`));
|
||||||
CREATE TABLE IF NOT EXISTS `backups` ( `id` INTEGER NOT NULL, `server` VARCHAR ( 64 ), `rhost` VARCHAR ( 120 ), `rpath` VARCHAR ( 120 ), `type` VARCHAR ( 120 ), `time` VARCHAR ( 120 ), cred INTEGER, `description` VARCHAR ( 120 ), PRIMARY KEY(`id`));
|
CREATE TABLE IF NOT EXISTS `backups` (`id` INTEGER NOT NULL, `server` VARCHAR ( 64 ), `rhost` VARCHAR ( 120 ), `rpath` VARCHAR ( 120 ), `type` VARCHAR ( 120 ), `time` VARCHAR ( 120 ), cred INTEGER, `description` VARCHAR ( 120 ), PRIMARY KEY(`id`));
|
||||||
CREATE TABLE IF NOT EXISTS `waf` (`server_id` INTEGER UNIQUE, metrics INTEGER);
|
CREATE TABLE IF NOT EXISTS `waf` (`server_id` INTEGER UNIQUE, metrics INTEGER);
|
||||||
CREATE TABLE IF NOT EXISTS `waf_metrics` (`serv` varchar(64), conn INTEGER, `date` DATETIME default '0000-00-00 00:00:00');
|
CREATE TABLE IF NOT EXISTS `waf_metrics` (`serv` varchar(64), conn INTEGER, `date` DATETIME default '0000-00-00 00:00:00');
|
||||||
CREATE TABLE IF NOT EXISTS user_groups(user_id INTEGER NOT NULL, user_group_id INTEGER NOT NULL, UNIQUE(user_id,user_group_id));
|
CREATE TABLE IF NOT EXISTS user_groups(user_id INTEGER NOT NULL, user_group_id INTEGER NOT NULL, UNIQUE(user_id,user_group_id));
|
||||||
|
@ -1046,6 +1046,25 @@ def update_db_v_4_5_8_2(**kwargs):
|
||||||
con.close()
|
con.close()
|
||||||
|
|
||||||
|
|
||||||
|
def update_db_v_4_5_9(**kwargs):
|
||||||
|
con, cur = get_cur()
|
||||||
|
sql = list()
|
||||||
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('smon_check_interval', '1', 'monitoring', 'SMON check interval, in minutes')")
|
||||||
|
sql.append("INSERT INTO settings (param, value, section, `desc`) values('checker_check_interval', '1', 'monitoring', 'Checker check interval, in minutes')")
|
||||||
|
for i in sql:
|
||||||
|
try:
|
||||||
|
cur.execute(i)
|
||||||
|
con.commit()
|
||||||
|
except sqltool.Error as e:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
if kwargs.get('silent') != 1:
|
||||||
|
print('Updating... DB has been updated to version 4.5.9')
|
||||||
|
cur.close()
|
||||||
|
con.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def update_ver(**kwargs):
|
def update_ver(**kwargs):
|
||||||
con, cur = get_cur()
|
con, cur = get_cur()
|
||||||
sql = """update version set version = '4.5.8.0'; """
|
sql = """update version set version = '4.5.8.0'; """
|
||||||
|
@ -1087,6 +1106,7 @@ def update_all():
|
||||||
update_db_v_4_5_8()
|
update_db_v_4_5_8()
|
||||||
update_db_v_4_5_8_1()
|
update_db_v_4_5_8_1()
|
||||||
update_db_v_4_5_8_2()
|
update_db_v_4_5_8_2()
|
||||||
|
update_db_v_4_5_9()
|
||||||
update_ver()
|
update_ver()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1119,6 +1139,7 @@ def update_all_silent():
|
||||||
update_db_v_4_5_8(silent=1)
|
update_db_v_4_5_8(silent=1)
|
||||||
update_db_v_4_5_8_1(silent=1)
|
update_db_v_4_5_8_1(silent=1)
|
||||||
update_db_v_4_5_8_2(silent=1)
|
update_db_v_4_5_8_2(silent=1)
|
||||||
|
update_db_v_4_5_9(silent=1)
|
||||||
update_ver()
|
update_ver()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -244,6 +244,18 @@
|
||||||
<a href="https://haproxy-wi.org/cabinet.py" class="footer-link" target="_blank" title="Private cabinet">Cabinet</a>
|
<a href="https://haproxy-wi.org/cabinet.py" class="footer-link" target="_blank" title="Private cabinet">Cabinet</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="show-user-settings">
|
||||||
|
<table class="overview">
|
||||||
|
<tr>
|
||||||
|
<td class="padding20" style="width: 60%">Disable alerting for this tab</td>
|
||||||
|
<td><label for="disable_alert_for_tab"></label><input type="checkbox" id="disable_alert_for_tab" />
|
||||||
|
</tr>
|
||||||
|
<tr class="even">
|
||||||
|
<td class="padding20" style="width: 60%">Disable alerting for all tabs</td>
|
||||||
|
<td><label for="disable_alert_for_all"></label><input type="checkbox" id="disable_alert_for_all" />
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
<div id="current-user-groups-dialog" style="display: none;">
|
<div id="current-user-groups-dialog" style="display: none;">
|
||||||
<div id="current-user-groups-form"></div>
|
<div id="current-user-groups-form"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,11 +8,14 @@
|
||||||
<input type="{{ type }}" name="{{name}}" value="{{ value|e }}" id="{{ id }}" size="{{size}}" style="{{style}}" {{readonly}} {{required}} {{autofocus}} placeholder="{{placeholder}}" title="{{title}}" class="{{class}}" autocomplete="off" />
|
<input type="{{ type }}" name="{{name}}" value="{{ value|e }}" id="{{ id }}" size="{{size}}" style="{{style}}" {{readonly}} {{required}} {{autofocus}} placeholder="{{placeholder}}" title="{{title}}" class="{{class}}" autocomplete="off" />
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{%- macro checkbox(id, name='', checked='', title='', value='', desc='') -%}
|
{%- macro checkbox(id, name='', checked='', title='', value='', desc='', disabled='') -%}
|
||||||
{% if name == '' %}
|
{% if name == '' %}
|
||||||
{% set name = id %}
|
{% set name = id %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<label for="{{id}}" title="{{title}}" class="{{id}}">{{desc}}</label><input name="{{name}}" type="checkbox" id="{{id}}" value="{{value|e}}" {{checked}} />
|
{% if disabled == 'true' %}
|
||||||
|
{% set disabled = 'disabled' %}
|
||||||
|
{% endif %}
|
||||||
|
<label for="{{id}}" title="{{title}}" class="{{id}}">{{desc}}</label><input name="{{name}}" type="checkbox" id="{{id}}" value="{{value|e}}" {{checked}} {{disabled}} />
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{%- macro select(id, values, name='', required='', first='', class='', selected='', disabled='true') -%}
|
{%- macro select(id, values, name='', required='', first='', class='', selected='', disabled='true') -%}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% if user %}
|
{% if user %}
|
||||||
<span id="changeCurrentGroup" class="menu-bar login" title="Change current group" style="margin-top: 7px;margin-left: -10px;cursor: pointer;"></span>
|
<span id="show-user-settings-button" class="menu-bar login" title="User settings" style="margin-top: 7px;margin-left: -10px;cursor: pointer;"></span>
|
||||||
<a href=/app/login.py?logout=logout title="Logout, user name: {{ user }}" class="login"> Logout</a>
|
<a href=/app/login.py?logout=logout title="Logout, user name: {{ user }}" class="login"> Logout</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href=/app/login.py title="Login" class="login"> Login</a>
|
<a href=/app/login.py title="Login" class="login"> Login</a>
|
||||||
|
|
Loading…
Reference in New Issue