fix : securite middle et execfile

This commit is contained in:
2026-03-12 08:37:53 +01:00
parent 126d6b505a
commit 47bc8ba966
13 changed files with 116 additions and 42 deletions

View File

@@ -79,6 +79,7 @@
<script setup lang="ts">
import { computed, onMounted, ref } from "vue"
import { Icon as IconifyIcon } from "@iconify/vue"
import { useApiAuthHeader } from "~/composables/useApiAuth"
type BackupScript = {
key: string
@@ -118,6 +119,7 @@ const scripts = ref<BackupScript[]>([])
const output = ref<string>("")
const message = ref<string>("")
const isError = ref(false)
const apiAuthHeader = useApiAuthHeader()
const statusClass = computed(() => (isError.value ? "status-error" : "status-success"))
@@ -134,7 +136,9 @@ const loadScripts = async () => {
downloadFolders: []
})
try {
const data = await $fetch<BackupScriptListResponse>("/api/backup-script")
const data = await $fetch<BackupScriptListResponse>("/api/backup-script", {
headers: apiAuthHeader
})
scripts.value = data.scripts
} catch (error) {
scripts.value = []
@@ -162,7 +166,8 @@ const runScript = async (key: string) => {
try {
const data = await $fetch<BackupScriptRunResponse>("/api/backup-script", {
method: "POST",
body: { key }
body: { key },
headers: apiAuthHeader
})
message.value = `${data.label} execute avec succes`
output.value = data.output || "Aucune sortie retournee."