{{ usage }} of {{ capacity }}
diff --git a/ui/nuxt.config.ts b/ui/nuxt.config.ts
index 2ed2fa8..d1e8697 100644
--- a/ui/nuxt.config.ts
+++ b/ui/nuxt.config.ts
@@ -1,6 +1,6 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
- ssr: true,
+ ssr: process.env.NODE_ENV === 'production' ? true : false,
compatibilityDate: '2024-04-03',
css: ['~/assets/css/main.css'],
@@ -11,10 +11,6 @@ export default defineNuxtConfig({
devtools: { enabled: true },
- experimental: {
- buildCache: true,
- },
-
modules: [
'@nuxtjs/color-mode',
],
diff --git a/ui/pages/home/[...name].vue b/ui/pages/home/[...name].vue
index 210ea63..d5d6bc2 100644
--- a/ui/pages/home/[...name].vue
+++ b/ui/pages/home/[...name].vue
@@ -208,9 +208,14 @@ const openFilePicker = () => {
}
const createFolder = async () => {
- let { data, error } = await useFetch('/api/files/upload/' + route.path.replace(/^\/home/, '') + '/' + folderName.value, {
- method: "POST"
- })
+ const { data, error } = await useAsyncData(
+ () => $fetch('/api/files/upload' + route.path.replace(/^\/home/, '') + '/' + folderName.value, {
+ method: "POST",
+ body: {
+ files: selectedFiles.value?.map(file => ({ name: file.name }))
+ }
+ })
+ )
if (error.value != null) {
folderError.value = error.value.data.message;
@@ -224,7 +229,7 @@ const createFolder = async () => {
}
const deleteFiles = async () => {
- await useFetch('/api/files/delete' + route.path.replace(/^\/home/, ''), {
+ await $fetch('/api/files/delete' + route.path.replace(/^\/home/, ''), {
method: "POST",
body: {
files: selectedFiles.value?.map(file => ({ name: file.name }))
@@ -233,6 +238,47 @@ const deleteFiles = async () => {
files.value = files.value?.filter(file => !selectedFiles.value?.includes(file))
}
+
+const downloadFile = (file) => {
+ const anchor = document.createElement('a');
+ anchor.href = '/api/files/download/' + file.name;
+ anchor.download = file.name;
+
+ document.body.appendChild(anchor);
+ anchor.click();
+ document.body.removeChild(anchor);
+}
+
+const downloadFiles = async () => {
+ let filenames = ""
+
+ selectedFiles.value?.forEach((file, i) => {
+ filenames += encodeURIComponent(file.name)
+ if (i != selectedFiles.value?.length - 1) {
+ filenames += ",";
+ }
+ })
+
+ let { data, error } = await useAsyncData(
+ () => $fetch('/api/files/download', {
+ params: {
+ "filenames": filenames
+ }
+ })
+ )
+
+ console.log("DATA", data.value)
+
+ if (error.value == null) {
+ const anchor = document.createElement('a');
+ anchor.href = window.URL.createObjectURL(data.value)
+ anchor.download = "filething.zip";
+
+ document.body.appendChild(anchor);
+ anchor.click();
+ document.body.removeChild(anchor);
+ }
+}
@@ -251,10 +297,10 @@ const deleteFiles = async () => {