Changelog: https://roxy-wi.org/changelog#6_3_0
pull/355/head v6.3.0.0
Pavel Loginov 2022-12-01 09:52:24 +03:00
parent 3f045650e7
commit d6a27f8307
5 changed files with 73 additions and 58 deletions

View File

@ -6,6 +6,7 @@ import modules.roxywi.common as roxywi_common
from modules.server import ssh_connection from modules.server import ssh_connection
import modules.roxy_wi_tools as roxy_wi_tools import modules.roxy_wi_tools as roxy_wi_tools
form = common.form
get_config_var = roxy_wi_tools.GetConfigVar() get_config_var = roxy_wi_tools.GetConfigVar()
@ -354,3 +355,62 @@ def get_system_info(server_ip: str) -> str:
sql.insert_system_info(server_id, os_info, sys_info, cpu, ram, network, disks) sql.insert_system_info(server_id, os_info, sys_info, cpu, ram, network, disks)
except Exception as e: except Exception as e:
raise e raise e
def show_system_info() -> None:
from jinja2 import Environment, FileSystemLoader
server_ip = form.getvalue('server_ip')
server_ip = common.is_ip_or_dns(server_ip)
server_id = form.getvalue('server_id')
if server_ip == '':
print('error: IP or DNS name is not valid')
return
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True,
extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
env.globals['string_to_dict'] = common.string_to_dict
template = env.get_template('ajax/show_system_info.html')
if sql.is_system_info(server_id):
try:
get_system_info(server_ip)
system_info = sql.select_one_system_info(server_id)
template = template.render(system_info=system_info, server_ip=server_ip, server_id=server_id)
print(template)
except Exception as e:
print(f'Cannot update server info: {e}')
else:
system_info = sql.select_one_system_info(server_id)
template = template.render(system_info=system_info, server_ip=server_ip, server_id=server_id)
print(template)
def update_system_info() -> None:
from jinja2 import Environment, FileSystemLoader
server_ip = form.getvalue('server_ip')
server_ip = common.is_ip_or_dns(server_ip)
server_id = form.getvalue('server_id')
if server_ip == '':
print('error: IP or DNS name is not valid')
return
sql.delete_system_info(server_id)
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True,
extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
env.globals['string_to_dict'] = common.string_to_dict
template = env.get_template('ajax/show_system_info.html')
try:
get_system_info(server_ip)
system_info = sql.select_one_system_info(server_id)
template = template.render(system_info=system_info, server_ip=server_ip, server_id=server_id)
print(template)
except Exception as e:
print(f'error: Cannot update server info: {e}')

View File

@ -4064,60 +4064,11 @@ if act == 'showListOfVersion':
if act == 'getSystemInfo': if act == 'getSystemInfo':
import modules.server.server as server_mod import modules.server.server as server_mod
server_mod.show_system_info()
server_ip = form.getvalue('server_ip')
server_ip = common.is_ip_or_dns(server_ip)
server_id = form.getvalue('server_id')
if server_ip == '':
print('error: IP or DNS name is not valid')
sys.exit()
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True,
extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
env.globals['string_to_dict'] = common.string_to_dict
template = env.get_template('ajax/show_system_info.html')
if sql.is_system_info(server_id):
try:
server_mod.get_system_info(server_ip)
system_info = sql.select_one_system_info(server_id)
template = template.render(system_info=system_info, server_ip=server_ip, server_id=server_id)
print(template)
except Exception as e:
print(f'Cannot update server info: {e}')
else:
system_info = sql.select_one_system_info(server_id)
template = template.render(system_info=system_info, server_ip=server_ip, server_id=server_id)
print(template)
if act == 'updateSystemInfo': if act == 'updateSystemInfo':
import modules.server.server as server_mod import modules.server.server as server_mod
server_mod.update_system_info()
server_ip = form.getvalue('server_ip')
server_ip = common.is_ip_or_dns(server_ip)
server_id = form.getvalue('server_id')
if server_ip == '':
print('error: IP or DNS name is not valid')
sys.exit()
sql.delete_system_info(server_id)
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True,
extensions=["jinja2.ext.loopcontrols", "jinja2.ext.do"])
env.globals['string_to_dict'] = common.string_to_dict
template = env.get_template('ajax/show_system_info.html')
try:
server_mod.get_system_info(server_ip)
system_info = sql.select_one_system_info(server_id)
template = template.render(system_info=system_info, server_ip=server_ip, server_id=server_id)
print(template)
except Exception as e:
print(f'error: Cannot update server info: {e}')
if act == 'findInConfigs': if act == 'findInConfigs':
server_ip = serv server_ip = serv

View File

@ -5,7 +5,7 @@
</ul> </ul>
<div id="git_tab"> <div id="git_tab">
{% if user_status == 0 or user_plan == 'user' %} {% if user_status == 0 or user_plan != 'support' %}
{% include 'include/no_sub.html' %} {% include 'include/no_sub.html' %}
{% else %} {% else %}
<table class="overview" id="ajax-git-table"> <table class="overview" id="ajax-git-table">

View File

@ -14,10 +14,10 @@
{% if user_status == 0 %} {% if user_status == 0 %}
You are not subscribed. Please subscribe to have access to this feature. You are not subscribed. Please subscribe to have access to this feature.
<p> <p>
Read <a href="https://roxy-wi.org/pricing.py" title="Roxy-WI pricing" target="_blank">here</a> about subscriptions Read <a href="https://roxy-wi.org/pricing" title="Roxy-WI pricing" target="_blank" class="link">here</a> about subscriptions
</p> </p>
{% elif user_plan == 'user' %} {% elif user_plan == 'user' or user_plan != 'support' %}
This feature is not available for your plan. To change the plan, follow this <a href="https://roxy-wi.org/pricing.py" title="Roxy-WI pricing" target="_blank">link</a> This feature is not available for your plan. To change the plan, follow this <a href="https://roxy-wi.org/pricing" title="Roxy-WI pricing" target="_blank" class="link">link</a>
{% endif %} {% endif %}
</h4> </h4>
</center> </center>

View File

@ -10,13 +10,17 @@
{% elif smon_error != '' %} {% elif smon_error != '' %}
<div style="text-align: center;"> <div style="text-align: center;">
<br /> <br />
<h3>You have not installed SMON service. Read <a href="https://roxy-wi.org/services/smon" <h3>You have not installed SMON service</h3>.
title="Simple monitoring network ports with alerting via Telegram and WEB panel" target="_blank">here</a> how to install SMON service</h3> <img src="/inc/images/no_servers.png" alt="There is no server">
<h4>Read <a href="https://roxy-wi.org/services/smon" title="Simple monitoring network ports with alerting via Telegram and WEB panel" target="_blank">here</a>
how to install SMON service.</h4>
</div> </div>
{% elif smon_status.0 == 'failed' %} {% elif smon_status.0 == 'failed' %}
<div style="text-align: center;"> <div style="text-align: center;">
<br /> <br />
<h3>SMON service is not run. Run the SMON service <a href="users.py#services" title="Roxy-WI services" target="_blank">here</a> before use</h3> <h3>SMON service is not run.</h3>
<img src="/inc/images/no_servers.png" alt="There is no server">
<h4>Run the SMON service <a href="users.py#services" title="Roxy-WI services" target="_blank">here</a> before use</h4>
</div> </div>
{% elif smon|length == 0 and action != 'add' and action != 'history' and action != 'checker_history' %} {% elif smon|length == 0 and action != 'add' and action != 'history' and action != 'checker_history' %}
<div style="text-align: center;"> <div style="text-align: center;">