diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-10-05 14:52:56 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-10-05 15:08:49 +0200 |
commit | f39d772de8d75232dd2d2637124ab60e6a408fac (patch) | |
tree | 32ceab2ce94250e27099b5bccce1d087e8e2b9ae | |
parent | 47b5c03d286eb047b62f6d03dddf7d6bc6b3978e (diff) | |
download | server-f39d772de8d75232dd2d2637124ab60e6a408fac.tar.gz |
Change some URLs to be more consistent.
-rw-r--r-- | server.js | 20 | ||||
-rw-r--r-- | views/contacts.pug | 4 | ||||
-rw-r--r-- | views/message_outbox.pug | 2 | ||||
-rw-r--r-- | views/user.pug | 8 | ||||
-rw-r--r-- | views/webhook.pug | 4 |
5 files changed, 19 insertions, 19 deletions
@@ -600,12 +600,12 @@ app.get('/webhook', must_be_logged_in, function (req, res) { res.render('webhook.pug', { user: req.user, webhook: webhook }) }) -app.post("/delete-webhook", must_be_logged_in, function (req, res) { +app.post("/api/webhook/delete", must_be_logged_in, function (req, res) { SQL_DELETE_WEBHOOK.run(req.user.user_id) res.redirect("/webhook") }) -app.post("/update-webhook", must_be_logged_in, function (req, res) { +app.post("/api/webhook/update", must_be_logged_in, function (req, res) { let url = req.body.url let prefix = req.body.prefix let format = req.body.format @@ -694,7 +694,7 @@ app.get('/contacts', must_be_logged_in, function (req, res) { }) }) -app.get("/contact/remove/:who_name", must_be_logged_in, function (req, res) { +app.get("/contacts/remove/:who_name", must_be_logged_in, function (req, res) { let who = SQL_SELECT_USER_BY_NAME.get(req.params.who_name) if (!who) return res.status(404).send("User not found.") @@ -702,7 +702,7 @@ app.get("/contact/remove/:who_name", must_be_logged_in, function (req, res) { return res.redirect("/contacts") }) -app.get("/contact/add-friend/:who_name", must_be_logged_in, function (req, res) { +app.get("/contacts/add-friend/:who_name", must_be_logged_in, function (req, res) { let who = SQL_SELECT_USER_BY_NAME.get(req.params.who_name) if (!who) return res.status(404).send("User not found.") @@ -710,7 +710,7 @@ app.get("/contact/add-friend/:who_name", must_be_logged_in, function (req, res) return res.redirect("/user/" + who.name) }) -app.get("/contact/add-enemy/:who_name", must_be_logged_in, function (req, res) { +app.get("/contacts/add-enemy/:who_name", must_be_logged_in, function (req, res) { let who = SQL_SELECT_USER_BY_NAME.get(req.params.who_name) if (!who) return res.status(404).send("User not found.") @@ -846,6 +846,11 @@ app.get('/message/reply/:message_id', must_be_logged_in, function (req, res) { }) }) +app.get('/message/delete/outbox', must_be_logged_in, function (req, res) { + MESSAGE_DELETE_ALL_OUTBOX.run(req.user.user_id) + res.redirect('/outbox') +}) + app.get('/message/delete/:message_id', must_be_logged_in, function (req, res) { let message_id = req.params.message_id | 0 MESSAGE_DELETE_INBOX.run(message_id, req.user.user_id) @@ -853,11 +858,6 @@ app.get('/message/delete/:message_id', must_be_logged_in, function (req, res) { res.redirect('/inbox') }) -app.get('/outbox/delete', must_be_logged_in, function (req, res) { - MESSAGE_DELETE_ALL_OUTBOX.run(req.user.user_id) - res.redirect('/outbox') -}) - /* * FORUM */ diff --git a/views/contacts.pug b/views/contacts.pug index 78f1f5b..64d39d0 100644 --- a/views/contacts.pug +++ b/views/contacts.pug @@ -29,7 +29,7 @@ html td= who.atime td.r a.blue(href="/message/send/"+who.name) 📝 - a.red(href="/contact/remove/"+who.name) ❌ + a.red(href="/contacts/remove/"+who.name) ❌ else tr td Nobody @@ -48,7 +48,7 @@ html td a.black(href="/user/"+who.name)= who.name td.r - a.red(href="/contact/remove/"+who.name) ❌ + a.red(href="/contacts/remove/"+who.name) ❌ else tr td Nobody diff --git a/views/message_outbox.pug b/views/message_outbox.pug index 267a8b3..f305d83 100644 --- a/views/message_outbox.pug +++ b/views/message_outbox.pug @@ -10,7 +10,7 @@ html function delete_all() { let warning = "Are you sure you want to delete ALL the messages?" if (window.confirm(warning)) - window.location.href = "/outbox/delete" + window.location.href = "/message/delete/outbox" } body include header diff --git a/views/user.pug b/views/user.pug index c11f865..abb7865 100644 --- a/views/user.pug +++ b/views/user.pug @@ -31,13 +31,13 @@ html a(href="/message/send/"+who.name) Send message br if relation > 0 - a(href="/contact/remove/"+who.name) Remove from friends + a(href="/contacts/remove/"+who.name) Remove from friends else if relation < 0 - a(href="/contact/remove/"+who.name) Remove from blacklist + a(href="/contacts/remove/"+who.name) Remove from blacklist else - a(href="/contact/add-friend/"+who.name) Add to friends + a(href="/contacts/add-friend/"+who.name) Add to friends br - a(href="/contact/add-enemy/"+who.name) Blacklist user + a(href="/contacts/add-enemy/"+who.name) Blacklist user if open_games.length > 0 h2 Open diff --git a/views/webhook.pug b/views/webhook.pug index ad6c75f..20d20ac 100644 --- a/views/webhook.pug +++ b/views/webhook.pug @@ -14,7 +14,7 @@ html(lang="en") - var format = webhook && webhook.format || "" - var prefix = webhook && webhook.prefix || "" - form(action="/update-webhook" method="post") + form(action="/api/webhook/update" method="post") if webhook && webhook.error p.error ERROR: #{webhook.error} p Webhook URL: @@ -34,7 +34,7 @@ html(lang="en") button(type="submit") Create if webhook - form(action="/delete-webhook" method="post") + form(action="/api/webhook/delete" method="post") button(type="submit") Delete h2 Discord Notifications |