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
<img src="https://raw.githubusercontent.com/Akif9748/akf-forum/main/public/images/logo.jpg" align="right" width="300px" />
A Node.js based forum software.
## Installation
@ -10,7 +8,7 @@ A Node.js based forum software.
### Extra
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
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 |
| ----- | -------- | -------- |
| Page support for search | 🟡 | LOW |
| Footer | 🟢 | LOW |
| Local pfp store | 🔴 | MEDIUM |
| IPs of users will add SecretModel | 🔴 | MEDIUM |
| Category | ⚪ | MEDIUM |
| Profile Message | 🔴 | LOW |
| Last seen, last seen info | 🔴 | LOW |
| 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
- V4: Caching
- V3: New Theme

View file

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

View file

@ -1,6 +1,6 @@
const { UserModel, BanModel } = require("./models"),
const { def_theme, forum_name, desp } = require("./config.json"),
{ UserModel, BanModel } = require("./models"),
rateLimit = require('express-rate-limit'),
{ def_theme } = require("./config.json"),
ipBlock = require('express-ip-block'),
session = require('express-session'),
bodyParser = require('body-parser'),
@ -38,7 +38,7 @@ app.use(
req.headers["x-forwarded-for"];
req.user = await UserModel.get(req.session.userID);
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);
@ -48,7 +48,7 @@ app.use(
}
next();
}, 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()
}), 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.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 {
margin: 0;
font-family: Poppins;
}
a {
@ -116,13 +117,6 @@ a {
background-color: var(--main);
}
body {
font-family: Poppins;
}
.menu-item:hover {
background-color: var(--main);
}
@ -187,3 +181,32 @@ div.avatar {
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">
<select>
<option value="default">Default theme</option>
<option value="black">Black theme</option>
</select>
<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>
<span style="color:white">Coders</span> <br>
<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>

View file

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

View file

@ -7,7 +7,7 @@
<% } %>
<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">
<% if (user){ %>

View file

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