admin stuff

This commit is contained in:
Flummi
2021-12-23 06:07:08 +01:00
parent f87dcc8ee1
commit 2c80c58f59
4 changed files with 2 additions and 16 deletions

View File

@ -16,20 +16,6 @@ const getTags = async itemid => await sql("tags_assign")
.where("tags_assign.item_id", itemid)
.select("tags.id", "tags.tag", "tags_assign.prefix");
const cleanTags = async () => {
const tags = await sql("tags").leftJoin("tags_assign", "tags_assign.tag_id", "tags.id").whereNull("tags_assign.item_id");
if(tags.length === 0)
return;
let deleteTag = sql("tags");
tags.forEach(tag => {
if(["sfw", "nsfw"].includes(tag.tag.toLowerCase()))
return;
deleteTag = deleteTag.orWhere("id", tag.id);
});
await deleteTag.del();
};
export default (router, tpl) => {
router.group(/^\/api\/v2/, group => {

View File

@ -83,6 +83,7 @@ import flummpress from "flummpress";
await sql("user_sessions") // log last action
.update("last_used", (Date.now() / 1e3))
.update("last_action", req.url.pathname)
.update("browser", req.headers["user-agent"])
.where("id", user[0].sess_id);
// update userprofile