Merge branch 'pretzel-sanitize' into 'dev'

Santize inputs to the best of our ability. Could not find full solutions for...

See merge request crafty-controller/crafty-commander!171
This commit is contained in:
Andrew 2022-02-27 19:43:03 +00:00
commit db4c15eb91
4 changed files with 13 additions and 10 deletions

View File

@ -239,13 +239,15 @@
{% block js %} {% block js %}
<script> <script>
const userId = new URLSearchParams(document.location.search).get('id')
$( ".delete-user" ).click(function() { $( ".delete-user" ).click(function() {
var file_to_del = $(this).data("file"); var file_to_del = $(this).data("file");
console.log("User to delete is {{ data['user']['username'] }}"); console.log("User to delete is "+userId);
bootbox.confirm({ bootbox.confirm({
title: "{% raw translate('userConfig', 'deleteUser', data['lang']) %}"+"{{ data['user']['username'] }}", title: "{% raw translate('userConfig', 'deleteUser', data['lang']) %} "+userId,
message: "{{ translate('userConfig', 'confirmDelete', data['lang']) }}", message: "{{ translate('userConfig', 'confirmDelete', data['lang']) }}",
buttons: { buttons: {
cancel: { cancel: {
@ -259,7 +261,7 @@
callback: function (result) { callback: function (result) {
console.log(result); console.log(result);
if (result == true) { if (result == true) {
location.href="/panel/remove_user?id={{ data['user']['user_id'] }}"; location.href="/panel/remove_user?id="+userId;
} }
} }
}); });

View File

@ -87,7 +87,7 @@
</a> </a>
<br> <br>
<br> <br>
<button data-file="{{ backup['path'] }}" class="btn btn-danger del_button"> <button data-file="{{ backup['path'] }}" data-backup_path="{{ data['backup_path'] }}" class="btn btn-danger del_button">
<i class="fas fa-trash" aria-hidden="true"></i> <i class="fas fa-trash" aria-hidden="true"></i>
{{ translate('serverBackups', 'delete', data['lang']) }} {{ translate('serverBackups', 'delete', data['lang']) }}
</button> </button>
@ -209,6 +209,7 @@
$( ".del_button" ).click(function() { $( ".del_button" ).click(function() {
var file_to_del = $(this).data("file"); var file_to_del = $(this).data("file");
var backup_path = $(this).data('backup_path');
console.log("file to delete is" + file_to_del); console.log("file to delete is" + file_to_del);
@ -226,7 +227,7 @@
callback: function (result) { callback: function (result) {
console.log(result); console.log(result);
if (result == true) { if (result == true) {
var full_path = '{{ data['backup_path'] }}' + '/' + file_to_del; var full_path = backup_path + '/' + file_to_del;
del_backup(full_path, serverId); del_backup(full_path, serverId);
} }
} }

View File

@ -133,7 +133,7 @@
</style> </style>
<ul class="tree-view"> <ul class="tree-view">
<li> <li>
<div class="tree-ctx-item" data-path="{{ data['server_stats']['server_id']['path'] }}"> <div id="root_dir" class="tree-ctx-item" data-path="{{ data['server_stats']['server_id']['path'] }}">
<span id="{{ data['server_stats']['server_id']['path'] }}span" class="files-tree-title tree-caret-down root-dir" data-path="{{ data['server_stats']['server_id']['path'] }}" onclick="getToggleMain(event)"> <span id="{{ data['server_stats']['server_id']['path'] }}span" class="files-tree-title tree-caret-down root-dir" data-path="{{ data['server_stats']['server_id']['path'] }}" onclick="getToggleMain(event)">
<i class="far fa-folder"></i> <i class="far fa-folder"></i>
<i class="far fa-folder-open"></i> <i class="far fa-folder-open"></i>
@ -650,7 +650,7 @@
} }
function getTreeView(event) { function getTreeView(event) {
let path = "{{ data['server_stats']['server_id']['path'] }}"; const path = $('#root_dir').data('path');;
$.ajax({ $.ajax({
type: "GET", type: "GET",

View File

@ -233,18 +233,18 @@ function startup(){
try{ try{
document.getElementById("{{ data['schedule']['interval_type'] }}").setAttribute('selected', true); document.getElementById("{{ data['schedule']['interval_type'] }}").setAttribute('selected', true);
}catch{ }catch{
console.log("no element named {{ data['schedule']['interval_type'] }}") console.log("no element named")
} }
try{ try{
document.getElementById("{{ data['schedule']['difficulty'] }}").setAttribute('selected', true); document.getElementById("{{ data['schedule']['difficulty'] }}").setAttribute('selected', true);
}catch{ }catch{
console.log("no element named {{ data['schedule']['difficulty'] }}") console.log("no element named")
} }
try{ try{
document.getElementById("{{ data['schedule']['action'] }}").setAttribute('selected', true); document.getElementById("{{ data['schedule']['action'] }}").setAttribute('selected', true);
}catch{ }catch{
console.log("no element named {{ data['schedule']['action'] }}") console.log("no element named")
} }
ifDays(); ifDays();
yesnoCheck(); yesnoCheck();