This commit is contained in:
split / May 2023-05-09 22:44:31 -07:00
parent dd39eff6b5
commit 982154465a
2 changed files with 26 additions and 4 deletions

View file

@ -55,7 +55,7 @@ fileApiRoutes.post("/manage", parser, (req,res) => {
let acc = Accounts.getFromToken(req.cookies.auth) as Accounts.Account let acc = Accounts.getFromToken(req.cookies.auth) as Accounts.Account
if (!acc) return 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 let modified = 0

View file

@ -22,6 +22,26 @@ export let options = {
id: "private" 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: [ AYS: [
{ {
name: "Yes", name: "Yes",
@ -104,7 +124,7 @@ export function fileOptions(optPicker,file) {
case "delete": case "delete":
fetch(`/files/manage`,{method:"POST", body:JSON.stringify({ fetch(`/files/manage`,{method:"POST", body:JSON.stringify({
target: [ file ], target: [ file.id ],
action: "delete", action: "delete",
})}).then((response) => { })}).then((response) => {
@ -115,14 +135,16 @@ export function fileOptions(optPicker,file) {
fetchFilePointers() fetchFilePointers()
}) })
break;
case "changeFileVisibility": case "changeFileVisibility":
optPicker.picker("Set file visibility", options.FV).then((exp) => { optPicker.picker("Set file visibility", options.FV2).then((exp) => {
if (exp && exp.selected) { if (exp && exp.selected) {
fetch(`/files/manage`, {method: "POST", body: JSON.stringify({ fetch(`/files/manage`, {method: "POST", body: JSON.stringify({
target: [ file ], target: [ file.id ],
action: "changeFileVisibility", action: "changeFileVisibility",
value: exp.selected value: exp.selected