From e95f338d13642f3e83e6a9db214f77d3c42b4087 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Thu, 9 Feb 2023 20:20:16 -0500 Subject: [PATCH] [+] Downloadable files --- src/App.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 5a14f3f..a3ec488 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -18,6 +18,8 @@ interface File { mtime: string } +// const assets = ".web-static" +const assets = "/" const host = "https://daisy-ddns.hydev.org/data/api" const path = window.location.pathname @@ -34,8 +36,13 @@ function getIcon(f: File) const sp = f.name.split(".") const m = mime.getType(sp[sp.length - 1]) - if (m) return `/mime/${m.replace("/", "-")}.svg` - else return '/mime/application-blank.svg' + if (m) return urlJoin(assets, `mime/${m.replace("/", "-")}.svg`) + else return urlJoin(assets, 'mime/application-blank.svg') +} + +function getHref(f: File) +{ + return f.type == "directory" ? urlJoin(path, f.name) : urlJoin(host, path, f.name) } export default function App() { @@ -69,7 +76,7 @@ export default function App() { {/* For each file */} {(f, i) => - + {/* File name tooltip */}