diff --git a/README.md b/README.md index ab76a01..daedbad 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/config.json b/config.json index 426dadc..81270bb 100644 --- a/config.json +++ b/config.json @@ -1,3 +1,5 @@ { - "def_theme": "default" + "def_theme": "default", + "forum_name": "akf", + "desp": "Akf-forum!" } \ No newline at end of file diff --git a/index.js b/index.js index 97103a5..9541f3b 100644 --- a/index.js +++ b/index.js @@ -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'), - { def_theme } = require("./config.json"), ipBlock = require('express-ip-block'), session = require('express-session'), bodyParser = require('body-parser'), port = process.env.PORT || 3000, mongoose = require("mongoose"), express = require('express'), - // multer = require("multer"), + // multer = require("multer"), fs = require("fs"), app = express(); @@ -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)); \ No newline at end of file +app.listen(port, () => console.log(forum_name + "-forum on port:", port)); \ No newline at end of file diff --git a/public/css/common.css b/public/css/common.css index 04ba627..20ed132 100644 --- a/public/css/common.css +++ b/public/css/common.css @@ -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); } @@ -186,4 +180,33 @@ div.avatar { width: 100%; 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; } \ No newline at end of file diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..e51fec2 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/images/favicon.jpg b/public/images/favicon.jpg deleted file mode 100644 index 056cf0b..0000000 Binary files a/public/images/favicon.jpg and /dev/null differ diff --git a/public/images/favicon.png b/public/images/favicon.png deleted file mode 100644 index 056cf0b..0000000 Binary files a/public/images/favicon.png and /dev/null differ diff --git a/public/images/logo.jpg b/public/images/logo.jpg deleted file mode 100644 index 50ccc03..0000000 Binary files a/public/images/logo.jpg and /dev/null differ diff --git a/views/extra/footer.ejs b/views/extra/footer.ejs index 869649a..bdef9bf 100644 --- a/views/extra/footer.ejs +++ b/views/extra/footer.ejs @@ -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> \ No newline at end of file diff --git a/views/extra/meta.ejs b/views/extra/meta.ejs index 14d9a85..1f36ca8 100644 --- a/views/extra/meta.ejs +++ b/views/extra/meta.ejs @@ -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" /> <% } %> diff --git a/views/extra/navbar.ejs b/views/extra/navbar.ejs index 43e7c7c..b40e075 100644 --- a/views/extra/navbar.ejs +++ b/views/extra/navbar.ejs @@ -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){ %> diff --git a/views/index.ejs b/views/index.ejs index a05e114..de069fc 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -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>