Fixing git

This commit is contained in:
Akif9748 2022-03-13 16:16:46 +03:00
parent 70ce79580b
commit a0848f1225
35 changed files with 1800 additions and 1800 deletions

1348
LICENSE

File diff suppressed because it is too large Load diff

View file

@ -1,46 +1,46 @@
# akf-forum # akf-forum
<img src="https://raw.githubusercontent.com/Akif9748/akf-forum/main/public/images/logo.jpg" align="right" width="300px" /> <img src="https://raw.githubusercontent.com/Akif9748/akf-forum/main/public/images/logo.jpg" align="right" width="300px" />
A forum script written in Node.js. A forum script written in Node.js.
## Installation ## Installation
- Clone this repo. Or download it. - Clone this repo. Or download it.
- Write `npm i` to install **dependencies**. - Write `npm i` to install **dependencies**.
- Write `npm restart` for reset database, and `npm start` for run it. - Write `npm restart` for reset database, and `npm start` for run it.
## Credits ## Credits
* [Akif9748](https://github.com/Akif9748) - Project owner * [Akif9748](https://github.com/Akif9748) - Project owner
* [Camroku](https://github.com/Camroku) - Made stylesheets * [Camroku](https://github.com/Camroku) - Made stylesheets
## To Do: ## To Do:
- Admin panel, delete, edit messages. - Admin panel, delete, edit messages.
## Roadmap ## Roadmap
- [x] User - [x] User
- [x] Login - [x] Login
- [x] Register - [x] Register
- [x] Logout - [x] Logout
- [x] Admin - [x] Admin
- [x] Message count - [x] Message count
- [ ] Messages - [ ] Messages
- [x] Send message - [x] Send message
- [x] Delete message - [x] Delete message
- [ ] Edit message - [ ] Edit message
- [x] React message - [x] React message
- [ ] Forums - [ ] Forums
- [ ] Category system - [ ] Category system
- [ ] Create category - [ ] Create category
- [ ] Delete category - [ ] Delete category
- [ ] Edit category - [ ] Edit category
- [ ] Move category - [ ] Move category
- [ ] Other - [ ] Other
- [ ] API - [ ] API
- [ ] Other client for forum via API - [ ] Other client for forum via API
- [ ] Footer... - [ ] Footer...
- [ ] Search - [ ] Search
- [x] New Thread theme, better render for messages - [x] New Thread theme, better render for messages
## Image: ## Image:
![image](https://user-images.githubusercontent.com/70021050/158060900-7384d394-cad7-4f73-94ad-7c8bd108ac44.png) ![image](https://user-images.githubusercontent.com/70021050/158060900-7384d394-cad7-4f73-94ad-7c8bd108ac44.png)

View file

@ -1,6 +1,6 @@
const Message = require("./message") const Message = require("./message")
const Thread = require("./thread") const Thread = require("./thread")
const User = require("./user") const User = require("./user")
const React = require("./react") const React = require("./react")
module.exports = { Message, Thread, User, React } module.exports = { Message, Thread, User, React }

View file

@ -1,45 +1,45 @@
const User = require("./user") const User = require("./user")
const Thread = require("./thread") const Thread = require("./thread")
const db = require("quick.db"); const db = require("quick.db");
module.exports = class Message { module.exports = class Message {
constructor(content, author = new User(), thread = new Thread(), time = new Date().getTime(), deleted = false, edited = false, react = {}) { constructor(content, author = new User(), thread = new Thread(), time = new Date().getTime(), deleted = false, edited = false, react = {}) {
this.content = content; this.content = content;
this.author = author; this.author = author;
this.time = time; this.time = time;
this.thread = thread; this.thread = thread;
this.deleted = deleted; this.deleted = deleted;
this.edited = edited; this.edited = edited;
this.react = react; this.react = react;
} }
getId(id = this.id) { getId(id = this.id) {
const message = db.get("messages" ).find(msg => msg.id == id); const message = db.get("messages" ).find(msg => msg.id == id);
if (!message) return null; if (!message) return null;
this.id = id; this.id = id;
const { content, author, thread = new Thread(), time = new Date().getTime(), deleted = false, edited = false, react = {} } = message; const { content, author, thread = new Thread(), time = new Date().getTime(), deleted = false, edited = false, react = {} } = message;
this.content = content; this.content = content;
this.thread = thread; this.thread = thread;
this.author = author; this.author = author;
this.time = time; this.time = time;
this.deleted = deleted; this.deleted = deleted;
this.edited = edited; this.edited = edited;
this.react = react; this.react = react;
return this return this
} }
takeId() { takeId() {
this.id = db.get("messages").length || 0; this.id = db.get("messages").length || 0;
return this; return this;
} }
write(id = this.id) { write(id = this.id) {
db.set("messages." + id, this) db.set("messages." + id, this)
return this; return this;
} }
getLink(id = this.id) { getLink(id = this.id) {
return "/messages/" + id; return "/messages/" + id;
} }
} }

14
classes/react.js vendored
View file

@ -1,8 +1,8 @@
const User = require("./user") const User = require("./user")
module.exports = class Message { module.exports = class Message {
constructor(like = true, author = new User()) { constructor(like = true, author = new User()) {
this.like = like; this.like = like;
this.author= author; this.author= author;
} }
} }

View file

@ -1,53 +1,53 @@
const db = require("quick.db") const db = require("quick.db")
const User = require("./user") const User = require("./user")
module.exports = class Thread { module.exports = class Thread {
constructor(title, author = new User(), messages = [], time = new Date().getTime(),deleted = false) { constructor(title, author = new User(), messages = [], time = new Date().getTime(),deleted = false) {
this.author = author; this.author = author;
this.title = title; this.title = title;
this.messages = messages; this.messages = messages;
this.time = time; this.time = time;
this.deleted = deleted; this.deleted = deleted;
} }
getId(id = this.id) { getId(id = this.id) {
const thread = db.get("threads."+id); const thread = db.get("threads."+id);
if (!thread) return null; if (!thread) return null;
this.id = id; this.id = id;
const { title, author, messages = [], time = new Date().getTime(), deleted = false } = thread; const { title, author, messages = [], time = new Date().getTime(), deleted = false } = thread;
this.title = title this.title = title
this.author = author this.author = author
this.messages = messages; this.messages = messages;
this.time = time; this.time = time;
this.deleted = deleted; this.deleted = deleted;
return this return this
} }
takeId(){ takeId(){
this.id = db.get("threads").length; this.id = db.get("threads").length;
return this return this
} }
push(message){ push(message){
this.messages.push(message) this.messages.push(message)
return this; return this;
} }
write(id = this.id) { write(id = this.id) {
db.set("threads."+id, this) db.set("threads."+id, this)
return this; return this;
} }
getLink(id = this.id) { getLink(id = this.id) {
return "/threads/" + id; return "/threads/" + id;
} }
} }

View file

@ -1,41 +1,41 @@
const db = require("quick.db") const db = require("quick.db")
module.exports = class User { module.exports = class User {
constructor(name = "guest", avatar = "/images/guest.png", time = new Date().getTime(), admin= false) { constructor(name = "guest", avatar = "/images/guest.png", time = new Date().getTime(), admin= false) {
this.name = name; this.name = name;
this.avatar = avatar; this.avatar = avatar;
this.time = time; this.time = time;
this.admin = admin; this.admin = admin;
} }
getId(id = this.id) { getId(id = this.id) {
const user = db.get("users." + id); const user = db.get("users." + id);
if (!user) return null; if (!user) return null;
this.id = Number(id); this.id = Number(id);
const { name = "guest", avatar = "/images/guest.png", time = new Date().getTime(), admin = false } = user; const { name = "guest", avatar = "/images/guest.png", time = new Date().getTime(), admin = false } = user;
this.name = name; this.name = name;
this.avatar = avatar; this.avatar = avatar;
this.time = time; this.time = time;
this.admin = admin; this.admin = admin;
return this return this
} }
takeId() { takeId() {
let id = db.get("users"); let id = db.get("users");
this.id = id ? id.length : 0; this.id = id ? id.length : 0;
return this return this
} }
write(id = this.id) { write(id = this.id) {
db.set("users." + id, this) db.set("users." + id, this)
} }
getLink(id = this.id) { getLink(id = this.id) {
return "/users/" + id; return "/users/" + id;
} }
} }

View file

@ -1,2 +1,2 @@
module.exports = (res, type, error) => module.exports = (res, type, error) =>
res.status(type).render("error", { type, error }); res.status(type).render("error", { type, error });

View file

@ -1,30 +1,30 @@
const express = require('express'); const express = require('express');
const bodyParser = require('body-parser'); const bodyParser = require('body-parser');
const path = require("path"); const path = require("path");
const fs = require("fs"); const fs = require("fs");
const session = require('express-session'); const session = require('express-session');
const error = require("./errors/error.js") const error = require("./errors/error.js")
const app = express(); const app = express();
app.use(session({ secret: 'secret', resave: true, saveUninitialized: true })); app.use(session({ secret: 'secret', resave: true, saveUninitialized: true }));
app.use(express.static(path.join(__dirname, "public"))); app.use(express.static(path.join(__dirname, "public")));
app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.json()); app.use(express.json());
app.set('views', path.join(__dirname, 'views')); app.set('views', path.join(__dirname, 'views'));
app.set("view engine", "ejs"); app.set("view engine", "ejs");
//Temp: //Temp:
app.get("/", (req, res) => res.redirect("/index")); app.get("/", (req, res) => res.redirect("/index"));
for (const type of fs.readdirSync("./routes")) for (const type of fs.readdirSync("./routes"))
for (const file of fs.readdirSync("./routes/" + type)) for (const file of fs.readdirSync("./routes/" + type))
app[type](`/${file.replace(".js", "")}*`, require(`./routes/${type}/${file}`)) app[type](`/${file.replace(".js", "")}*`, require(`./routes/${type}/${file}`))
app.get('*', (req, res) => error(res, 404, "We have not got this page.")); app.get('*', (req, res) => error(res, 404, "We have not got this page."));
app.post('*', (req, res) => error(res, 404, "We have not got this page.")); app.post('*', (req, res) => error(res, 404, "We have not got this page."));
const port = process.env.PORT || 3000; const port = process.env.PORT || 3000;
app.listen(port, () => console.log("SERVER ON PORT:", port)); app.listen(port, () => console.log("SERVER ON PORT:", port));

Binary file not shown.

View file

@ -1,141 +1,141 @@
:root { /* Apprentice Scheme */ :root { /* Apprentice Scheme */
/* /*
* use `var(--col-x)` instead of directly typing the color. * use `var(--col-x)` instead of directly typing the color.
*/ */
--col-0: #1C1C1C; --col-0: #1C1C1C;
--col-1: #AF5F5F; --col-1: #AF5F5F;
--col-2: #5F875F; --col-2: #5F875F;
--col-3: #87875F; --col-3: #87875F;
--col-4: #5F87AF; --col-4: #5F87AF;
--col-5: #5F5F87; --col-5: #5F5F87;
--col-6: #5F8787; --col-6: #5F8787;
--col-7: #6C6C6C; --col-7: #6C6C6C;
--col-8: #444444; --col-8: #444444;
--col-9: #FF8700; --col-9: #FF8700;
--col-10: #87AF87; --col-10: #87AF87;
--col-11: #FFFFAF; --col-11: #FFFFAF;
--col-12: #8FAFD7; --col-12: #8FAFD7;
--col-13: #8787AF; --col-13: #8787AF;
--col-14: #5FAFAF; --col-14: #5FAFAF;
--col-15: #FFFFFF; --col-15: #FFFFFF;
--col-fg: #BCBCBC; --col-fg: #BCBCBC;
--col-bg: #262626; --col-bg: #262626;
} }
img.yuvarlak { img.yuvarlak {
border-radius: 50%; border-radius: 50%;
height: 30px; height: 30px;
width: 30px; width: 30px;
object-fit: cover; object-fit: cover;
} }
img.logo { img.logo {
width: 266px; width: 266px;
height: 75px; height: 75px;
display: inline; display: inline;
} }
textarea { textarea {
font-family: monospace; font-family: monospace;
background-color: var(--col-bg); background-color: var(--col-bg);
border: 2px solid var(--col-8); border: 2px solid var(--col-8);
color: var(--col-fg); color: var(--col-fg);
width: auto; width: auto;
height: auto; height: auto;
cursor: pointer; cursor: pointer;
} }
p { p {
font-size: 25px; font-size: 25px;
} }
hr { hr {
border-color: var(--col-8); border-color: var(--col-8);
border: 0; border: 0;
border-top: 1px solid var(--col-fg); border-top: 1px solid var(--col-fg);
margin: 20px 0; margin: 20px 0;
} }
body, body,
h1, h1,
h2, h2,
h3, h3,
h4, h4,
h5, h5,
h6 { h6 {
font-family: monospace; font-family: monospace;
background: var(--col-bg); background: var(--col-bg);
color: var(--col-fg); color: var(--col-fg);
max-width: 69rem; max-width: 69rem;
margin: auto; margin: auto;
margin-top: 10px; margin-top: 10px;
/* funny number */ /* funny number */
} }
a:link { a:link {
color: var(--col-4); color: var(--col-4);
} }
a:hover { a:hover {
color: var(--col-1); color: var(--col-1);
} }
a:visited { a:visited {
color: var(--col-13); color: var(--col-13);
} }
a:active { a:active {
color: var(--col-1); color: var(--col-1);
} }
pre { pre {
background-color: var(--col-0); background-color: var(--col-0);
padding: 1em; padding: 1em;
border: 0; border: 0;
} }
h1, h1,
h2, h2,
h3, h3,
h4, h4,
h5 { h5 {
margin-bottom: 0.1rem; margin-bottom: 0.1rem;
} }
hr { hr {
border-color: var(--col-8); border-color: var(--col-8);
} }
button, input { button, input {
font-family: monospace; font-family: monospace;
background-color: var(--col-bg); background-color: var(--col-bg);
border: 2px solid var(--col-8); border: 2px solid var(--col-8);
color: var(--col-fg); color: var(--col-fg);
width: auto; width: auto;
height: 30px; height: 30px;
} }
button.buyuk { button.buyuk {
width: 150px; width: 150px;
height: 50px; height: 50px;
} }
input { input {
width: 75%; width: 75%;
cursor: pointer; cursor: pointer;
color: var(--col-fg); color: var(--col-fg);
} }
button:hover { button:hover {
background-color: var(--col-fg); background-color: var(--col-fg);
color: var(--col-bg); color: var(--col-bg);
} }
.mainpage { .mainpage {
padding: 10px; padding: 10px;
float: right; float: right;
} }

View file

@ -1,6 +1,6 @@
const { set } = require("quick.db"); const { set } = require("quick.db");
set("users", new Array()); set("users", new Array());
set("threads", new Array()); set("threads", new Array());
set("secret", new Object()); set("secret", new Object());
set("messages", new Array()); set("messages", new Array());

View file

@ -1,12 +1,12 @@
const { User } = require("../../classes/index"); const { User } = require("../../classes/index");
const { get } = require("quick.db"); const { get } = require("quick.db");
const error = require("../../errors/error.js"); const error = require("../../errors/error.js");
module.exports = (req, res) => { module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login'); if (!req.session.loggedin) return res.redirect('/login');
const user = new User().getId(req.session.userid) const user = new User().getId(req.session.userid)
if (!user.admin) return error(res, 404, "You have not got permissions for view to this page."); if (!user.admin) return error(res, 404, "You have not got permissions for view to this page.");
res.render("admin", { user }) res.render("admin", { user })
} }

View file

@ -1,10 +1,10 @@
const { User } = require("../../classes/index"); const { User } = require("../../classes/index");
module.exports = (req, res) => { module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login'); if (!req.session.loggedin) return res.redirect('/login');
const user = new User().getId(req.session.userid) const user = new User().getId(req.session.userid)
res.render("openThread", { user }) res.render("openThread", { user })
} }

View file

@ -1,12 +1,12 @@
const { User } = require("../../classes/index"); const { User } = require("../../classes/index");
const { get } = require("quick.db") const { get } = require("quick.db")
module.exports = (req, res) => { module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login'); if (!req.session.loggedin) return res.redirect('/login');
const mem = process.memoryUsage().heapUsed / Math.pow(2, 20); const mem = process.memoryUsage().heapUsed / Math.pow(2, 20);
const users = get("users").length; const users = get("users").length;
const threads = get("threads").length; const threads = get("threads").length;
const messages = get("messages").length; const messages = get("messages").length;
const user = new User().getId(req.session.userid) const user = new User().getId(req.session.userid)
res.render("index", { mem, user, users, threads, messages }) res.render("index", { mem, user, users, threads, messages })
} }

View file

@ -1,13 +1,13 @@
const { Message } = require("../../classes/index"); const { Message } = require("../../classes/index");
const error = require("../../errors/error.js"); const error = require("../../errors/error.js");
module.exports = (req, res) => { module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login'); if (!req.session.loggedin) return res.redirect('/login');
const id = req.url.slice(9); const id = req.url.slice(9);
const message = new Message().getId(id) const message = new Message().getId(id)
if (!message || message.deleted) return error(res, 404, "We have not got any message declared as this id."); if (!message || message.deleted) return error(res, 404, "We have not got any message declared as this id.");
res.redirect("/threads/" + message.thread.id); res.redirect("/threads/" + message.thread.id);
} }

View file

@ -1,25 +1,25 @@
const { Thread, Message, User } = require("../../classes/index"); const { Thread, Message, User } = require("../../classes/index");
const db = require("quick.db"); const db = require("quick.db");
const error = require("../../errors/error.js"); const error = require("../../errors/error.js");
module.exports = (req, res) => { module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login'); if (!req.session.loggedin) return res.redirect('/login');
const id = req.url.slice(9); const id = req.url.slice(9);
const user = new User().getId(req.session.userid); const user = new User().getId(req.session.userid);
if (!id) { if (!id) {
const threads = db.get("threads").slice(0, 10) const threads = db.get("threads").slice(0, 10)
const links = threads.map(thread => "/threads/" + threads.indexOf(thread)) const links = threads.map(thread => "/threads/" + threads.indexOf(thread))
return res.render("threads", { threads, links, user}) return res.render("threads", { threads, links, user})
} }
const thread = new Thread().getId(id); const thread = new Thread().getId(id);
if (thread) { if (thread) {
const messages = thread.messages.filter(id => !new Message().getId(id).deleted).map(id => new Message().getId(id)); const messages = thread.messages.filter(id => !new Message().getId(id).deleted).map(id => new Message().getId(id));
res.render("thread", { thread, messages, user }) res.render("thread", { thread, messages, user })
} else } else
error(res, 404, "We have not got this thread."); error(res, 404, "We have not got this thread.");
} }

View file

@ -1,33 +1,33 @@
const { User } = require("../../classes/index"); const { User } = require("../../classes/index");
const db = require("quick.db"); const db = require("quick.db");
const error = require("../../errors/error.js") const error = require("../../errors/error.js")
module.exports = (req, res) => { module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login'); if (!req.session.loggedin) return res.redirect('/login');
const user = new User().getId(req.session.userid) const user = new User().getId(req.session.userid)
const id = req.url.slice(7); const id = req.url.slice(7);
if (!id) { if (!id) {
const users = db.get("users").slice(0, 10); const users = db.get("users").slice(0, 10);
const links = users.map(user => "/users/" + user.id) const links = users.map(user => "/users/" + user.id)
return res.render("users", { users, links, user }) return res.render("users", { users, links, user })
} }
const member = new User().getId(id); const member = new User().getId(id);
if (member) { if (member) {
const message = db.get("messages").filter(message => message.author.id === Number(id)).length const message = db.get("messages").filter(message => message.author.id === Number(id)).length
const thread = db.get("threads").filter(thread => thread.author.id === Number(id)).length const thread = db.get("threads").filter(thread => thread.author.id === Number(id)).length
const counts = { message, thread } const counts = { message, thread }
res.render("user", { user, member, counts }) res.render("user", { user, member, counts })
} }
else else
error(res, 404, "We have not got this user."); error(res, 404, "We have not got this user.");
} }

View file

@ -1,22 +1,22 @@
const { User } = require("../../classes/index"); const { User } = require("../../classes/index");
const error = require("../../errors/error.js"); const error = require("../../errors/error.js");
module.exports = (req, res) => { module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login'); if (!req.session.loggedin) return res.redirect('/login');
const user = new User().getId(req.session.userid) const user = new User().getId(req.session.userid)
if (!user.admin) return error(res, 404, "You have not got permissions for view to this page."); if (!user.admin) return error(res, 404, "You have not got permissions for view to this page.");
const user2 = new User().getId(req.body.userid) const user2 = new User().getId(req.body.userid)
if (!user2) return error(res, 404, "We have not got this user in all of forum. Vesselam."); if (!user2) return error(res, 404, "We have not got this user in all of forum. Vesselam.");
else { else {
user2.admin = true; user2.admin = true;
user2.write() user2.write()
} }
res.render("admin", { user }) res.render("admin", { user })
} }

View file

@ -1,14 +1,14 @@
const { User, Thread, Message } = require("../../classes/index"); const { User, Thread, Message } = require("../../classes/index");
module.exports = (req, res) => { module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login'); if (!req.session.loggedin) return res.redirect('/login');
const user = new User().getId(req.session.userid); const user = new User().getId(req.session.userid);
const info = req.body; const info = req.body;
const thread = new Thread(info.title, user).takeId().write(); const thread = new Thread(info.title, user).takeId().write();
thread.push(new Message(info.content, user, thread).takeId().write().id) thread.push(new Message(info.content, user, thread).takeId().write().id)
thread.write(); thread.write();
res.redirect('/threads/' + thread.id); res.redirect('/threads/' + thread.id);
} }

View file

@ -1,30 +1,30 @@
const db = require("quick.db"); const db = require("quick.db");
const error = require("../../errors/error.js") const error = require("../../errors/error.js")
module.exports = (req, res) => { module.exports = (req, res) => {
req.session.loggedin = false; req.session.loggedin = false;
req.session.username = null; req.session.username = null;
req.session.userid = null; req.session.userid = null;
let username = req.body.username; let username = req.body.username;
let password = req.body.password; let password = req.body.password;
if (username && password) { if (username && password) {
const user = db.get("secret." + username) const user = db.get("secret." + username)
if (user) { if (user) {
// Authenticate the user // Authenticate the user
if (user.key !== password) return error(res, 404, 'Incorrect Password!') if (user.key !== password) return error(res, 404, 'Incorrect Password!')
req.session.loggedin = true; req.session.loggedin = true;
req.session.username = username; req.session.username = username;
req.session.userid = user.id; req.session.userid = user.id;
res.redirect('/'); res.redirect('/');
} else } else
error(res, 404, 'Incorrect Username and/or Password!') error(res, 404, 'Incorrect Username and/or Password!')
} else } else
error(res, 404, "You forgot entering some values") error(res, 404, "You forgot entering some values")
} }

View file

@ -1,19 +1,19 @@
const { User, Message } = require("../../classes/index"); const { User, Message } = require("../../classes/index");
const error = require("../../errors/error.js"); const error = require("../../errors/error.js");
module.exports = (req, res) => { module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login'); if (!req.session.loggedin) return res.redirect('/login');
const id = req.url.slice(9 + 6) const id = req.url.slice(9 + 6)
const message = new Message().getId(id) const message = new Message().getId(id)
if (!message || message.deleted) return error(res, 404, "We have not got any message declared as this id."); if (!message || message.deleted) return error(res, 404, "We have not got any message declared as this id.");
const user = new User().getId(req.session.userid); const user = new User().getId(req.session.userid);
if (user.id != message.author.id && !user.admin) if (user.id != message.author.id && !user.admin)
return error(res, 403, "You have not got permission for this."); return error(res, 403, "You have not got permission for this.");
message.deleted = true; message.deleted = true;
message.write(); message.write();
res.redirect("/threads/" + message.thread.id); res.redirect("/threads/" + message.thread.id);
} }

44
routes/post/react.js vendored
View file

@ -1,23 +1,23 @@
const error = require("../../errors/error.js") const error = require("../../errors/error.js")
const { Message, User } = require("../../classes/index"); const { Message, User } = require("../../classes/index");
module.exports = (req, res) => { module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login'); if (!req.session.loggedin) return res.redirect('/login');
const id = req.url.slice(7); const id = req.url.slice(7);
if (!id) error(res, 404, "Id of request is missing"); if (!id) error(res, 404, "Id of request is missing");
const info = req.body; const info = req.body;
const user = new User().getId(req.session.userid); const user = new User().getId(req.session.userid);
const message = new Message().getId(id); const message = new Message().getId(id);
if (message) { if (message) {
if (!(user.id in message.react)) if (!(user.id in message.react))
message.react[user.id] = "like" in info; message.react[user.id] = "like" in info;
else else
delete message.react[user.id]; delete message.react[user.id];
message.write(); message.write();
res.redirect("/threads/" + message.thread.id); res.redirect("/threads/" + message.thread.id);
} else error(res, 404, "We have not got this Message for reacting."); } else error(res, 404, "We have not got this Message for reacting.");
} }

View file

@ -1,33 +1,33 @@
const db = require("quick.db"); const db = require("quick.db");
const error = require("../../errors/error.js") const error = require("../../errors/error.js")
const { User } = require("../../classes/index"); const { User } = require("../../classes/index");
module.exports = (req, res) => { module.exports = (req, res) => {
req.session.loggedin = false; req.session.loggedin = false;
req.session.username = null; req.session.username = null;
req.session.userid = null; req.session.userid = null;
let username = req.body.username; let username = req.body.username;
let password = req.body.password; let password = req.body.password;
if (username && password) { if (username && password) {
const user = db.get("secret." + username) const user = db.get("secret." + username)
if (user) { if (user) {
error(res, 404, `We have got an user named ${username}!`) error(res, 404, `We have got an user named ${username}!`)
} else { } else {
let avatar = req.body.avatar || "/images/guest.png" let avatar = req.body.avatar || "/images/guest.png"
const user2 = new User(req.body.username, avatar).takeId() const user2 = new User(req.body.username, avatar).takeId()
db.set("secret." + username, { id: user2.id, key: password }) db.set("secret." + username, { id: user2.id, key: password })
req.session.loggedin = true; req.session.loggedin = true;
req.session.username = username; req.session.username = username;
req.session.userid = user2.id; req.session.userid = user2.id;
user2.write() user2.write()
res.redirect('/'); res.redirect('/');
} }
} else } else
error(res, 404, "You forgot entering some values") error(res, 404, "You forgot entering some values")
} }

View file

@ -1,20 +1,20 @@
const { Thread, Message, User } = require("../../classes/index"); const { Thread, Message, User } = require("../../classes/index");
const error = require("../../errors/error.js") const error = require("../../errors/error.js")
module.exports = (req, res) => { module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login'); if (!req.session.loggedin) return res.redirect('/login');
const id = req.url.slice(9); const id = req.url.slice(9);
const thread = new Thread().getId(id); const thread = new Thread().getId(id);
if (thread) { if (thread) {
const message = new Message(req.body.content, new User().getId(req.session.userid), thread).takeId().write(); const message = new Message(req.body.content, new User().getId(req.session.userid), thread).takeId().write();
thread.push(message.id) thread.push(message.id)
thread.write(); thread.write();
res.redirect('/threads/' + id); res.redirect('/threads/' + id);
} }
else else
error(res, 404, "We have not got this thread."); error(res, 404, "We have not got this thread.");
} }

View file

@ -1,41 +1,41 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/css/styles.css" /> <link rel="stylesheet" href="/css/styles.css" />
<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>Main page!</title> <title>Main page!</title>
<meta name="description" content="Akf-forum!"> <meta name="description" content="Akf-forum!">
<meta name="author" content="Akif9748"> <meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg"> <link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> </head>
<body> <body>
<!-- Navbar: --> <!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a> <a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<br> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button> <br> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button>
<button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button> <button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button>
<button class="buyuk" onclick="window.location.href = '/users'">USERS</button> <button class="buyuk" onclick="window.location.href = '/users'">USERS</button>
<button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button> <button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button>
<h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a> <h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> <img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1> </h1>
<hr> <hr>
<!-- Navbar end --> <!-- Navbar end -->
<h1>Welcome to the admin panel of the forum, <%= user.name %>!</h1> <h1>Welcome to the admin panel of the forum, <%= user.name %>!</h1>
<form action="/admin/" method="POST"> <form action="/admin/" method="POST">
<h2>Write an ID for make admin:</h2> <h2>Write an ID for make admin:</h2>
<input name="userid"></input> <input name="userid"></input>
<hr> <hr>
<button class = "buyuk" type="submit">Make admin!</button> <button class = "buyuk" type="submit">Make admin!</button>
</form> </form>
</body> </body>
</html> </html>

View file

@ -1,36 +1,36 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/css/styles.css" /> <link rel="stylesheet" href="/css/styles.css" />
<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><%= type %></title> <title><%= type %></title>
<meta name="description" content="Akf-forum has not got this page!"> <meta name="description" content="Akf-forum has not got this page!">
<meta name="author" content="Akif9748"> <meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg"> <link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> </head>
<body > <body >
<!-- Navbar: --> <!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a><br> <a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a><br>
<button class="buyuk" <button class="buyuk"
onclick="window.location.href = '/'">MAIN PAGE</button> onclick="window.location.href = '/'">MAIN PAGE</button>
<hr> <hr>
<!-- Navbar end --> <!-- Navbar end -->
<h1><%= type %></h1> <h1><%= type %></h1>
<h2><%= error %></h2> <h2><%= error %></h2>
</body> </body>
</html> </html>

View file

@ -1,59 +1,59 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/css/styles.css" /> <link rel="stylesheet" href="/css/styles.css" />
<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>Main page!</title> <title>Main page!</title>
<meta name="description" content="Akf-forum!"> <meta name="description" content="Akf-forum!">
<meta name="author" content="Akif9748"> <meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg"> <link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> </head>
<body> <body>
<!-- Navbar: --> <!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a> <a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<br> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button> <br> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button>
<button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button> <button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button>
<button class="buyuk" onclick="window.location.href = '/users'">USERS</button> <button class="buyuk" onclick="window.location.href = '/users'">USERS</button>
<button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button> <button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button>
<h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a> <h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> <img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1> </h1>
<hr> <hr>
<!-- Navbar end --> <!-- Navbar end -->
<h1>Welcome, <a href=<%=user.getLink() %>> <%= user.name %></a> <h1>Welcome, <a href=<%=user.getLink() %>> <%= user.name %></a>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> <img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
<br> <br>
You can press logout here: You can press logout here:
<button onclick="window.location.href = '/login/'">LOGOUT</button> <button onclick="window.location.href = '/login/'">LOGOUT</button>
</h1> </h1>
<br> <br>
<h1>Statistics:</h1> <h1>Statistics:</h1>
<ul> <ul>
<li> <li>
<h3>Message count: <b> <%= messages %> </b></h3> <h3>Message count: <b> <%= messages %> </b></h3>
</li> </li>
<li> <li>
<h3>User count: <b> <%= users %> </b></h3> <h3>User count: <b> <%= users %> </b></h3>
</li> </li>
<li> <li>
<h3>Thread count: <b> <%= threads %></b></h3> <h3>Thread count: <b> <%= threads %></b></h3>
</li> </li>
<li> <li>
<h3>Memory usage: <b> <%= mem.toFixed(2); %> MB </b></h3> <h3>Memory usage: <b> <%= mem.toFixed(2); %> MB </b></h3>
</li> </li>
</ul> </ul>
</body> </body>
</html> </html>

View file

@ -1,35 +1,35 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/css/styles.css" /> <link rel="stylesheet" href="/css/styles.css" />
<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>LOGIN</title> <title>LOGIN</title>
<meta name="description" content="Akf-forum!"> <meta name="description" content="Akf-forum!">
<meta name="author" content="Akif9748"> <meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg"> <link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> </head>
<body> <body>
<!-- Navbar: --> <!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a> <a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<br> <br>
<button class="buyuk" onclick="window.location.href = '/register'">REGISTER PAGE</button> <button class="buyuk" onclick="window.location.href = '/register'">REGISTER PAGE</button>
<hr> <hr>
<h1>Login</h1> <h1>Login</h1>
<hr> <hr>
<form action="/login" method="post"> <form action="/login" method="post">
<input type="text" name="username" placeholder="Username" id="username" required> <input type="text" name="username" placeholder="Username" id="username" required>
<input type="password" name="password" placeholder="Password" id="password" required> <input type="password" name="password" placeholder="Password" id="password" required>
<input type="submit" value="Login"> <input type="submit" value="Login">
</form> </form>
</body> </body>
</html> </html>

View file

@ -1,47 +1,47 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/css/styles.css" /> <link rel="stylesheet" href="/css/styles.css" />
<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>Open Thread</title> <title>Open Thread</title>
<meta name="description" content="Akf-forum!"> <meta name="description" content="Akf-forum!">
<meta name="author" content="Akif9748"> <meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg"> <link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> </head>
<body> <body>
<!-- Navbar: --> <!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a> <a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<br> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button> <br> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button>
<button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button> <button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button>
<button class="buyuk" onclick="window.location.href = '/users'">USERS</button> <button class="buyuk" onclick="window.location.href = '/users'">USERS</button>
<h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a> <h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> <img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1> </h1>
<hr> <hr>
<!-- Navbar end --> <!-- Navbar end -->
<form action="/createThread/" method="POST"> <form action="/createThread/" method="POST">
<h2>Title:</h2> <h2>Title:</h2>
<input name="title"></input> <input name="title"></input>
<hr> <hr>
<h2>Content:</h2> <h2>Content:</h2>
<textarea rows="4" cols="50" name="content"></textarea> <textarea rows="4" cols="50" name="content"></textarea>
<hr> <hr>
<button class = "buyuk" type="submit">Open Thread!</button> <button class = "buyuk" type="submit">Open Thread!</button>
</form> </form>
</body> </body>
</html> </html>

View file

@ -1,43 +1,43 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/css/styles.css" /> <link rel="stylesheet" href="/css/styles.css" />
<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>Register</title> <title>Register</title>
<meta name="description" content="Akf-forum!"> <meta name="description" content="Akf-forum!">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg"> <link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> </head>
<body> <body>
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a> <a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<br> <br>
<button class="buyuk" onclick="window.location.href = '/login'">LOGIN PAGE</button> <button class="buyuk" onclick="window.location.href = '/login'">LOGIN PAGE</button>
<hr> <hr>
<h1>Register</h1> <h1>Register</h1>
<hr> <hr>
<form action="/register" method="post"> <form action="/register" method="post">
<input type="text" name="username" placeholder="Username" id="username" required> <input type="text" name="username" placeholder="Username" id="username" required>
<input type="password" name="password" placeholder="Password" id="password" required> <input type="password" name="password" placeholder="Password" id="password" required>
<input type="text" name="avatar" placeholder="Avatar URL" id="avatar"> <input type="text" name="avatar" placeholder="Avatar URL" id="avatar">
<input type="submit" value="Register"> <input type="submit" value="Register">
</form> </form>
</body> </body>
</html> </html>

View file

@ -1,90 +1,90 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/css/styles.css" /> <link rel="stylesheet" href="/css/styles.css" />
<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>
<%= thread.title %> <%= thread.title %>
</title> </title>
<meta name="description" content="Akf-forum!"> <meta name="description" content="Akf-forum!">
<meta name="author" content="Akif9748"> <meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg"> <link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> </head>
<body> <body>
<!-- Navbar: --> <!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a> <a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<br> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button> <br> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button>
<button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button> <button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button>
<button class="buyuk" onclick="window.location.href = '/users'">USERS</button> <button class="buyuk" onclick="window.location.href = '/users'">USERS</button>
<button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button> <button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button>
<h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a> <h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> <img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1> </h1>
<hr> <hr>
<!-- Navbar end --> <!-- Navbar end -->
<h1 style="font-size: 35px;"> <h1 style="font-size: 35px;">
<%= thread.title %> <%= thread.title %>
</h1> </h1>
<br> <br>
<% messages.forEach(message=>{ %> <% messages.forEach(message=>{ %>
<div id=<%="message-" + message.id %> style="border: 2px solid #444444; padding: 5px;"> <div id=<%="message-" + message.id %> style="border: 2px solid #444444; padding: 5px;">
<h2> <h2>
<img class="yuvarlak" src=<%=message.author.avatar %> alt=<%= message.author.name %>> <img class="yuvarlak" src=<%=message.author.avatar %> alt=<%= message.author.name %>>
<a style=" color: #bcbcbc; " href=<%="/users/" + message.author.id %>> <%= message.author.name %></a>: <a style=" color: #bcbcbc; " href=<%="/users/" + message.author.id %>> <%= message.author.name %></a>:
</h2> </h2>
<h2> <h2>
<%= message.content %> <%= message.content %>
</h2> </h2>
<form style="text-align:right;display:inline;" action="/messageDelete/<%= message.id %>" method="post"> <form style="text-align:right;display:inline;" action="/messageDelete/<%= message.id %>" method="post">
<button style="display:inline;" class="button" type="submit">DELETE</button> <button style="display:inline;" class="button" type="submit">DELETE</button>
</form> </form>
<form style="text-align:right;" action="/react/<%= message.id %>" method="POST"> <form style="text-align:right;" action="/react/<%= message.id %>" method="POST">
<h3 style="display:inline;"> <h3 style="display:inline;">
<%= Object.values(message.react).filter(Boolean).length - Object.values(message.react).filter(x=>!x).length %> <%= Object.values(message.react).filter(Boolean).length - Object.values(message.react).filter(x=>!x).length %>
</h3> </h3>
<button style="display:inline;" class="button" name="like" type="submit">+🔼</button> <button style="display:inline;" class="button" name="like" type="submit">+🔼</button>
<button style="display:inline;" class="button" name="dislike" type="submit">-🔽</button> <button style="display:inline;" class="button" name="dislike" type="submit">-🔽</button>
<h3 style="display:inline;"> <h3 style="display:inline;">
<%=new Date(message.time).toLocaleString() %> <%=new Date(message.time).toLocaleString() %>
</h3> </h3>
</form> </form>
</div> </div>
<br> <br>
<% }); %> <% }); %>
<hr> <hr>
<form action="/threads/<%= thread.id %>" method="POST"> <form action="/threads/<%= thread.id %>" method="POST">
<textarea rows="4" cols="50" name="content"></textarea> <textarea rows="4" cols="50" name="content"></textarea>
<br> <br>
<button class="button" type="submit">Send!</button> <button class="button" type="submit">Send!</button>
</form> </form>
</body> </body>
</html> </html>

View file

@ -1,44 +1,44 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/css/styles.css" /> <link rel="stylesheet" href="/css/styles.css" />
<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>Main page!</title> <title>Main page!</title>
<meta name="description" content="Akf-forum!"> <meta name="description" content="Akf-forum!">
<meta name="author" content="Akif9748"> <meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg"> <link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> </head>
<body> <body>
<!-- Navbar: --> <!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a> <a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<br> <br>
<button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button> <button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button>
<button class="buyuk" onclick="window.location.href = '/users'">USERS</button> <button class="buyuk" onclick="window.location.href = '/users'">USERS</button>
<button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button> <button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button>
<h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a> <h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> <img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1> </h1>
<hr> <hr>
<!-- Navbar end --> <!-- Navbar end -->
<h1>Threads:</h1> <h1>Threads:</h1>
<ul> <ul>
<% threads.forEach(thread=>{ %> <% threads.forEach(thread=>{ %>
<li> <li>
<h1><a href=<%=links[threads.indexOf(thread)] %> > <%= thread.title %> by <%= thread.author.name %></a> <h1><a href=<%=links[threads.indexOf(thread)] %> > <%= thread.title %> by <%= thread.author.name %></a>
</h1> </h1>
</li> </li>
<% }); %> <% }); %>
</ul> </ul>
</body> </body>
</html> </html>

View file

@ -1,69 +1,69 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/css/styles.css" /> <link rel="stylesheet" href="/css/styles.css" />
<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>
<%= member.name %> <%= member.name %>
</title> </title>
<meta name="description" content="Akf-forum user page!"> <meta name="description" content="Akf-forum user page!">
<meta name="author" content="Akif9748"> <meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg"> <link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> </head>
<body> <body>
<!-- Navbar: --> <!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a> <a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<br> <br>
<button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button>
<button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button> <button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button>
<button class="buyuk" onclick="window.location.href = '/users'">USERS</button> <button class="buyuk" onclick="window.location.href = '/users'">USERS</button>
<button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button> <button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button>
<h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a> <h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> <img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1> </h1>
<hr> <hr>
<!-- Navbar end --> <!-- Navbar end -->
<ul> <ul>
<li> <li>
<h1>Avatar:</h1> <h1>Avatar:</h1>
<img style="width:256px;height:256px;" src=<%=member.avatar %> alt=<%= member.name %>> <img style="width:256px;height:256px;" src=<%=member.avatar %> alt=<%= member.name %>>
</li> </li>
<li> <li>
<h2>Name: <%= member.name %> <h2>Name: <%= member.name %>
</h2> </h2>
</li> </li>
<li> <li>
<h2>Created at: <h2>Created at:
<%= new Date(member.time).toLocaleString() %> <%= new Date(member.time).toLocaleString() %>
</h2> </h2>
</li> </li>
<li> <li>
<h2>Is admin? <%= member.admin ? "Yes" : "No" %> <h2>Is admin? <%= member.admin ? "Yes" : "No" %>
</h2> </h2>
</li> </li>
<li> <li>
<h2> Message: <%= counts.message %> <h2> Message: <%= counts.message %>
</h2> </h2>
</li> </li>
<li> <li>
<h2> Thread: <%= counts.thread %> <h2> Thread: <%= counts.thread %>
</h2> </h2>
</li> </li>
</ul> </ul>
</body> </body>
</html> </html>

View file

@ -1,46 +1,46 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/css/styles.css" /> <link rel="stylesheet" href="/css/styles.css" />
<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>Users!</title> <title>Users!</title>
<meta name="description" content="Akf-forum users!"> <meta name="description" content="Akf-forum users!">
<meta name="author" content="Akif9748"> <meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg"> <link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head> </head>
<body> <body>
<!-- Navbar: --> <!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a> <a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<br> <br>
<button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button> <button class="buyuk" onclick="window.location.href = '/threads'">THREADS</button>
<button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button> <button class="buyuk" onclick="window.location.href = '/search'">SEARCH</button>
<button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button> <button class="buyuk" onclick="window.location.href = '/createThread/'">OPEN THREAD</button>
<h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a> <h1 style="display:inline; float:right;"><a href=<%=user.getLink() %>> <%= user.name %></a>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> <img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1> </h1>
<hr> <hr>
<!-- Navbar end --> <!-- Navbar end -->
<h1>USERS:</h1> <h1>USERS:</h1>
<ul> <ul>
<% users.forEach(user=>{ %> <% users.forEach(user=>{ %>
<li> <li>
<h1><a href=<%=links[user.id] %> > <%= user.name %></a> <h1><a href=<%=links[user.id] %> > <%= user.name %></a>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>> <img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1> </h1>
</li> </li>
<% }); %> <% }); %>
</ul> </ul>
</body> </body>
</html> </html>