diff --git a/src/server/routes/fileApiRoutes.ts b/src/server/routes/fileApiRoutes.ts index bc0edd3..c0ee337 100644 --- a/src/server/routes/fileApiRoutes.ts +++ b/src/server/routes/fileApiRoutes.ts @@ -55,7 +55,7 @@ fileApiRoutes.post("/manage", parser, (req,res) => { let acc = Accounts.getFromToken(req.cookies.auth) as Accounts.Account if (!acc) return - if (!req.body.target || req.body.target.length < 1) return + if (!req.body.target || !(typeof req.body.target == "object") || req.body.target.length < 1) return let modified = 0 diff --git a/src/svelte/elem/prompts/uploads.js b/src/svelte/elem/prompts/uploads.js index 1322209..fac251d 100644 --- a/src/svelte/elem/prompts/uploads.js +++ b/src/svelte/elem/prompts/uploads.js @@ -22,6 +22,26 @@ export let options = { id: "private" } ], + FV2: [ + { + name: "Public", + icon: "/static/assets/icons/public.svg", + description: "Everyone can view this file", + id: "public" + }, + { + name: "Anonymous", + icon: "/static/assets/icons/anonymous.svg", + description: "Your username will be hidden", + id: "anonymous" + }, + { + name: "Private", + icon: "/static/assets/icons/private.svg", + description: "Nobody but you can view this file", + id: "private" + } + ], AYS: [ { name: "Yes", @@ -104,7 +124,7 @@ export function fileOptions(optPicker,file) { case "delete": fetch(`/files/manage`,{method:"POST", body:JSON.stringify({ - target: [ file ], + target: [ file.id ], action: "delete", })}).then((response) => { @@ -115,14 +135,16 @@ export function fileOptions(optPicker,file) { fetchFilePointers() }) + break; + case "changeFileVisibility": - optPicker.picker("Set file visibility", options.FV).then((exp) => { + optPicker.picker("Set file visibility", options.FV2).then((exp) => { if (exp && exp.selected) { fetch(`/files/manage`, {method: "POST", body: JSON.stringify({ - target: [ file ], + target: [ file.id ], action: "changeFileVisibility", value: exp.selected