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> </details>
## TO-DO list ## TO-DO list
| To do | Is done? | Priority | | To do | Is done? |
| ----- | -------- | -------- | | ----- | -------- |
| Profile Message | ⚪ | LOW | | Profile Message | ⚪ |
| Better Auth | ⚪ | MEDIUM | | Better Auth | ⚪ |
| mod role, permissions | ⚪ | MEDIUM | | mod role, permissions | ⚪ |
| upload other photos, model for it | ⚪ | MEDIUM | | upload other photos, model for it | ⚪ |
| categories page is need a update | ⚪ | LOW | | categories page is need a update | ⚪ |
- preview for send messages in markdown format. | preview for send messages in markdown format | ⚪ |
- admin list in admin panel.
## Major Version History ## Major Version History
- V4: Caching - V4: Caching

14
package-lock.json generated
View file

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

View file

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

View file

@ -1,9 +1,9 @@
const { Router } = require("express") const { Router } = require("express")
const { BanModel } = require("../models"); const { BanModel,UserModel } = require("../models");
const app = Router(); const app = Router();
app.get("/", async (req, res) => { app.get("/", async (req, res) => {
if (!req.user?.admin) return res.error(403, "You have not got permissions for view to this page."); 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; module.exports = app;

View file

@ -50,6 +50,14 @@
<% } %> <% } %>
</table> </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"> <script type="module">
import request from "../../js/request.js"; import request from "../../js/request.js";