Merge branch 'develop' into feat/add-module-lint

# Conflicts:
#	components/BackupRun.vue
#	composables/useApiAuth.ts
#	pages/index.vue
#	server/api/disk.get.ts
This commit is contained in:
2026-03-13 10:03:18 +01:00
18 changed files with 276 additions and 108 deletions

View File

@@ -96,6 +96,7 @@
<script setup lang="ts">
import { ref } from "vue"
import BackupRun from "~/components/BackupRun.vue"
import { apiFetch, downloadApiFile } from "~/composables/useApiAuth"
definePageMeta({ layout: false })
@@ -119,33 +120,25 @@ const selectedBackup = ref<string | null>(null)
const scriptResult = ref<ScriptResult>(emptyScriptResult())
const fetchLatestBackup = async (folder: string) => {
const files = await $fetch<string[]>(`/api/backups?folder=${encodeURIComponent(folder)}`)
const files = await apiFetch<string[]>(`/api/backups?folder=${encodeURIComponent(folder)}`)
return files[0] || null
}
const triggerDownload = (folder: string, file: string) => {
const link = document.createElement("a")
link.href = `/api/download?folder=${encodeURIComponent(folder)}&file=${encodeURIComponent(file)}`
link.style.display = "none"
document.body.appendChild(link)
link.click()
link.remove()
const triggerDownload = async (folder: string, file: string) => {
const url = `/api/download?folder=${encodeURIComponent(folder)}&file=${encodeURIComponent(file)}`
await downloadApiFile(url, file)
}
const triggerBatchDownload = (folders: string[]) => {
const link = document.createElement("a")
link.href = `/api/download-latest?folders=${encodeURIComponent(folders.join(","))}`
link.style.display = "none"
document.body.appendChild(link)
link.click()
link.remove()
const triggerBatchDownload = async (folders: string[]) => {
const url = `/api/download-latest?folders=${encodeURIComponent(folders.join(","))}`
await downloadApiFile(url, "backup-latest.tar.gz")
}
const downloadLatestBackup = async (folder: string) => {
const latestFile = await fetchLatestBackup(folder)
if (latestFile) {
triggerDownload(folder, latestFile)
await triggerDownload(folder, latestFile)
}
}
@@ -157,7 +150,7 @@ const handleScriptResult = async (payload: ScriptResult) => {
}
if (payload.downloadFolders.length > 1) {
triggerBatchDownload(payload.downloadFolders)
await triggerBatchDownload(payload.downloadFolders)
return
}

View File

@@ -49,6 +49,7 @@
<script setup lang="ts">
import {computed, onMounted, ref} from "vue"
definePageMeta({layout: false})
import { apiFetch } from "~/composables/useApiAuth"
type DiskSourceResult = {
key: string
@@ -150,16 +151,15 @@ const runScript = async () => {
rawResults.value = []
try {
const output = await $fetch<DiskApiResponse>("/api/disk")
const output = await apiFetch<DiskApiResponse>("/api/disk")
rawResults.value = output.results
} catch (error) {
const message = `Erreur: ${error instanceof Error ? error.message : String(error)}`
rawResults.value = [
{
key: "error",
label: "Source indisponible",
ok: false,
output: message
output: "Erreur lors de l'opération"
}
]
} finally {