Better paths

This commit is contained in:
Akif9748 2022-04-03 19:55:33 +03:00
parent a2d5056b8f
commit fc8d4c1c68
5 changed files with 6 additions and 10 deletions

View file

@ -24,7 +24,6 @@ And, you can learn informations about API in `APIDOCS.md`.
- Better DB writing. Example, not `message.author.id`, `messsage.authorID`
- `/errors/error` will change, better error page.
- Support for not logins...
- message/react/:id ❌ message/:id/react ✔️
## Roadmap
- [x] User

View file

@ -34,7 +34,7 @@ app.post("/", (req, res) => {
});
app.post("/delete/:id", (req, res) => {
app.post("/:id/delete", (req, res) => {
if (!req.session.loggedin) return res.redirect('/login');
const message = new Message().getId(req.params.id)
@ -49,7 +49,7 @@ app.post("/delete/:id", (req, res) => {
res.status(200).redirect("/threads/" + message.thread.id);
})
app.post("/react/:id", (req, res) => {
app.post("/:id/react", (req, res) => {
if (!req.session.loggedin) return res.redirect('/login');
const { id = null } = req.params;

View file

@ -36,7 +36,7 @@ app.get("/:id", (req, res) => {
else error(res, 404, "We have not got this user.");
});
app.post("/delete/:id", (req, res) => {
app.post("/:id/delete/", (req, res) => {
if (!req.session.loggedin) return res.redirect('/login');
const user = new User().getId(req.session.userid);
if (!user.admin)

View file

@ -27,14 +27,11 @@
<h2>
<%= message.content %>
</h2>
<form style="text-align:right;display:inline;" action="/message/delete/<%= message.id %>" method="post">
<form style="text-align:right;display:inline;" action="/message/<%= message.id %>/delete/" method="post">
<button style="display:inline;" class="button" type="submit">DELETE</button>
</form>
<form style="display:inline;" action="/message/<%= message.id %>" method="delete">
</form>
<form style="text-align:right;" action="/message/react/<%= message.id %>" method="POST">
<form style="text-align:right;" action="/message/<%= message.id %>/react/" method="POST">
<h3 style="display:inline;">
<%= Object.values(message.react).filter(Boolean).length - Object.values(message.react).filter(x=>

View file

@ -47,7 +47,7 @@
</form>
<form action="/users/delete/<%= member.id %>" method="POST">
<form action="/users/<%= member.id %>/delete" method="POST">
<button class="buyuk" type="submit">Delete user!</button>
</form>
<% }; %>