fix: add authentication to file downloads
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 2m24s
Run Tests / Backend Tests (push) Failing after 4m13s
Run Tests / Frontend Tests (push) Failing after 3m53s
Run Tests / Test Summary (push) Failing after 13s
Run Tests / Backend Tests (pull_request) Failing after 4m13s
Run Tests / Frontend Tests (pull_request) Failing after 2m58s
Run Tests / Test Summary (pull_request) Failing after 18s
Deploy Dashboard (Dev) / deploy-dev (push) Successful in 2m24s
Run Tests / Backend Tests (push) Failing after 4m13s
Run Tests / Frontend Tests (push) Failing after 3m53s
Run Tests / Test Summary (push) Failing after 13s
Run Tests / Backend Tests (pull_request) Failing after 4m13s
Run Tests / Frontend Tests (pull_request) Failing after 2m58s
Run Tests / Test Summary (pull_request) Failing after 18s
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script>
|
||||
import { onMount } from "svelte";
|
||||
import { get, del, upload } from "../lib/api.js";
|
||||
import { get, del, upload, download } from "../lib/api.js";
|
||||
|
||||
let entries = $state([]);
|
||||
let currentPath = $state("");
|
||||
@@ -29,9 +29,9 @@
|
||||
browse(currentPath);
|
||||
}
|
||||
|
||||
function downloadUrl(name) {
|
||||
async function handleDownload(name) {
|
||||
const path = currentPath ? `${currentPath}/${name}` : name;
|
||||
return `/api/files/download?path=${encodeURIComponent(path)}`;
|
||||
await download(path, name);
|
||||
}
|
||||
|
||||
async function handleUpload() {
|
||||
@@ -137,7 +137,7 @@
|
||||
<span class="text-xs text-surface-400 text-right">{e.is_dir ? "—" : formatSize(e.size)}</span>
|
||||
<div class="flex items-center justify-end gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
{#if !e.is_dir}
|
||||
<a href={downloadUrl(e.name)} class="text-[11px] text-primary-500 hover:text-primary-700 font-medium transition-colors">DL</a>
|
||||
<button onclick={() => handleDownload(e.name)} class="text-[11px] text-primary-500 hover:text-primary-700 font-medium transition-colors">DL</button>
|
||||
{/if}
|
||||
<button class="text-[11px] text-rose-400 hover:text-rose-600 font-medium transition-colors" onclick={() => remove(e.name)}>Del</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user