Fix file get naming

This commit is contained in:
amcmanu3 2023-09-04 19:32:56 -04:00
parent fe5e7e8851
commit 9c9f9d3556

View File

@ -310,13 +310,12 @@
} }
async function backup_started() { async function backup_started() {
var token = getCookie("_xsrf") const token = getCookie("_xsrf")
document.getElementById('backup_button').style.visibility = 'hidden'; document.getElementById('backup_button').style.visibility = 'hidden';
var dialog = bootbox.dialog({ var dialog = bootbox.dialog({
message: "{{ translate('serverBackups', 'backupTask', data['lang']) }}", message: "{{ translate('serverBackups', 'backupTask', data['lang']) }}",
closeButton: false closeButton: false
}); });
var token = getCookie("_xsrf");
let res = await fetch(`/api/v2/servers/${server_id}/action/backup_server`, { let res = await fetch(`/api/v2/servers/${server_id}/action/backup_server`, {
method: 'POST', method: 'POST',
headers: { headers: {
@ -338,7 +337,7 @@
return; return;
} }
async function del_backup(filename, id) { async function del_backup(filename, id) {
var token = getCookie("_xsrf") const token = getCookie("_xsrf")
let contents = JSON.stringify({"filename": filename}) let contents = JSON.stringify({"filename": filename})
let res = await fetch(`/api/v2/servers/${id}/backups/backup/`, { let res = await fetch(`/api/v2/servers/${id}/backups/backup/`, {
method: 'DELETE', method: 'DELETE',
@ -357,7 +356,7 @@
} }
async function restore_backup(filename, id) { async function restore_backup(filename, id) {
var token = getCookie("_xsrf") const token = getCookie("_xsrf")
let contents = JSON.stringify({"filename": filename}) let contents = JSON.stringify({"filename": filename})
var dialog = bootbox.dialog({ var dialog = bootbox.dialog({
message: "<i class='fa fa-spin fa-spinner'></i> {{ translate('serverBackups', 'restoring', data['lang']) }}", message: "<i class='fa fa-spin fa-spinner'></i> {{ translate('serverBackups', 'restoring', data['lang']) }}",
@ -411,7 +410,7 @@
$(document).ready(function () { $(document).ready(function () {
$("#backup-form").on("submit", async function (e) { $("#backup-form").on("submit", async function (e) {
e.preventDefault(); e.preventDefault();
var token = getCookie("_xsrf") const token = getCookie("_xsrf")
let backupForm = document.getElementById("backup-form"); let backupForm = document.getElementById("backup-form");
let formData = new FormData(backupForm); let formData = new FormData(backupForm);
@ -568,7 +567,7 @@
} }
path = $("#root_files_button").data('server_path') path = $("#root_files_button").data('server_path')
console.log($("#root_files_button").data('server_path')) console.log($("#root_files_button").data('server_path'))
var token = getCookie("_xsrf"); const token = getCookie("_xsrf");
var dialog = bootbox.dialog({ var dialog = bootbox.dialog({
message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>', message: '<p class="text-center mb-0"><i class="fa fa-spin fa-cog"></i> Please wait while we gather your files...</p>',
closeButton: false closeButton: false
@ -618,13 +617,14 @@
} }
async function getTreeView(path){ async function getTreeView(path){
var token = getCookie("_xsrf"); console.log(path)
const token = getCookie("_xsrf");
let res = await fetch(`/api/v2/servers/${server_id}/files`, { let res = await fetch(`/api/v2/servers/${server_id}/files`, {
method: 'POST', method: 'POST',
headers: { headers: {
'X-XSRFToken': token 'X-XSRFToken': token
}, },
body: JSON.stringify({"page": "backups", "folder": path}), body: JSON.stringify({"page": "backups", "path": path}),
}); });
let responseData = await res.json(); let responseData = await res.json();
if (responseData.status === "ok") { if (responseData.status === "ok") {