mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-23 04:10:40 +03:00
\n => <br>
This commit is contained in:
parent
c9433e175a
commit
8ee97ea497
7 changed files with 10 additions and 17 deletions
|
@ -43,6 +43,7 @@ And, you can learn about API in `util/APIDOCS.md`.
|
||||||
| Ratelimit | 🟢 | HIGH |
|
| Ratelimit | 🟢 | HIGH |
|
||||||
| Send | 🟢 | HIGH |
|
| Send | 🟢 | HIGH |
|
||||||
| Delete | 🟢 | HIGH |
|
| Delete | 🟢 | HIGH |
|
||||||
|
| Regex for scripts | 🔴 | HIGH |
|
||||||
| Undelete | 🔴 | MEDIUM |
|
| Undelete | 🔴 | MEDIUM |
|
||||||
| React | 🟢 | MEDIUM |
|
| React | 🟢 | MEDIUM |
|
||||||
| Edit | 🔴 | MEDIUM |
|
| Edit | 🔴 | MEDIUM |
|
||||||
|
|
|
@ -16,7 +16,7 @@ function renderMessage(message) {
|
||||||
<a href=${"/users/" + message.author.id}> ${message.author.name}</a>:
|
<a href=${"/users/" + message.author.id}> ${message.author.name}</a>:
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<p>${message.content}</p><br>
|
<p>${message.content.replaceAll("\n","<br>")}</p><br>
|
||||||
<div id="message-delete-${message.id}">
|
<div id="message-delete-${message.id}">
|
||||||
${!message.deleted ?
|
${!message.deleted ?
|
||||||
`<form style="display:inline;">
|
`<form style="display:inline;">
|
||||||
|
@ -49,14 +49,9 @@ function renderMessage(message) {
|
||||||
|
|
||||||
|
|
||||||
} else
|
} else
|
||||||
for (const message of result) {
|
for (const message of result)
|
||||||
|
|
||||||
const arr = Object.values(message.react || {})
|
|
||||||
|
|
||||||
message.reactCount = arr.filter(Boolean).length - arr.filter(x => !x).length;
|
|
||||||
|
|
||||||
renderMessage(message);
|
renderMessage(message);
|
||||||
}
|
|
||||||
window.scrollTo(0, document.body.scrollHeight);
|
window.scrollTo(0, document.body.scrollHeight);
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const { UserModel, SecretModel } = require("../models");
|
const { UserModel, SecretModel } = require("../models");
|
||||||
const { Router } = require("express")
|
const { Router } = require("express")
|
||||||
const bcrypt = require("bcrypt");
|
const bcrypt = require("bcrypt");
|
||||||
|
const rateLimit = require('express-rate-limit')
|
||||||
|
|
||||||
const app = Router();
|
const app = Router();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
const { Router } = require("express");
|
const { Router } = require("express");
|
||||||
const app = Router();
|
const app = Router();
|
||||||
const rateLimit = require('express-rate-limit')
|
|
||||||
|
|
||||||
const { ThreadModel, MessageModel } = require("../models")
|
const { ThreadModel, MessageModel } = require("../models")
|
||||||
|
|
||||||
|
@ -33,10 +32,7 @@ app.get("/:id", async (req, res) => {
|
||||||
|
|
||||||
const messages = await Promise.all(thread.messages.map(async id => {
|
const messages = await Promise.all(thread.messages.map(async id => {
|
||||||
const message = await MessageModel.get(id)
|
const message = await MessageModel.get(id)
|
||||||
const arr = Object.values(message.react)
|
return user?.admin || !message?.deleted ? message.toObject({ virtuals: true }) : null;
|
||||||
message.reactCount = arr.filter(Boolean).length - arr.filter(x => !x).length;
|
|
||||||
|
|
||||||
return user?.admin || !message?.deleted ? message : null;
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
res.render("thread", { thread, messages, user,scroll:req.query.scroll || false });
|
res.render("thread", { thread, messages, user,scroll:req.query.scroll || false });
|
||||||
|
|
|
@ -32,7 +32,7 @@ You need this headers for send request to API:
|
||||||
- POST `/api/messages/:id/react/:type` for react to a message.
|
- POST `/api/messages/:id/react/:type` for react to a message.
|
||||||
|
|
||||||
### Example request:
|
### Example request:
|
||||||
```GET /api/message/1```
|
```GET /api/messages/1```
|
||||||
|
|
||||||
#### Example API Output:
|
#### Example API Output:
|
||||||
```json
|
```json
|
||||||
|
|
Loading…
Reference in a new issue