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
<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.
## Installation
- Clone this repo. Or download it.
- Write `npm i` to install **dependencies**.
- Write `npm restart` for reset database, and `npm start` for run it.
## Credits
* [Akif9748](https://github.com/Akif9748) - Project owner
* [Camroku](https://github.com/Camroku) - Made stylesheets
## To Do:
- Admin panel, delete, edit messages.
## Roadmap
- [x] User
- [x] Login
- [x] Register
- [x] Logout
- [x] Admin
- [x] Message count
- [ ] Messages
- [x] Send message
- [x] Delete message
- [ ] Edit message
- [x] React message
- [ ] Forums
- [ ] Category system
- [ ] Create category
- [ ] Delete category
- [ ] Edit category
- [ ] Move category
- [ ] Other
- [ ] API
- [ ] Other client for forum via API
- [ ] Footer...
- [ ] Search
- [x] New Thread theme, better render for messages
## Image:
![image](https://user-images.githubusercontent.com/70021050/158060900-7384d394-cad7-4f73-94ad-7c8bd108ac44.png)
# akf-forum
<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.
## Installation
- Clone this repo. Or download it.
- Write `npm i` to install **dependencies**.
- Write `npm restart` for reset database, and `npm start` for run it.
## Credits
* [Akif9748](https://github.com/Akif9748) - Project owner
* [Camroku](https://github.com/Camroku) - Made stylesheets
## To Do:
- Admin panel, delete, edit messages.
## Roadmap
- [x] User
- [x] Login
- [x] Register
- [x] Logout
- [x] Admin
- [x] Message count
- [ ] Messages
- [x] Send message
- [x] Delete message
- [ ] Edit message
- [x] React message
- [ ] Forums
- [ ] Category system
- [ ] Create category
- [ ] Delete category
- [ ] Edit category
- [ ] Move category
- [ ] Other
- [ ] API
- [ ] Other client for forum via API
- [ ] Footer...
- [ ] Search
- [x] New Thread theme, better render for messages
## Image:
![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 Thread = require("./thread")
const User = require("./user")
const React = require("./react")
const Message = require("./message")
const Thread = require("./thread")
const User = require("./user")
const React = require("./react")
module.exports = { Message, Thread, User, React }

View File

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

14
classes/react.js vendored
View File

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

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

View File

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

View File

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

View File

@ -1,12 +1,12 @@
const { User } = require("../../classes/index");
const { get } = require("quick.db");
const error = require("../../errors/error.js");
module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login');
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.");
res.render("admin", { user })
}
const { User } = require("../../classes/index");
const { get } = require("quick.db");
const error = require("../../errors/error.js");
module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login');
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.");
res.render("admin", { user })
}

View File

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

View File

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

View File

@ -1,13 +1,13 @@
const { Message } = require("../../classes/index");
const error = require("../../errors/error.js");
module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login');
const id = req.url.slice(9);
const message = new Message().getId(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);
const { Message } = require("../../classes/index");
const error = require("../../errors/error.js");
module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login');
const id = req.url.slice(9);
const message = new Message().getId(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);
}

View File

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

View File

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

View File

@ -1,22 +1,22 @@
const { User } = require("../../classes/index");
const error = require("../../errors/error.js");
module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login');
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.");
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.");
else {
user2.admin = true;
user2.write()
}
res.render("admin", { user })
}
const { User } = require("../../classes/index");
const error = require("../../errors/error.js");
module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login');
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.");
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.");
else {
user2.admin = true;
user2.write()
}
res.render("admin", { user })
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,41 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Main page!</title>
<meta name="description" content="Akf-forum!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head>
<body>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<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 = '/users'">USERS</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>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1>
<hr>
<!-- Navbar end -->
<h1>Welcome to the admin panel of the forum, <%= user.name %>!</h1>
<form action="/admin/" method="POST">
<h2>Write an ID for make admin:</h2>
<input name="userid"></input>
<hr>
<button class = "buyuk" type="submit">Make admin!</button>
</form>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Main page!</title>
<meta name="description" content="Akf-forum!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head>
<body>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<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 = '/users'">USERS</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>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1>
<hr>
<!-- Navbar end -->
<h1>Welcome to the admin panel of the forum, <%= user.name %>!</h1>
<form action="/admin/" method="POST">
<h2>Write an ID for make admin:</h2>
<input name="userid"></input>
<hr>
<button class = "buyuk" type="submit">Make admin!</button>
</form>
</body>
</html>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,69 +1,69 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
<%= member.name %>
</title>
<meta name="description" content="Akf-forum user page!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head>
<body>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<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 = '/users'">USERS</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>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1>
<hr>
<!-- Navbar end -->
<ul>
<li>
<h1>Avatar:</h1>
<img style="width:256px;height:256px;" src=<%=member.avatar %> alt=<%= member.name %>>
</li>
<li>
<h2>Name: <%= member.name %>
</h2>
</li>
<li>
<h2>Created at:
<%= new Date(member.time).toLocaleString() %>
</h2>
</li>
<li>
<h2>Is admin? <%= member.admin ? "Yes" : "No" %>
</h2>
</li>
<li>
<h2> Message: <%= counts.message %>
</h2>
</li>
<li>
<h2> Thread: <%= counts.thread %>
</h2>
</li>
</ul>
</body>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="/css/styles.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
<%= member.name %>
</title>
<meta name="description" content="Akf-forum user page!">
<meta name="author" content="Akif9748">
<link rel="icon" type="image/x-icon" href="/images/favicon.jpg">
</head>
<body>
<!-- Navbar: -->
<a href="/"><img class="logo" src="/images/logo.jpg" alt="AKF-FORUM"></a>
<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 = '/users'">USERS</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>
<img class="yuvarlak" src=<%=user.avatar %> alt=<%= user.name %>>
</h1>
<hr>
<!-- Navbar end -->
<ul>
<li>
<h1>Avatar:</h1>
<img style="width:256px;height:256px;" src=<%=member.avatar %> alt=<%= member.name %>>
</li>
<li>
<h2>Name: <%= member.name %>
</h2>
</li>
<li>
<h2>Created at:
<%= new Date(member.time).toLocaleString() %>
</h2>
</li>
<li>
<h2>Is admin? <%= member.admin ? "Yes" : "No" %>
</h2>
</li>
<li>
<h2> Message: <%= counts.message %>
</h2>
</li>
<li>
<h2> Thread: <%= counts.thread %>
</h2>
</li>
</ul>
</body>
</html>

View File

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