fix: use HttpUtil with relative paths and remove authHeaders from backup UI

This commit is contained in:
root 2026-04-26 20:18:37 +08:00
parent 0f10252709
commit ace8dc3ce0

View file

@ -64,7 +64,7 @@
</a-card> </a-card>
</a-col> </a-col>
<a-col> <a-col>
<a-tabs default-active-key="1" @change="onSettingsTabChange"> <a-tabs default-active-key="1">
<a-tab-pane key="1" :style="{ paddingTop: '20px' }"> <a-tab-pane key="1" :style="{ paddingTop: '20px' }">
<template #tab> <template #tab>
<a-icon type="setting"></a-icon> <a-icon type="setting"></a-icon>
@ -271,9 +271,6 @@
backupRefreshInterval: null, backupRefreshInterval: null,
}, },
methods: { methods: {
onSettingsTabChange(key) {
if (key === '7') { this.fetchBackups(); }
},
loading(spinning = true) { loading(spinning = true) {
this.loadingStates.spinning = spinning; this.loadingStates.spinning = spinning;
}, },
@ -471,10 +468,9 @@
}, },
fetchBackups() { fetchBackups() {
this.backupLoading = true; this.backupLoading = true;
axios.get(this.entryHost + 'panel/api/server/listBackups', { HttpUtil.get("/panel/api/server/listBackups")
headers: this.authHeaders .then(msg => {
}).then(res => { this.backupList = msg.obj || [];
this.backupList = res.data.obj || [];
}).catch(err => { }).catch(err => {
this.$message.error('Failed to load backups'); this.$message.error('Failed to load backups');
}).finally(() => { }).finally(() => {
@ -483,9 +479,8 @@
}, },
createBackup() { createBackup() {
this.backupCreating = true; this.backupCreating = true;
axios.post(this.entryHost + 'panel/api/server/backup', {}, { HttpUtil.post("/panel/api/server/backup")
headers: this.authHeaders .then(msg => {
}).then(res => {
this.$message.success('Backup created successfully'); this.$message.success('Backup created successfully');
this.fetchBackups(); this.fetchBackups();
}).catch(err => { }).catch(err => {
@ -495,9 +490,8 @@
}); });
}, },
restoreBackup(filename) { restoreBackup(filename) {
axios.post(this.entryHost + 'panel/api/server/restore/' + filename, {}, { HttpUtil.post("/panel/api/server/restore/" + filename)
headers: this.authHeaders .then(msg => {
}).then(res => {
this.$message.success('Restore completed'); this.$message.success('Restore completed');
this.fetchBackups(); this.fetchBackups();
}).catch(err => { }).catch(err => {
@ -505,9 +499,8 @@
}); });
}, },
deleteBackup(filename) { deleteBackup(filename) {
axios.post(this.entryHost + 'panel/api/server/deleteBackup/' + filename, {}, { HttpUtil.post("/panel/api/server/deleteBackup/" + filename)
headers: this.authHeaders .then(msg => {
}).then(res => {
this.$message.success('Backup deleted'); this.$message.success('Backup deleted');
this.fetchBackups(); this.fetchBackups();
}).catch(err => { }).catch(err => {
@ -515,7 +508,7 @@
}); });
}, },
downloadBackup(filename) { downloadBackup(filename) {
window.open(this.entryHost + 'panel/api/server/downloadBackup/' + filename, '_blank'); window.open("/panel/api/server/downloadBackup/" + filename, '_blank');
}, },
formatFileSize(bytes) { formatFileSize(bytes) {
if (!bytes || bytes === 0) return '0 B'; if (!bytes || bytes === 0) return '0 B';