Added custom forum name and meta desp

This commit is contained in:
Akif9748 2022-09-09 15:34:12 +03:00
parent b9ce9c149b
commit 0c74cac622
12 changed files with 49 additions and 54 deletions

View file

@ -1,6 +1,4 @@
# akf-forum # akf-forum
<img src="https://raw.githubusercontent.com/Akif9748/akf-forum/main/public/images/logo.jpg" align="right" width="300px" />
A Node.js based forum software. A Node.js based forum software.
## Installation ## Installation
@ -10,7 +8,7 @@ A Node.js based forum software.
### Extra ### Extra
Run `node util/reset` to **reset the database**, and run `node util/admin` for give admin perms to first member. Run `node util/reset` to **reset the database**, and run `node util/admin` for give admin perms to first member.
Edit `config.json` for default themes of users... Edit `config.json` for default themes of users, and forum name...
## API ## API
Akf-forum has got an API for AJAX (fetch), other clients etc. And, you can learn about API in `APIDOCS.md`. Akf-forum has got an API for AJAX (fetch), other clients etc. And, you can learn about API in `APIDOCS.md`.
@ -35,14 +33,14 @@ Akf-forum has got an API for AJAX (fetch), other clients etc. And, you can learn
| To do | Is done? | Priority | | To do | Is done? | Priority |
| ----- | -------- | -------- | | ----- | -------- | -------- |
| Page support for search | 🟡 | LOW | | Page support for search | 🟡 | LOW |
| Footer | 🟢 | LOW |
| Local pfp store | 🔴 | MEDIUM | | Local pfp store | 🔴 | MEDIUM |
| IPs of users will add SecretModel | 🔴 | MEDIUM | | IPs of users will add SecretModel | 🔴 | MEDIUM |
| Category | ⚪ | MEDIUM | | Category | ⚪ | MEDIUM |
| Profile Message | 🔴 | LOW | | Profile Message | 🔴 | LOW |
| Last seen, last seen info | 🔴 | LOW | | Last seen, last seen info | 🔴 | LOW |
| Better Auth | 🔴 | MEDIUM | | Better Auth | 🔴 | MEDIUM |
- Add theme selection to footer, and, and, and fix footer, add navbar css to footer and import common css in meta - Fix footer, theme
## Major Version History ## Major Version History
- V4: Caching - V4: Caching
- V3: New Theme - V3: New Theme

View file

@ -1,3 +1,5 @@
{ {
"def_theme": "default" "def_theme": "default",
"forum_name": "akf",
"desp": "Akf-forum!"
} }

View file

@ -1,13 +1,13 @@
const { UserModel, BanModel } = require("./models"), const { def_theme, forum_name, desp } = require("./config.json"),
{ UserModel, BanModel } = require("./models"),
rateLimit = require('express-rate-limit'), rateLimit = require('express-rate-limit'),
{ def_theme } = require("./config.json"),
ipBlock = require('express-ip-block'), ipBlock = require('express-ip-block'),
session = require('express-session'), session = require('express-session'),
bodyParser = require('body-parser'), bodyParser = require('body-parser'),
port = process.env.PORT || 3000, port = process.env.PORT || 3000,
mongoose = require("mongoose"), mongoose = require("mongoose"),
express = require('express'), express = require('express'),
// multer = require("multer"), // multer = require("multer"),
fs = require("fs"), fs = require("fs"),
app = express(); app = express();
@ -38,7 +38,7 @@ app.use(
req.headers["x-forwarded-for"]; req.headers["x-forwarded-for"];
req.user = await UserModel.get(req.session.userID); req.user = await UserModel.get(req.session.userID);
res.reply = (page, options = {}, status = 200) => res.status(status) res.reply = (page, options = {}, status = 200) => res.status(status)
.render(page, { user: req.user, theme: req.user?.theme || def_theme, ...options }); .render(page, { user: req.user, theme: req.user?.theme || def_theme, forum_name, desp, ...options });
res.error = (type, error) => res.reply("error", { type, error }, type); res.error = (type, error) => res.reply("error", { type, error }, type);
@ -48,7 +48,7 @@ app.use(
} }
next(); next();
}, rateLimit({ }, rateLimit({
windowMs: 60_000, max: 10, windowMs: 60_000, max: 20,
handler: (req, res, next, opts) => !req.user?.admin ? res.error(opts.statusCode, "You are begin ratelimited") : next() handler: (req, res, next, opts) => !req.user?.admin ? res.error(opts.statusCode, "You are begin ratelimited") : next()
}), bodyParser.urlencoded({ extended: true }) }), bodyParser.urlencoded({ extended: true })
); );
@ -58,4 +58,4 @@ for (const file of fs.readdirSync("./routes"))
app.all("*", (req, res) => res.error(404, "We have not got this page.")); app.all("*", (req, res) => res.error(404, "We have not got this page."));
app.listen(port, () => console.log("akf-forum on port:", port)); app.listen(port, () => console.log(forum_name + "-forum on port:", port));

View file

@ -6,6 +6,7 @@
body { body {
margin: 0; margin: 0;
font-family: Poppins;
} }
a { a {
@ -116,13 +117,6 @@ a {
background-color: var(--main); background-color: var(--main);
} }
body {
font-family: Poppins;
}
.menu-item:hover { .menu-item:hover {
background-color: var(--main); background-color: var(--main);
} }
@ -187,3 +181,32 @@ div.avatar {
text-align: center; text-align: center;
} }
} }
/*
FOOTER
*/
select {
background: #ebebeb;
border: white;
padding: 8px 20px;
font-size: 16px;
font-family: inherit;
}
select option {
font-family: inherit;
width: 290px;
}
.footer {
width: 100%;
margin-top: 10px;
background-color: var(--main);
padding: 10px;
color: white;
display: flex;
justify-content: space-between;
align-items: center;
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View file

@ -1,41 +1,15 @@
<style>
select {
background: #ebebeb;
border: white;
padding: 8px 20px;
font-size: 16px;
font-family: inherit;
}
select option {
font-family: inherit;
width: 290px;
}
.footer {
width: 100%;
margin-top: 10px;
background-color: var(--main);
padding: 10px;
color: white;
display: flex;
justify-content: space-between;
align-items: center;
}
</style>
<div class="footer"> <div class="footer">
<select> <select>
<option value="default">Default theme</option> <option value="default">Default theme</option>
<option value="black">Black theme</option> <option value="black">Black theme</option>
</select> </select>
<a href="https://github.com/Akif9748/akf-forum" style="color: white;"> This website is powered by <a href="https://github.com/Akif9748/akf-forum" style="color: white;"> This website is powered by
<span style="color: #ffbf00;">AKF-Forum </span> </a> <span style="color: #ffbf00;">akf-forum </span> </a>
<div> <div>
<span style="color:white">Coders</span> <br> <span style="color:white">Coders</span> <br>
<div style="text-align:center;"> <div style="text-align:center;">
By <a href="https://github.com/Akif9748/" style="color: #ffbf00;">Akf</a> <br> By <a href="#" style="color:#ffbf00;">Tokmak</a> By <a href="https://github.com/Akif9748/" style="color: #ffbf00;">Akif</a> <br> By <a href="#" style="color:#ffbf00;">Tokmak</a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,13 +1,11 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%= title || "Akf-forum" %> </title> <title><%= title || forum_name +"-forum" %></title>
<meta name="description" content="Akf-forum!"> <meta name="description" content="<%= desp %>">
<meta name="author" content="Akif9748"> <link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
<link rel="stylesheet" href="/css/themes/<%= theme %>.css" /> <link rel="stylesheet" href="/css/themes/<%= theme %>.css" />
<link rel="stylesheet" href="/css/common.css" /> <link rel="stylesheet" href="/css/common.css" />
<% if (theme === "black") { %> <% if (theme === "black") { %>
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000" />
<% } %> <% } %>

View file

@ -7,7 +7,7 @@
<% } %> <% } %>
<div class="header"> <div class="header">
<a class="logo" href="/">AKF <span>FORUM</span></a> <a class="logo" href="/"><%= forum_name.toUpperCase() %> <span>FORUM</span></a>
<div class="buttons"> <div class="buttons">
<% if (user){ %> <% if (user){ %>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<%- include("extra/meta", {title: "Welcome to the Akf-forum!" }) %> <%- include("extra/meta", {title: "Welcome to the "+forum_name+"-forum!" }) %>
<body> <body>