mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-26 13:20:41 +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 |
|
||||
| Send | 🟢 | HIGH |
|
||||
| Delete | 🟢 | HIGH |
|
||||
| Regex for scripts | 🔴 | HIGH |
|
||||
| Undelete | 🔴 | MEDIUM |
|
||||
| React | 🟢 | MEDIUM |
|
||||
| Edit | 🔴 | MEDIUM |
|
||||
|
|
|
@ -16,7 +16,7 @@ function renderMessage(message) {
|
|||
<a href=${"/users/" + message.author.id}> ${message.author.name}</a>:
|
||||
</h2>
|
||||
|
||||
<p>${message.content}</p><br>
|
||||
<p>${message.content.replaceAll("\n","<br>")}</p><br>
|
||||
<div id="message-delete-${message.id}">
|
||||
${!message.deleted ?
|
||||
`<form style="display:inline;">
|
||||
|
@ -49,14 +49,9 @@ function renderMessage(message) {
|
|||
|
||||
|
||||
} else
|
||||
for (const message of result) {
|
||||
|
||||
const arr = Object.values(message.react || {})
|
||||
|
||||
message.reactCount = arr.filter(Boolean).length - arr.filter(x => !x).length;
|
||||
|
||||
for (const message of result)
|
||||
renderMessage(message);
|
||||
}
|
||||
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
|
||||
})();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const { UserModel, SecretModel } = require("../models");
|
||||
const { Router } = require("express")
|
||||
const bcrypt = require("bcrypt");
|
||||
const rateLimit = require('express-rate-limit')
|
||||
|
||||
const app = Router();
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
const { Router } = require("express");
|
||||
const app = Router();
|
||||
const rateLimit = require('express-rate-limit')
|
||||
|
||||
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 message = await MessageModel.get(id)
|
||||
const arr = Object.values(message.react)
|
||||
message.reactCount = arr.filter(Boolean).length - arr.filter(x => !x).length;
|
||||
|
||||
return user?.admin || !message?.deleted ? message : null;
|
||||
return user?.admin || !message?.deleted ? message.toObject({ virtuals: true }) : null;
|
||||
}));
|
||||
|
||||
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.
|
||||
|
||||
### Example request:
|
||||
```GET /api/message/1```
|
||||
```GET /api/messages/1```
|
||||
|
||||
#### Example API Output:
|
||||
```json
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<%- include("extra/navbar") %>
|
||||
|
||||
<% if (user) { %>
|
||||
<% if (user) { %>
|
||||
<h1>Welcome, <a href=<%=user.getLink() %>> <%= user.name %></a>
|
||||
<img class="circle" src=<%=user.avatar %> alt=<%= user.name %>>
|
||||
<br>
|
||||
|
|
Loading…
Reference in a new issue