diff --git a/README.md b/README.md index 201319c..d85500b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ 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. +- Write `npm restart` for **reset database**, and `npm start` for run it. +- Note, the reset database is important! ## API Akf-forum has got an API for other clients etc. You can test api with run apitest.py. @@ -21,6 +22,7 @@ And, you can learn informations about API in `APIDOCS.md`. - Better error codes, example 400 for bad request - Database change. (To MongoDB) - Better DB writing. Example, not `message.author.id`, `messsage.authorID` +- `/errors/error` will change ## Roadmap - [x] User diff --git a/index.js b/index.js index 219e6bd..b08d028 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,7 @@ app.set("view engine", "ejs"); app.use(express.json()); for (const file of fs.readdirSync("./routes")) - app.use("/" + file.slice(0, -3), require(`./routes/${file}`)); + app.use("/" + file.replace(".js",""), require(`./routes/${file}`)); app.all("*", (req, res) => error(res, 404, "We have not got this page.")); diff --git a/public/css/styles.css b/public/css/styles.css index d1f14e2..08a8732 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -1,4 +1,5 @@ -:root { /* Apprentice Scheme */ +:root { + /* Apprentice Scheme */ /* * use `var(--col-x)` instead of directly typing the color. */ @@ -22,21 +23,10 @@ --col-bg: #262626; } -img.yuvarlak { - border-radius: 50%; - height: 30px; - width: 30px; - object-fit: cover; -} -img.logo { - width: 266px; - height: 75px; - display: inline; -} -textarea { - +textarea { + font-family: monospace; background-color: var(--col-bg); border: 2px solid var(--col-8); @@ -68,8 +58,8 @@ h6 { background: var(--col-bg); color: var(--col-fg); max-width: 69rem; - margin: auto; margin-top: 10px; + margin: auto; /* funny number */ } @@ -135,7 +125,88 @@ button:hover { color: var(--col-bg); } -.mainpage { - padding: 10px; - float: right; + +/* NAVBAR: */ + +.navbar { + background-color: #333; + overflow: hidden; +} + +.navbar a { + float: left; + color: var(--col-fg); + text-align: center; + padding: 14px 16px; + text-decoration: none; + font-size: 17px; + border-right: 3px solid var(--col-8); +} + +.navbar a:hover { + background-color: var(--col-bg); + color: var(--col-fg); +} + +.navbar h1:hover { + background-color: var(--col-bg); + color: var(--col-fg); +} + +.navbar a.active { + background-color: var(--col-14); + color: var(--col-15); +} + + +.user { + margin: 0; + border: 1px solid var(--col-8); +} + +.user h1 { + font-family: monospace; + background: #333; + color: var(--col-fg); + margin: auto; + text-align: center; + line-height: 1; + color: var(--col-13); + font-size: 27px; +} + +.user img { + padding: 6px 10px; +} + +.user a { + color: var(--col-13); + padding: 0px 5px; +} + + +/* ADMIN */ +.admin { + background-color: #5F87AF; +} + +.admin a { + font-family: monospace; + background-color: var(--col-bg); + border: 2px solid var(--col-8); + + color: var(--col-fg); +} + + +/* IMAGES */ +img.yuvarlak { + border-radius: 50%; + height: 30px; + width: 30px; +} + +img.logo { + width: 266px; + height: 75px; } \ No newline at end of file diff --git a/public/js/navbar.js b/public/js/navbar.js new file mode 100644 index 0000000..e69de29 diff --git a/public/js/scripts.js b/public/js/scripts.js new file mode 100644 index 0000000..4076f41 --- /dev/null +++ b/public/js/scripts.js @@ -0,0 +1,2 @@ +const admin = () => document.getElementById("admin").innerHTML = + '

You are admin, and you can go your page


'; diff --git a/views/admin.ejs b/views/admin.ejs index 955a9cd..9f5f4c1 100644 --- a/views/admin.ejs +++ b/views/admin.ejs @@ -14,20 +14,39 @@ + + + + -
- - - -

> <%= user.name %> - alt=<%= user.name %>> -

+ + + + + +
+

Welcome to the admin panel of the forum, <%= user.name %>!

diff --git a/views/index.ejs b/views/index.ejs index 83b3cf2..dc5b7ec 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -9,34 +9,52 @@ - + + +
+ - <%if(user.admin){%> -
- <%};%> - -
- - - -

> <%= user.name %> - alt=<%= user.name %>> -

+ + + + + + + +
+ + +

Welcome, > <%= user.name %> alt=<%= user.name %>> -
- You can press logout here: - +
+ You can press logout here: +

@@ -44,16 +62,24 @@

Statistics:

diff --git a/views/openThread.ejs b/views/openThread.ejs index fcd26f9..19c31b0 100644 --- a/views/openThread.ejs +++ b/views/openThread.ejs @@ -14,15 +14,37 @@ + + +
+ + + + + -
- - - -

> <%= user.name %> - alt=<%= user.name %>> -

+ + + + + +
diff --git a/views/thread.ejs b/views/thread.ejs index 1591892..7c1ceb6 100644 --- a/views/thread.ejs +++ b/views/thread.ejs @@ -16,20 +16,25 @@ - - -
+ +
+ + + + + +
+

<%= thread.title %> @@ -41,7 +46,7 @@
<% messages.forEach(message=>{ %> -
style="border: 2px solid #444444; padding: 5px;"> +
style="border: 2px solid #444444; padding: 5px;">

alt=<%= message.author.name %>> > <%= message.author.name %>: diff --git a/views/threads.ejs b/views/threads.ejs index 4c48e99..2fb2eac 100644 --- a/views/threads.ejs +++ b/views/threads.ejs @@ -14,18 +14,24 @@ + +
+ + -
- - +
- diff --git a/views/user.ejs b/views/user.ejs index c432cdf..ceb9b11 100644 --- a/views/user.ejs +++ b/views/user.ejs @@ -16,19 +16,25 @@ - - -
- - - - -

> <%= user.name %> - alt=<%= user.name %>> -

-
+ +
+ + + + + +
+