From 33d2131b9aac144154cce1e7247722a61749216f Mon Sep 17 00:00:00 2001 From: Aidaho Date: Wed, 8 Mar 2023 16:21:16 +0300 Subject: [PATCH] v6.3.7.0 Changelog: https://roxy-wi.org/changelog#6_3_7 --- app/modules/config/add.py | 12 +++++++----- app/options.py | 5 ++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/modules/config/add.py b/app/modules/config/add.py index 2d5459be..8004c52e 100644 --- a/app/modules/config/add.py +++ b/app/modules/config/add.py @@ -9,6 +9,8 @@ import modules.server.server as server_mod import modules.roxywi.common as roxywi_common import modules.roxy_wi_tools as roxy_wi_tools +time_zone = sql.get_setting('time_zone') +get_date = roxy_wi_tools.GetDate(time_zone) get_config = roxy_wi_tools.GetConfigVar() @@ -68,7 +70,7 @@ def get_bwlists_for_autocomplete(color: str, group: str) -> None: print(line) -def create_bwlist(list_name: str, color: str, group: str) -> None: +def create_bwlist(server_ip: str, list_name: str, color: str, group: str) -> None: lib_path = get_config.get_config_var('main', 'lib_path') list_name = f"{list_name.split('.')[0]}.lst" list_path = f"{lib_path}/{sql.get_setting('lists_path')}/{group}/{color}/{list_name}" @@ -76,7 +78,7 @@ def create_bwlist(list_name: str, color: str, group: str) -> None: open(list_path, 'a').close() print('success: ') try: - roxywi_common.logging(serv, f'A new list {color} {list_name} has been created', roxywi=1, login=1) + roxywi_common.logging(server_ip, f'A new list {color} {list_name} has been created', roxywi=1, login=1) except Exception: pass except IOError as e: @@ -217,13 +219,13 @@ def get_saved_servers(group: str, term: str) -> None: print(json.dumps(a)) -def get_le_cert(lets_domain: str, lets_email: str) -> None: +def get_le_cert(server_ip: str, lets_domain: str, lets_email: str) -> None: proxy = sql.get_setting('proxy') ssl_path = common.return_nice_path(sql.get_setting('cert_path')) haproxy_dir = sql.get_setting('haproxy_dir') script = "letsencrypt.sh" proxy_serv = '' - ssh_settings = ssh_mod.return_ssh_keys_path(serv) + ssh_settings = ssh_mod.return_ssh_keys_path(server_ip) os.system(f"cp scripts/{script} .") @@ -232,7 +234,7 @@ def get_le_cert(lets_domain: str, lets_email: str) -> None: commands = [ f"chmod +x {script} && ./{script} PROXY={proxy_serv} haproxy_dir={haproxy_dir} DOMAIN={lets_domain} " - f"EMAIL={lets_email} SSH_PORT={ssh_settings['port']} SSL_PATH={ssl_path} HOST={serv} USER={ssh_settings['user']} " + f"EMAIL={lets_email} SSH_PORT={ssh_settings['port']} SSL_PATH={ssl_path} HOST={server_ip} USER={ssh_settings['user']} " f"PASS='{ssh_settings['password']}' KEY={ssh_settings['key']}" ] diff --git a/app/options.py b/app/options.py index 0e2e5dda..507c69b8 100644 --- a/app/options.py +++ b/app/options.py @@ -2,7 +2,6 @@ # -*- coding: utf-8 -*- import os import sys -import json import http.cookies from uuid import UUID @@ -636,7 +635,7 @@ if form.getvalue('bwlists_create'): color = common.checkAjaxInput(form.getvalue('color')) group = common.checkAjaxInput(form.getvalue('group')) - add_mod.create_bwlist(list_name, color, group) + add_mod.create_bwlist(serv, list_name, color, group) if form.getvalue('bwlists_save'): color = common.checkAjaxInput(form.getvalue('color')) @@ -1081,7 +1080,7 @@ if form.getvalue('lets_domain'): lets_domain = common.checkAjaxInput(form.getvalue('lets_domain')) lets_email = common.checkAjaxInput(form.getvalue('lets_email')) - add_mod.get_le_cert(lets_domain, lets_email) + add_mod.get_le_cert(serv, lets_domain, lets_email) if form.getvalue('uploadovpn'): name = common.checkAjaxInput(form.getvalue('ovpnname'))