Added admins to admin page

This commit is contained in:
Akif9748 2022-09-17 16:56:19 +03:00
parent abf5c14475
commit d46e2362a4
5 changed files with 26 additions and 19 deletions

View file

@ -32,15 +32,14 @@ Akf-forum has got an API for AJAX (fetch), other clients etc. And, you can learn
</details>
## TO-DO list
| To do | Is done? | Priority |
| ----- | -------- | -------- |
| Profile Message | ⚪ | LOW |
| Better Auth | ⚪ | MEDIUM |
| mod role, permissions | ⚪ | MEDIUM |
| upload other photos, model for it | ⚪ | MEDIUM |
| categories page is need a update | ⚪ | LOW |
- preview for send messages in markdown format.
- admin list in admin panel.
| To do | Is done? |
| ----- | -------- |
| Profile Message | ⚪ |
| Better Auth | ⚪ |
| mod role, permissions | ⚪ |
| upload other photos, model for it | ⚪ |
| categories page is need a update | ⚪ |
| preview for send messages in markdown format | ⚪ |
## Major Version History
- V4: Caching

14
package-lock.json generated
View file

@ -16,7 +16,7 @@
"express": "^4.18.1",
"express-rate-limit": "^6.6.0",
"express-session": "^1.17.2",
"mongoose": "^6.6.0",
"mongoose": "^6.6.1",
"multer": "^1.4.5-lts.1",
"request-ip": "^3.3.0"
},
@ -1090,9 +1090,9 @@
}
},
"node_modules/mongoose": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.6.0.tgz",
"integrity": "sha512-5sS0D7qbmfT4G/nODkJhx5l2qvhqLMplhMlp08Wea8eoi6O/B6b+o1ukUEKjjm1MV8dAS3w8kx47R/klYKLPpQ==",
"version": "6.6.1",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.6.1.tgz",
"integrity": "sha512-hPDamnn6quL9TjIrOudqUS5sMilENmP/gfxoCIb+rDmlzawtM7+MVCAWrM9930fzD20N7qAema/zE9QIDuifhQ==",
"dependencies": {
"bson": "^4.6.5",
"kareem": "2.4.1",
@ -2584,9 +2584,9 @@
}
},
"mongoose": {
"version": "6.6.0",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.6.0.tgz",
"integrity": "sha512-5sS0D7qbmfT4G/nODkJhx5l2qvhqLMplhMlp08Wea8eoi6O/B6b+o1ukUEKjjm1MV8dAS3w8kx47R/klYKLPpQ==",
"version": "6.6.1",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-6.6.1.tgz",
"integrity": "sha512-hPDamnn6quL9TjIrOudqUS5sMilENmP/gfxoCIb+rDmlzawtM7+MVCAWrM9930fzD20N7qAema/zE9QIDuifhQ==",
"requires": {
"bson": "^4.6.5",
"kareem": "2.4.1",

View file

@ -32,7 +32,7 @@
"express": "^4.18.1",
"express-rate-limit": "^6.6.0",
"express-session": "^1.17.2",
"mongoose": "^6.6.0",
"mongoose": "^6.6.1",
"multer": "^1.4.5-lts.1",
"request-ip": "^3.3.0"
}

View file

@ -1,9 +1,9 @@
const { Router } = require("express")
const { BanModel } = require("../models");
const { BanModel,UserModel } = require("../models");
const app = Router();
app.get("/", async (req, res) => {
if (!req.user?.admin) return res.error(403, "You have not got permissions for view to this page.");
res.reply("admin",{bans: await BanModel.find({})});
res.reply("admin",{bans: await BanModel.find({}), admins: await UserModel.find({admin: true})});
});
module.exports = app;

View file

@ -50,6 +50,14 @@
<% } %>
</table>
<div>
<h2 style="color: var(--second);">Admins:</h2>
<ul>
<% for (const admin of admins) { %>
<li> <a style="color: var(--anti);" href="<%= admin.getLink() %>"><%= admin.name %></a> </li>
<% } %>
</ul>
</div>
<script type="module">
import request from "../../js/request.js";