Changelog: https://roxy-wi.org/changelog#6_3_5
pull/355/head
Aidaho 2023-02-14 19:46:41 +03:00
parent bf2223c1f3
commit 9259562776
14 changed files with 120 additions and 88 deletions

View File

@ -223,9 +223,10 @@ def add_telegram_channel(token: str, channel: str, group: str, page: str) -> Non
print(error_mess)
else:
if sql.insert_new_telegram(token, channel, group):
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
template = env.get_template('/new_telegram.html')
output_from_parsed_template = template.render(groups=sql.select_groups(),
lang = roxywi_common.get_user_lang()
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
template = env.get_template('ajax/new_telegram.html')
output_from_parsed_template = template.render(groups=sql.select_groups(), lang=lang,
telegrams=sql.select_telegram(token=token), page=page)
print(output_from_parsed_template)
roxywi_common.logging('Roxy-WI server', f'A new Telegram channel {channel} has been created ', roxywi=1, login=1)
@ -236,12 +237,13 @@ def add_slack_channel(token: str, channel: str, group: str, page: str) -> None:
print(error_mess)
else:
if sql.insert_new_slack(token, channel, group):
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
template = env.get_template('/new_slack.html')
output_from_parsed_template = template.render(groups=sql.select_groups(),
lang = roxywi_common.get_user_lang()
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
template = env.get_template('ajax/new_slack.html')
output_from_parsed_template = template.render(groups=sql.select_groups(), lang=lang,
slacks=sql.select_slack(token=token), page=page)
print(output_from_parsed_template)
roxywi_common.logging('Roxy-WI server', 'A new Slack channel ' + channel + ' has been created ', roxywi=1, login=1)
roxywi_common.logging('Roxy-WI server', f'A new Slack channel {channel} has been created ', roxywi=1, login=1)
def delete_telegram_channel(channel_id) -> None:

View File

@ -13,10 +13,10 @@ form = common.form
def waf_overview(serv, waf_service) -> None:
env = Environment(
loader=FileSystemLoader('templates/ajax'), autoescape=True,
loader=FileSystemLoader('templates/'), autoescape=True,
extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do']
)
template = env.get_template('overivewWaf.html')
template = env.get_template('ajax/overivewWaf.html')
servers = sql.select_servers(server=serv)
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
@ -75,9 +75,10 @@ def waf_overview(serv, waf_service) -> None:
returned_servers.append(server_status)
lang = roxywi_common.get_user_lang()
servers_sorted = sorted(returned_servers, key=common.get_key)
template = template.render(service_status=servers_sorted, role=sql.get_user_role_by_uuid(user_id.value),
waf_service=waf_service)
waf_service=waf_service, lang=lang)
print(template)

View File

@ -60,14 +60,15 @@ def create_ssh_cred() -> None:
password = common.checkAjaxInput(form.getvalue('ssh_pass'))
page = common.checkAjaxInput(form.getvalue('page'))
page = page.split("#")[0]
lang = roxywi_common.get_user_lang()
if username is None or name is None:
print(error_mess)
else:
if sql.insert_new_ssh(name, enable, group, username, password):
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
template = env.get_template('/new_ssh.html')
output_from_parsed_template = template.render(groups=sql.select_groups(), sshs=sql.select_ssh(name=name), page=page)
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
template = env.get_template('ajax/new_ssh.html')
output_from_parsed_template = template.render(groups=sql.select_groups(), sshs=sql.select_ssh(name=name), page=page, lang=lang)
print(output_from_parsed_template)
roxywi_common.logging('Roxy-WI server', f'New SSH credentials {name} has been created', roxywi=1, login=1)

View File

@ -824,6 +824,7 @@ if form.getvalue('newuser') is not None:
page = common.checkAjaxInput(form.getvalue('page'))
activeuser = common.checkAjaxInput(form.getvalue('activeuser'))
group = common.checkAjaxInput(form.getvalue('newgroupuser'))
lang = roxywi_common.get_user_lang()
if roxywi_user.create_user(new_user, email, password, role, activeuser, group):
env = Environment(loader=FileSystemLoader('templates/'), autoescape=True)
@ -833,7 +834,8 @@ if form.getvalue('newuser') is not None:
groups=sql.select_groups(),
page=page,
roles=sql.select_roles(),
adding=1)
adding=1,
lang=lang)
print(template)
if form.getvalue('userdel') is not None:
@ -868,6 +870,7 @@ if form.getvalue('newserver') is not None:
page = page.split("#")[0]
port = common.checkAjaxInput(form.getvalue('newport'))
desc = common.checkAjaxInput(form.getvalue('desc'))
lang = roxywi_common.get_user_lang()
if ip == '':
print('error: IP or DNS name is not valid')
@ -890,7 +893,8 @@ if form.getvalue('newserver') is not None:
page=page,
user_status=user_subscription['user_status'],
user_plan=user_subscription['user_plan'],
adding=1)
adding=1,
lang=lang)
print(template)
roxywi_common.logging(ip, f'A new server {hostname} has been created', roxywi=1, login=1,
keep_history=1, service='server')

View File

@ -4,7 +4,7 @@
{% block content %}
{% from 'include/input_macros.html' import input, checkbox, select %}
{% set balance_params = dict() %}
{% set balance_params = {'ip_hash':'ip_hash','least_conn':'least_conn','random':'random', 'round-robin': 'round-robin'} %}
{% set balance_params = {'ip_hash':'ip_hash','least_conn':'least_conn','random':'random', 'round_robin': 'round-robin'} %}
<script src="/inc/add_nginx.js"></script>
<div id="tabs">
<ul>

View File

@ -54,7 +54,7 @@
</span>
</td>
<td>
<a class="delete" onclick="confirmDeleteGit({{b.id}})" title="{{lang.words.delete|title()}} git {{b.server}}" style="cursor: pointer;"></a>
<a class="delete" onclick="confirmDeleteGit({{b.id}})" style="cursor: pointer;"></a>
</td>
</tr>
{% endif %}

View File

@ -1,3 +1,4 @@
{% import 'languages/'+lang|default('en')+'.html' as lang %}
{% for server in servers %}
{% include 'include/admin_servers.html' %}
<script>

View File

@ -1,3 +1,4 @@
{% import 'languages/'+lang|default('en')+'.html' as lang %}
{% for slack in slacks %}
<tr style="width: 50%;" id="slack-table-{{slack.id}}" class="newgroup">
<td class="padding10 first-collumn">
@ -21,13 +22,13 @@
</td>
{% endif %}
<td>
<button title="Send test message" onclick="checkSlack({{slack.id}})">Test</button>
<button title="{{lang.phrases.send_test_mes}}" onclick="checkSlack({{slack.id}})">{{lang.words.test|title()}}</button>
</td>
<td>
<a class="add" onclick="cloneSlack({{slack.id}})" id="clone-{{slack.id}}" title="Copy the settings from {{slack.chanel_name}}" style="cursor: pointer;"></a>
<a class="add" onclick="cloneSlack({{slack.id}})" id="clone-{{slack.id}}" title="{{lang.words.clone|title()}} {{slack.chanel_name}}" style="cursor: pointer;"></a>
</td>
<td>
<a class="delete" onclick="confirmDeleteSlack({{slack.id}})" style="cursor: pointer;"></a>
</td>
</tr>
{% endfor %}
{% endfor %}

View File

@ -1,3 +1,4 @@
{% import 'languages/'+lang|default('en')+'.html' as lang %}
{% for ssh in sshs %}
<tr style="width: 50%;" id="ssh-table-{{ssh.id}}" class="ssh-table-{{ssh.id}}">
<td class="first-collumn">
@ -5,9 +6,9 @@
</td>
<td class="first-collumn" valign="top" style="padding-top: 15px;">
{% if ssh.enable == 1 %}
<label for="ssh_enable-{{ssh.id}}">Enable SSH key</label><input type="checkbox" id="ssh_enable-{{ssh.id}}" checked>
<label for="ssh_enable-{{ssh.id}}">{{lang.words.enable|title()}} SSH {{lang.words.key}}</label><input type="checkbox" id="ssh_enable-{{ssh.id}}" checked>
{% else %}
<label for="ssh_enable-{{ssh.id}}">Enable SSH key</label><input type="checkbox" id="ssh_enable-{{ssh.id}}">
<label for="ssh_enable-{{ssh.id}}">{{lang.words.enable|title()}} SSH {{lang.words.key}}</label><input type="checkbox" id="ssh_enable-{{ssh.id}}">
{% endif %}
</td>
{% if page != "servers.py" %}
@ -35,7 +36,7 @@
<br>
</td>
<td>
<a class="delete" onclick="confirmDeleteSsh({{ssh.id}})" style="cursor: pointer;"></a>
<a class="delete" onclick="confirmDeleteSsh({{ssh.id}})" title="{{lang.words.delete|title()}} {{ssh.name}}" style="cursor: pointer;"></a>
</td>
</tr>
{% endfor %}
{% endfor %}

View File

@ -1,3 +1,4 @@
{% import 'languages/'+lang|default('en')+'.html' as lang %}
{% for telegram in telegrams %}
<tr style="width: 50%;" id="telegram-table-{{telegram.id}}" class="newgroup">
<td class="padding10 first-collumn">
@ -21,10 +22,10 @@
</td>
{% endif %}
<td>
<button title="Send a test message" onclick="checkTelegram({{telegram.id}})">Test</button>
<button title="{{lang.phrases.send_test_mes}}" onclick="checkTelegram({{telegram.id}})">{{lang.words.test|title()}}</button>
</td>
<td>
<a class="add" onclick="cloneTelegram({{telegram.id}})" id="clone-{{telegram.id}}" title="Clone {{telegram.chanel_name}}" style="cursor: pointer;"></a>
<a class="add" onclick="cloneTelegram({{telegram.id}})" id="clone-{{telegram.id}}" title="{{lang.words.clone|title()}} {{telegram.chanel_name}}" style="cursor: pointer;"></a>
</td>
<td>
<a class="delete" onclick="confirmDeleteTelegram({{telegram.id}})" style="cursor: pointer;"></a>

View File

@ -1,3 +1,4 @@
{% import 'languages/'+lang|default('en')+'.html' as lang %}
{% for user in users %}
{% include 'include/admin_users.html' %}
<script>
@ -28,4 +29,4 @@ $( "#ajax-users select" ).on('selectmenuchange',function() {
var id = $(this).attr('id').split('-');
updateUser(id[1])
});
</script>
</script>

View File

@ -146,7 +146,7 @@
</td>
<td>
<p style="width: 100px;">
{{ input('ssh_user', value=ssh_user, title='SSH {{lang.words.username|title()}}') }}
{{ input('ssh_user', value=ssh_user, title='SSH ' + lang.words.username|title()) }}
</p>
{{ input('ssh_pass', type='password', style="display: none;", title="User password, if SSH key is disabled") }}
</td>

View File

@ -810,5 +810,6 @@
"rule_name": "Rule name",
"rule": "rule",
"rules": "rules",
"send": "send",
}
%}

View File

@ -1449,16 +1449,19 @@ function confirmDeleteUser(id) {
height: "auto",
width: 400,
modal: true,
title: "Are you sure you want to delete " +$('#login-'+id).val() + "?",
buttons: {
"Delete": function() {
$( this ).dialog( "close" );
removeUser(id);
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
title: delete_word + " " +$('#login-'+id).val() + "?",
buttons: [{
text: delete_word,
click: function () {
$(this).dialog("close");
removeUser(id);
}
}, {
text: cancel_word,
click: function () {
$(this).dialog("close");
}
}]
});
}
function confirmDeleteGroup(id) {
@ -1469,16 +1472,19 @@ function confirmDeleteGroup(id) {
height: "auto",
width: 400,
modal: true,
title: "Are you sure you want to delete " +$('#name-'+id).val() + "?",
buttons: {
"Delete": function() {
$( this ).dialog( "close" );
removeGroup(id);
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
title: delete_word+ " " +$('#name-'+id).val() + "?",
buttons: [{
text: delete_word,
click: function() {
$(this).dialog("close");
removeGroup(id);
}
}, {
text: cancel_word,
click: function () {
$(this).dialog("close");
}
}]
});
}
function confirmDeleteServer(id) {
@ -1535,16 +1541,19 @@ function confirmDeleteTelegram(id) {
height: "auto",
width: 400,
modal: true,
title: "Are you sure you want to delete " +$('#telegram-chanel-'+id).val() + "?",
buttons: {
"Delete": function() {
$( this ).dialog( "close" );
removeTelegram(id);
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
title: delete_word + " " +$('#telegram-chanel-'+id).val() + "?",
buttons: [{
text: delete_word,
click: function() {
$(this).dialog("close");
removeTelegram(id);
}
}, {
text: cancel_word,
click: function () {
$(this).dialog("close");
}
}]
});
}
function confirmDeleteSlack(id) {
@ -1555,16 +1564,19 @@ function confirmDeleteSlack(id) {
height: "auto",
width: 400,
modal: true,
title: "Are you sure you want to delete " +$('#slack-chanel-'+id).val() + "?",
buttons: {
"Delete": function() {
$( this ).dialog( "close" );
removeSlack(id);
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
title: delete_word + " " +$('#slack-chanel-'+id).val() + "?",
buttons: [{
text: delete_word,
click: function () {
$(this).dialog("close");
removeSlack(id);
}
}, {
text: cancel_word,
click: function () {
$(this).dialog("close");
}
}]
});
}
function confirmDeleteBackup(id) {
@ -1575,16 +1587,19 @@ function confirmDeleteBackup(id) {
height: "auto",
width: 400,
modal: true,
title: "Are you sure you want to delete job for " +$('#backup-server-'+id).val() + "?",
buttons: {
"Delete": function() {
$( this ).dialog( "close" );
removeBackup(id);
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
title: delete_word + " " +$('#backup-server-'+id).val() + "?",
buttons: [{
text: delete_word,
click: function () {
$(this).dialog("close");
removeBackup(id);
}
}, {
text: cancel_word,
click: function () {
$(this).dialog("close");
}
}]
});
}
function confirmDeleteGit(id) {
@ -1595,16 +1610,19 @@ function confirmDeleteGit(id) {
height: "auto",
width: 400,
modal: true,
title: "Are you sure you want to delete job for " +$('#git-server-'+id).text() + "?",
buttons: {
"Delete": function() {
$( this ).dialog( "close" );
removeGit(id);
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
title: delete_word + " " +$('#git-server-'+id).text() + "?",
buttons: [{
text: delete_word,
click: function () {
$(this).dialog("close");
removeGit(id);
}
},{
text: cancel_word,
click: function () {
$(this).dialog("close");
}
}]
});
}
function cloneServer(id) {