This commit is contained in:
May 2023-05-10 15:29:57 -07:00
parent b82577e1a8
commit 92c48a52ef
4 changed files with 58 additions and 0 deletions

View file

@ -9,5 +9,9 @@
"accounts": {
"registrationEnabled": true,
"requiredForUpload": false
},
"webdrop": {
"accountRequired": false
}
}

View file

@ -73,6 +73,15 @@ fileApiRoutes.post("/manage", parser, (req,res) => {
files.files[e].visibility = req.body.value;
modified++;
break;
case "setTag":
if (!req.body.value) delete files.files[e].tag
else {
if (req.body.value.toString().length > 30) return
files.files[e].tag = req.body.value.toString().lower()
}
modified++;
break;
}
})

View file

@ -161,6 +161,46 @@ export function fileOptions(optPicker,file) {
})
break;
case "tag":
optPicker.picker("Enter a tag (max 30char)",[
{
name: "Tag name",
icon: "/static/assets/icons/tag.svg",
id: "tag",
inputSettings: {}
},
{
name: "OK",
icon: "/static/assets/icons/update.svg",
id: true
}
]).then((exp) => {
if (exp && exp.selected) {
fetch(`/files/manage`, {method: "POST", body: JSON.stringify({
target: [ file.id ],
action: "setTag",
value: exp.selected || null
})}).then((response) => {
if (response.status != 200) {
optPicker.picker(`${response.status} ${response.statusText}`,[])
}
fetchFilePointers();
})
}
})
break
}
}

View file

@ -37,6 +37,11 @@
<p class="detail">
<img src="/static/assets/icons/{file.visibility || "public"}.svg" alt={file.visibility||"public"} />&nbsp;
<span class="number">{file.id}</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="number">{file.mime.split(";")[0]}</span>
{#if file.tag}
<br />
<img src="/static/assets/icons/tag.svg" alt="tag"/>&nbsp;
<span class="number">{file.tag}</span>
{/if}
</p>
</div>
<button class="more" on:click={fileOptions(picker, file)}>