mirror of https://github.com/Aidaho12/haproxy-wi
parent
03b8cbe4ba
commit
e9c28c95a7
|
@ -2246,3 +2246,37 @@ if form.getvalue('geoipserv') is not None:
|
||||||
|
|
||||||
cmd = ["ls " + haproxy_dir + "/geoip/"]
|
cmd = ["ls " + haproxy_dir + "/geoip/"]
|
||||||
print(funct.ssh_command(serv, cmd))
|
print(funct.ssh_command(serv, cmd))
|
||||||
|
|
||||||
|
if form.getvalue('geoip_install'):
|
||||||
|
serv = form.getvalue('geoip_install')
|
||||||
|
geoip_update = form.getvalue('geoip_update')
|
||||||
|
proxy = sql.get_setting('proxy')
|
||||||
|
maxmind_key = sql.get_setting('maxmind_key')
|
||||||
|
haproxy_dir = sql.get_setting('haproxy_dir')
|
||||||
|
script = 'install_geoip.sh'
|
||||||
|
ssh_enable, ssh_user_name, ssh_user_password, ssh_key_name = funct.return_ssh_keys_path(serv)
|
||||||
|
|
||||||
|
if ssh_enable == 0:
|
||||||
|
ssh_key_name = ''
|
||||||
|
|
||||||
|
servers = sql.select_servers(server=serv)
|
||||||
|
for server in servers:
|
||||||
|
ssh_port = str(server[10])
|
||||||
|
|
||||||
|
if proxy is not None and proxy != '' and proxy != 'None':
|
||||||
|
proxy_serv = proxy
|
||||||
|
else:
|
||||||
|
proxy_serv = ''
|
||||||
|
|
||||||
|
os.system("cp scripts/%s ." % script)
|
||||||
|
|
||||||
|
commands = ["chmod +x " + script + " && ./" + script + " PROXY=" + proxy_serv + " SSH_PORT=" + ssh_port +
|
||||||
|
" UPDATE=" + str(geoip_update) + " maxmind_key=" + maxmind_key + " haproxy_dir=" + haproxy_dir +
|
||||||
|
" HOST=" + str(serv) +" USER=" + str(ssh_user_name) + " PASS=" + str(ssh_user_password) +
|
||||||
|
" KEY=" + str(ssh_key_name)]
|
||||||
|
|
||||||
|
output, error = funct.subprocess_execute(commands[0])
|
||||||
|
|
||||||
|
funct.show_installation_output(error, output, 'GeoLite2 Database')
|
||||||
|
|
||||||
|
os.system("rm -f %s" % script)
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e -o pipefail
|
||||||
|
|
||||||
|
country_location="GeoLite2-Country-CSV_*/GeoLite2-Country-Locations-en.csv"
|
||||||
|
country_ip="GeoLite2-Country-CSV_*/GeoLite2-Country-Blocks-IPv4.csv"
|
||||||
|
haproxy_dir="{{haproxy_dir}}"
|
||||||
|
MAXMIND_LICENSE="{{maxmind_key}}"
|
||||||
|
|
||||||
|
cd /tmp
|
||||||
|
|
||||||
|
if [[ ! -d geo2lite ]]; then
|
||||||
|
mkdir geo2lite && cd geo2lite && mkdir subnets
|
||||||
|
else
|
||||||
|
cd geo2lite
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f geoip2lite.zip ]]; then
|
||||||
|
rm -f geoip2lite.zip
|
||||||
|
fi
|
||||||
|
|
||||||
|
wget "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=${MAXMIND_LICENSE}&suffix=zip" -qO geoip2lite.zip && unzip -oq geoip2lite.zip
|
||||||
|
|
||||||
|
|
||||||
|
function get_ips_by_country {
|
||||||
|
rm -f subnets/$2.subnets
|
||||||
|
cat $country_ip |grep $1 |awk -F"," '{print $1}' >> subnets/$2.subnets
|
||||||
|
}
|
||||||
|
|
||||||
|
while read line; do
|
||||||
|
country_code_dig=$(echo $line |awk -F"," '{print $1}')
|
||||||
|
country_code_buk=$(echo $line |awk -F"," '{print $5}')
|
||||||
|
if [[ $country_code_dig != '' ]] && [[ $country_code_buk != '' ]] && [[ $country_code_buk != 'country_iso_code' ]] ; then
|
||||||
|
get_ips_by_country $country_code_dig $country_code_buk
|
||||||
|
fi
|
||||||
|
|
||||||
|
done < $country_location
|
||||||
|
|
||||||
|
if [[ ! -d "$haproxy_dir"/geoip ]]; then
|
||||||
|
mkdir "$haproxy_dir"/geoip
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp subnets/* "$haproxy_dir"/geoip
|
|
@ -0,0 +1,45 @@
|
||||||
|
- hosts: "{{ variable_host }}"
|
||||||
|
become: yes
|
||||||
|
become_method: sudo
|
||||||
|
tasks:
|
||||||
|
- name: Set SSH port
|
||||||
|
set_fact:
|
||||||
|
ansible_port: "{{SSH_PORT}}"
|
||||||
|
|
||||||
|
- name: Creates directory
|
||||||
|
file:
|
||||||
|
path: "{{haproxy_dir}}/geoip"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Creates directory
|
||||||
|
file:
|
||||||
|
path: "{{haproxy_dir}}/scripts"
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Install wget
|
||||||
|
package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
|
environment:
|
||||||
|
http_proxy: "{{PROXY}}"
|
||||||
|
https_proxy: "{{PROXY}}"
|
||||||
|
with_items:
|
||||||
|
- wget
|
||||||
|
- unzip
|
||||||
|
|
||||||
|
- name: Copy GeoIP script in place.
|
||||||
|
template:
|
||||||
|
src: /var/www/haproxy-wi/app/scripts/ansible/roles/geoip.sh.j2
|
||||||
|
dest: "{{haproxy_dir}}/scripts/geoip.sh"
|
||||||
|
mode: 0777
|
||||||
|
|
||||||
|
- name: Execute the script
|
||||||
|
command: "{{haproxy_dir}}/scripts/geoip.sh"
|
||||||
|
|
||||||
|
- name: Update geoip every Wednesday
|
||||||
|
cron:
|
||||||
|
name: "Update geoip"
|
||||||
|
minute: "0"
|
||||||
|
hour: "01"
|
||||||
|
weekday: "3"
|
||||||
|
job: "{{haproxy_dir}}/scripts/geoip.sh"
|
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash
|
||||||
|
for ARGUMENT in "$@"
|
||||||
|
do
|
||||||
|
KEY=$(echo "$ARGUMENT" | cut -f1 -d=)
|
||||||
|
VALUE=$(echo "$ARGUMENT" | cut -f2 -d=)
|
||||||
|
|
||||||
|
case "$KEY" in
|
||||||
|
PROXY) PROXY=${VALUE} ;;
|
||||||
|
UPDATE) UPDATE=${VALUE} ;;
|
||||||
|
maxmind_key) maxmind_key=${VALUE} ;;
|
||||||
|
haproxy_dir) haproxy_dir=${VALUE} ;;
|
||||||
|
HOST) HOST=${VALUE} ;;
|
||||||
|
USER) USER=${VALUE} ;;
|
||||||
|
PASS) PASS=${VALUE} ;;
|
||||||
|
KEY) KEY=${VALUE} ;;
|
||||||
|
SSH_PORT) SSH_PORT=${VALUE} ;;
|
||||||
|
*)
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
export ANSIBLE_HOST_KEY_CHECKING=False
|
||||||
|
export ANSIBLE_DISPLAY_SKIPPED_HOSTS=False
|
||||||
|
export ACTION_WARNINGS=False
|
||||||
|
export LOCALHOST_WARNING=False
|
||||||
|
export COMMAND_WARNINGS=False
|
||||||
|
|
||||||
|
PWD=$(pwd)
|
||||||
|
PWD=$PWD/scripts/ansible/
|
||||||
|
echo "$HOST ansible_port=$SSH_PORT" > $PWD/$HOST
|
||||||
|
|
||||||
|
if [[ $KEY == "" ]]; then
|
||||||
|
ansible-playbook $PWD/roles/geoip.yml -e "ansible_user=$USER ansible_ssh_pass=$PASS variable_host=$HOST PROXY=$PROXY UPDATE=$UPDATE haproxy_dir=$haproxy_dir maxmind_key=$maxmind_key SSH_PORT=$SSH_PORT" -i $PWD/$HOST
|
||||||
|
else
|
||||||
|
ansible-playbook $PWD/roles/geoip.yml --key-file $KEY -e "ansible_user=$USER variable_host=$HOST PROXY=$PROXY UPDATE=$UPDATE haproxy_dir=$haproxy_dir maxmind_key=$maxmind_key SSH_PORT=$SSH_PORT" -i $PWD/$HOST
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $? -gt 0 ]
|
||||||
|
then
|
||||||
|
echo "error: Cannot download GeoLite2 database"
|
||||||
|
fi
|
||||||
|
rm -f $PWD/$HOST
|
|
@ -40,7 +40,6 @@ fi
|
||||||
|
|
||||||
if [ $? -gt 0 ]
|
if [ $? -gt 0 ]
|
||||||
then
|
then
|
||||||
echo "error: Can't install Haproxy service <br /><br />"
|
echo "error: Cannot install Haproxy service"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
rm -f $PWD/$HOST
|
rm -f $PWD/$HOST
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import funct
|
import funct
|
||||||
import sql
|
import sql
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(extensions=["jinja2.ext.do"],loader=FileSystemLoader('templates/'), autoescape=True)
|
env = Environment(extensions=["jinja2.ext.do"], loader=FileSystemLoader('templates/'), autoescape=True)
|
||||||
template = env.get_template('servers.html')
|
template = env.get_template('servers.html')
|
||||||
form = funct.form
|
form = funct.form
|
||||||
|
|
||||||
|
@ -15,26 +15,47 @@ try:
|
||||||
grafana, stderr = funct.subprocess_execute("service grafana-server status |grep Active |awk '{print $1}'")
|
grafana, stderr = funct.subprocess_execute("service grafana-server status |grep Active |awk '{print $1}'")
|
||||||
user_group = funct.get_user_group(id=1)
|
user_group = funct.get_user_group(id=1)
|
||||||
settings = sql.get_setting('', all=1)
|
settings = sql.get_setting('', all=1)
|
||||||
|
geoip_country_codes = sql.select_geoip_country_codes()
|
||||||
|
|
||||||
|
services = []
|
||||||
|
services_name = {'checker_haproxy': 'Checker backends master service',}
|
||||||
|
for s, v in services_name.items():
|
||||||
|
cmd = "systemctl status %s |grep Act |awk '{print $2}'" % s
|
||||||
|
status, stderr = funct.subprocess_execute(cmd)
|
||||||
|
if s != 'keep_alive':
|
||||||
|
service_name = s.split('_')[0]
|
||||||
|
else:
|
||||||
|
service_name = s
|
||||||
|
cmd = "rpm --query haproxy-wi-"+service_name+"-* |awk -F\""+service_name + "\" '{print $2}' |awk -F\".noa\" '{print $1}' |sed 's/-//1' |sed 's/-/./'"
|
||||||
|
service_ver, stderr = funct.subprocess_execute(cmd)
|
||||||
|
|
||||||
|
try:
|
||||||
|
services.append([s, status, v, service_ver[0]])
|
||||||
|
except Exception:
|
||||||
|
services.append([s, status, v, ''])
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
output_from_parsed_template = template.render(title = "Servers: ",
|
output_from_parsed_template = template.render(title="Servers: ",
|
||||||
role = role,
|
role=role,
|
||||||
user = user,
|
user=user,
|
||||||
users = sql.select_users(group=user_group),
|
users=sql.select_users(group=user_group),
|
||||||
groups = sql.select_groups(),
|
groups=sql.select_groups(),
|
||||||
servers = sql.get_dick_permit(virt=1, disable=0),
|
servers=sql.get_dick_permit(virt=1, disable=0),
|
||||||
roles = sql.select_roles(),
|
roles=sql.select_roles(),
|
||||||
masters = sql.select_servers(get_master_servers=1, uuid=user_id.value),
|
masters=sql.select_servers(get_master_servers=1, uuid=user_id.value),
|
||||||
group = user_group,
|
group=user_group,
|
||||||
sshs = sql.select_ssh(group=user_group),
|
sshs=sql.select_ssh(group=user_group),
|
||||||
telegrams = sql.get_user_telegram_by_group(user_group),
|
telegrams=sql.get_user_telegram_by_group(user_group),
|
||||||
token = token,
|
token=token,
|
||||||
versions = funct.versions(),
|
versions=funct.versions(),
|
||||||
settings = settings,
|
settings=settings,
|
||||||
backups = sql.select_backups(),
|
backups=sql.select_backups(),
|
||||||
grafana = ''.join(grafana),
|
grafana=''.join(grafana),
|
||||||
page = "servers.py",
|
page="servers.py",
|
||||||
ldap_enable = ldap_enable)
|
geoip_country_codes=geoip_country_codes,
|
||||||
|
services=services,
|
||||||
|
ldap_enable=ldap_enable)
|
||||||
print(output_from_parsed_template)
|
print(output_from_parsed_template)
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<div class="group_error">
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<b>Do not edit this section if your group is "ALL"!</b> Add first <a href="users.py#groups" title="Admin Area: Groups">group</a>
|
||||||
|
or change your current group at <a href="users.py#users" title="Admin Area: Users">users</a> page
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -16,28 +16,34 @@
|
||||||
<li><a href="#settings" title="Admin area: Manage HAProxy-WI settings - HAProxy-WI">Settings</a></li>
|
<li><a href="#settings" title="Admin area: Manage HAProxy-WI settings - HAProxy-WI">Settings</a></li>
|
||||||
<li><a href="#installproxy" title="Servers: Proxy service installation - HAProxy-WI">Proxy installation</a></li>
|
<li><a href="#installproxy" title="Servers: Proxy service installation - HAProxy-WI">Proxy installation</a></li>
|
||||||
<li><a href="#installmon" title="Servers: Monitoring service installation - HAProxy-WI">Monitoring installation</a></li>
|
<li><a href="#installmon" title="Servers: Monitoring service installation - HAProxy-WI">Monitoring installation</a></li>
|
||||||
|
<li><a href="#geolite2" title="Servers: GeoLite2 - HAProxy-WI">GeoLite2</a></li>
|
||||||
<li><a href="#backup" title="Servers: Backup configs - HAProxy-WI">Backup</a></li>
|
<li><a href="#backup" title="Servers: Backup configs - HAProxy-WI">Backup</a></li>
|
||||||
{% include 'include/login.html' %}
|
{% include 'include/login.html' %}
|
||||||
</ul>
|
</ul>
|
||||||
<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 id="checker">
|
||||||
{% include 'include/admin_telegram.html' %}
|
{% include 'include/admin_telegram.html' %}
|
||||||
|
{% include 'include/servers_group_error.html' %}
|
||||||
</div>
|
</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">
|
||||||
|
@ -114,21 +120,64 @@
|
||||||
{% include 'include/mon_installation.html' %}
|
{% include 'include/mon_installation.html' %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="backup">
|
<div id="geolite2">
|
||||||
{% include 'include/admin_backup.html' %}
|
<table>
|
||||||
|
<caption><h3>Install GeoLite2</h3></caption>
|
||||||
|
<tr class="overviewHead">
|
||||||
|
<td class="padding10 first-collumn">Server</td>
|
||||||
|
<td class="padding10 first-collumn" style="width: 30%;">Current installation</td>
|
||||||
|
<td class="" style="width: 30%;" title="GeoLite2 DB is released every Tuesday. Should HAProxy-WI update it?">Updating</td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="padding10 first-collumn">
|
||||||
|
<select autofocus required name="geoipserv" id="geoipserv">
|
||||||
|
<option disabled selected>Choose server</option>
|
||||||
|
{% for select in servers %}
|
||||||
|
<option value="{{ select.2 }}">{{ select.1 }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td id="cur_geoip" class="padding10"></td>
|
||||||
|
<td class="checkbox">
|
||||||
|
{{ checkbox('updating_geoip', title="Update the database?", checked='checked') }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span class="ui-button ui-widget ui-corner-all" id="geoip_install" title="Install GeoLite2" style="display: none;">Install</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div id="ajax-geoip"></div>
|
||||||
|
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px; margin-bottom: 15px;">
|
||||||
|
Read the "how to" in this <a href="https://haproxy-wi.org/howto.py?howto=geoip" title="GeoLite2 description" target="_blank">article</a>
|
||||||
|
</div>
|
||||||
|
<table style="min-width: 40%;">
|
||||||
|
<tr class="overviewHead">
|
||||||
|
<th colspan=13 style="background-color: #d1ecf1; padding: 10px;">
|
||||||
|
<span id="table_metrics_head" style="position: absolute;margin-left: 43%;">Country codes</span>
|
||||||
|
<span id="show_country_codes" class="add switcher_table_metric" title="Show country codes"></span>
|
||||||
|
<span id="hide_country_codes" class="minus switcher_table_metric" title="Hide country codes" style="display: none;"></span>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div id="geoip_country_codes" style="display: none;">
|
||||||
|
{% for code in geoip_country_codes %}
|
||||||
|
<div class="geoip_country_code" id="{{code.1}}">{{code.1}} ({{code.2}})</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
<div id="backup">
|
||||||
<div id="group_error" style="display: none; clear: both;">
|
{% include 'include/admin_backup.html' %}
|
||||||
<div class="alert alert-danger">
|
{% include 'include/servers_group_error.html' %}
|
||||||
<b>Do not edit this section if your group is "ALL"!</b> Add first<a href="users.py#groups" title="Admin Area: Groups">group</a> or edit your own group at<a href="users.py#users" title="Admin Area: Users">users</a> page
|
|
||||||
</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) {
|
if($('#new-server-group-add').val() == 1) {
|
||||||
$('#group_error').css('display', 'block');
|
$('.group_error').css('display', 'block');
|
||||||
$('#add-user-button').css('display', 'none');
|
$('#add-user-button').css('display', 'none');
|
||||||
$('#add-server-button').css('display', 'none');
|
$('#add-server-button').css('display', 'none');
|
||||||
$('.passwordChange').css('display', 'none');
|
$('.passwordChange').css('display', 'none');
|
||||||
|
@ -191,5 +240,10 @@
|
||||||
padding-top: 0.6em !important;
|
padding-top: 0.6em !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.group_error {
|
||||||
|
display: none;
|
||||||
|
clear: both;
|
||||||
|
height: 60px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -61,7 +61,7 @@ $( function() {
|
||||||
type: frm.attr('method'),
|
type: frm.attr('method'),
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
data = data.replace('\n', '<br>');
|
data = data.replace('\n', '<br>');
|
||||||
if (data.indexOf('error: ') != '-1' || data.indexOf('Fatal') != '-1') {
|
if (data.indexOf('error: ') != '-1' || data.indexOf('Fatal') != '-1' || data.indexOf('Error(s)') != '-1') {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.error(data);
|
toastr.error(data);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1059,16 +1059,13 @@ function replace_text(id_textarea, text_var) {
|
||||||
$(id_textarea).text(text_val);
|
$(id_textarea).text(text_val);
|
||||||
}
|
}
|
||||||
function createHistroy() {
|
function createHistroy() {
|
||||||
try {
|
if(localStorage.getItem('history') === null) {
|
||||||
var get_history_array = JSON.parse(Cookies.get('history'));
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
var get_history_array = ['login.py', 'login.py','login.py'];
|
var get_history_array = ['login.py', 'login.py','login.py'];
|
||||||
Cookies.set('history', JSON.stringify(get_history_array), { expires: 10, path: '/app', samesite: 'strict', secure: 'true' });
|
localStorage.setItem('history', JSON.stringify(get_history_array));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function listHistroy() {
|
function listHistroy() {
|
||||||
var browse_history = JSON.parse(Cookies.get('history'));
|
var browse_history = JSON.parse(localStorage.getItem('history'));
|
||||||
var history_link = '';
|
var history_link = '';
|
||||||
var title = []
|
var title = []
|
||||||
var link_text = []
|
var link_text = []
|
||||||
|
@ -1082,7 +1079,7 @@ function listHistroy() {
|
||||||
if (i == 2) {
|
if (i == 2) {
|
||||||
if(cur_url[1] !== undefined) {
|
if(cur_url[1] !== undefined) {
|
||||||
browse_history[2] = cur_url[0] + '?' + cur_url[1]
|
browse_history[2] = cur_url[0] + '?' + cur_url[1]
|
||||||
}else {
|
} else {
|
||||||
browse_history[2] = cur_url[0]
|
browse_history[2] = cur_url[0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1095,16 +1092,11 @@ function listHistroy() {
|
||||||
link_text[i] = $(this).find('a').text();
|
link_text[i] = $(this).find('a').text();
|
||||||
history_link = '<li><a href="'+browse_history[i]+'" title="'+title[i]+'">'+link_text[i]+'</a></li>'
|
history_link = '<li><a href="'+browse_history[i]+'" title="'+title[i]+'">'+link_text[i]+'</a></li>'
|
||||||
$('#browse_histroy').append(history_link);
|
$('#browse_histroy').append(history_link);
|
||||||
} else if (browse_history[i].split('?')[0] == link2) {
|
|
||||||
title[i] = $(this).find('a').attr('title');
|
|
||||||
link_text[i] = $(this).find('a').text();
|
|
||||||
history_link = '<li><a href="'+browse_history[i]+'" title="'+title[i]+'">'+link_text[i]+'</a></li>'
|
|
||||||
$('#browse_histroy').append(history_link);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Cookies.set('history', JSON.stringify(browse_history), { expires: 10, path: '/app', samesite: 'strict', secure: 'true' });
|
localStorage.setItem('history', JSON.stringify(browse_history));
|
||||||
}
|
}
|
||||||
createHistroy()
|
createHistroy()
|
||||||
listHistroy()
|
listHistroy()
|
||||||
|
@ -1224,7 +1216,7 @@ async function waitConsumer() {
|
||||||
cur_url = cur_url.split('?');
|
cur_url = cur_url.split('?');
|
||||||
if (cur_url[0] != 'servers.py#installproxy' && cur_url[0] != 'servers.py#installmon' &&
|
if (cur_url[0] != 'servers.py#installproxy' && cur_url[0] != 'servers.py#installmon' &&
|
||||||
cur_url[0] != 'users.py#installmon' && cur_url[0] != 'ha.py' && cur_url[0] != 'users.py#updatehapwi' &&
|
cur_url[0] != 'users.py#installmon' && cur_url[0] != 'ha.py' && cur_url[0] != 'users.py#updatehapwi' &&
|
||||||
cur_url[0] != 'add.py?service=nginx#ssl' && cur_url[0] != 'add.py#ssl') {
|
cur_url[0] != 'add.py?service=nginx#ssl' && cur_url[0] != 'add.py#ssl' && cur_url[0] != 'servers.py#geolite2') {
|
||||||
NProgress.configure({showSpinner: false});
|
NProgress.configure({showSpinner: false});
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "options.py",
|
url: "options.py",
|
||||||
|
|
|
@ -42,10 +42,9 @@ ul#browse_histroy li {
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
ul#browse_histroy li+li:before {
|
ul#browse_histroy li+li:before {
|
||||||
content: "\003e";
|
content: "/";
|
||||||
color: #000;
|
color: #767676;
|
||||||
font-weight: bold;
|
margin: 0 9px 0px 2.5px;
|
||||||
margin-right: 2.5px;
|
|
||||||
}
|
}
|
||||||
#browse_histroy a {
|
#browse_histroy a {
|
||||||
color: #767676;
|
color: #767676;
|
||||||
|
@ -570,7 +569,6 @@ ul{
|
||||||
.ui-button {
|
.ui-button {
|
||||||
padding-left: 10px !important;
|
padding-left: 10px !important;
|
||||||
padding-right: 10px !important;
|
padding-right: 10px !important;
|
||||||
background: #f4f9f380 !important;
|
|
||||||
}
|
}
|
||||||
@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm) {
|
@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm) {
|
||||||
.ui-checkboxradio-label {
|
.ui-checkboxradio-label {
|
||||||
|
@ -678,15 +676,13 @@ td,th {
|
||||||
padding:15px;
|
padding:15px;
|
||||||
margin-bottom:20px;
|
margin-bottom:20px;
|
||||||
border:1px solid transparent;
|
border:1px solid transparent;
|
||||||
border-radius:4px;
|
|
||||||
width: 400px;
|
width: 400px;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.alert a {
|
.alert a {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-weight: bold;
|
|
||||||
padding-left: 10px;
|
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
color: #23527c !important;
|
||||||
}
|
}
|
||||||
.alert-danger, .alert-info, .alert-success, .alert-warning, .added {
|
.alert-danger, .alert-info, .alert-success, .alert-warning, .added {
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
|
|
38
inc/users.js
38
inc/users.js
|
@ -179,6 +179,7 @@ $( function() {
|
||||||
} else if (data.indexOf('success') != '-1' ){
|
} else if (data.indexOf('success') != '-1' ){
|
||||||
toastr.remove();
|
toastr.remove();
|
||||||
toastr.success(data);
|
toastr.success(data);
|
||||||
|
$( "#haproxyaddserv" ).trigger( "selectmenuchange" );
|
||||||
} else if (data.indexOf('Info') != '-1' ){
|
} else if (data.indexOf('Info') != '-1' ){
|
||||||
toastr.remove();
|
toastr.remove();
|
||||||
toastr.info(data);
|
toastr.info(data);
|
||||||
|
@ -213,6 +214,7 @@ $( function() {
|
||||||
} else if (data.indexOf('success') != '-1' ){
|
} else if (data.indexOf('success') != '-1' ){
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.success(data);
|
toastr.success(data);
|
||||||
|
$("#nginxaddserv").trigger( "selectmenuchange" );
|
||||||
} else if (data.indexOf('Info') != '-1' ){
|
} else if (data.indexOf('Info') != '-1' ){
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.info(data);
|
toastr.info(data);
|
||||||
|
@ -273,6 +275,7 @@ $( function() {
|
||||||
toastr.success(data);
|
toastr.success(data);
|
||||||
$('#cur_haproxy_exp_ver').text('HAProxy expoter is installed');
|
$('#cur_haproxy_exp_ver').text('HAProxy expoter is installed');
|
||||||
$('#haproxy_exp_install').text('Update');
|
$('#haproxy_exp_install').text('Update');
|
||||||
|
$("#haproxy_exp_addserv").trigger( "selectmenuchange" );
|
||||||
} else if (data.indexOf('Info') != '-1' ){
|
} else if (data.indexOf('Info') != '-1' ){
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.info(data);
|
toastr.info(data);
|
||||||
|
@ -303,6 +306,7 @@ $( function() {
|
||||||
toastr.success(data);
|
toastr.success(data);
|
||||||
$('#cur_nginx_exp_ver').text('Nginx expoter is installed');
|
$('#cur_nginx_exp_ver').text('Nginx expoter is installed');
|
||||||
$('#nginx_exp_install').text('Update');
|
$('#nginx_exp_install').text('Update');
|
||||||
|
$("#nginx_exp_addserv").trigger( "selectmenuchange" );
|
||||||
} else if (data.indexOf('Info') != '-1' ){
|
} else if (data.indexOf('Info') != '-1' ){
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
toastr.info(data);
|
toastr.info(data);
|
||||||
|
@ -738,6 +742,40 @@ $( function() {
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
});
|
});
|
||||||
|
$( "#geoip_install" ).click(function() {
|
||||||
|
var updating_geoip = 0;
|
||||||
|
if ($('#updating_geoip').is(':checked')) {
|
||||||
|
updating_geoip = '1';
|
||||||
|
}
|
||||||
|
$("#ajax-geoip").html(wait_mess);
|
||||||
|
$.ajax( {
|
||||||
|
url: "options.py",
|
||||||
|
data: {
|
||||||
|
geoip_install: $('#geoipserv option:selected').val(),
|
||||||
|
geoip_update: updating_geoip,
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function( data ) {
|
||||||
|
data = data.replace(/^\s+|\s+$/g,'');
|
||||||
|
$("#ajax-geoip").html('')
|
||||||
|
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.error(data);
|
||||||
|
} else if (data.indexOf('success:') != '-1' ){
|
||||||
|
toastr.clear();
|
||||||
|
toastr.success(data);
|
||||||
|
$( "#geoipserv" ).trigger( "selectmenuchange" );
|
||||||
|
} else if (data.indexOf('Info') != '-1' ){
|
||||||
|
toastr.clear();
|
||||||
|
toastr.info(data);
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.info(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
});
|
||||||
} );
|
} );
|
||||||
function common_ajax_action_after_success(dialog_id, new_group, ajax_append_id, data) {
|
function common_ajax_action_after_success(dialog_id, new_group, ajax_append_id, data) {
|
||||||
toastr.clear();
|
toastr.clear();
|
||||||
|
|
Loading…
Reference in New Issue