From 5ec060ee30c889d41feebdfc70a932be980d752b Mon Sep 17 00:00:00 2001 From: biglyderv Date: Mon, 25 Nov 2024 14:12:43 -0500 Subject: [PATCH] stuff --- client/login.js | 8 ++++++-- client/register.js | 8 ++++++-- index.js | 3 +-- routes.js | 5 ++++- static/main.css | 35 ++++++++++++++++++++--------------- views/form.ejs | 5 ++++- views/header_block.ejs | 7 +++++++ views/main.ejs | 7 ++++++- 8 files changed, 54 insertions(+), 24 deletions(-) diff --git a/client/login.js b/client/login.js index 8213f36..f761b46 100644 --- a/client/login.js +++ b/client/login.js @@ -1,13 +1,17 @@ import Route from "../route.js"; +import auth from "../form/auth.js"; // TODO: rewrite -let main = new Route([], async function (req, res, input) { +let main = new Route([auth], async function (req, res, input) { + let { username } = input; return res.render('form', { data: [ { label: "Username", type: "text", name: "user" }, { label: "Password", type: "password", name: "pass" } ], - 'route': '/api/form/login' + 'route': '/api/form/login', + 'title': 'Login', + username }); }); diff --git a/client/register.js b/client/register.js index 656d207..f6fe4d8 100644 --- a/client/register.js +++ b/client/register.js @@ -1,14 +1,18 @@ import Route from "../route.js"; +import auth from "../form/auth.js"; // TODO: rewrite -let main = new Route([], async function (req, res, input) { +let main = new Route([auth], async function (req, res, input) { + let { username } = input; return res.render('form', { data: [ { label: "Username", type: "text", name: "user" }, { label: "Password", type: "password", name: "pass" }, { label: "Password (again)", type: "password", name: "pass2" } ], - 'route': '/api/form/register' + 'route': '/api/form/register', + 'title': 'Join', + username }); }); diff --git a/index.js b/index.js index c3b9394..91ae539 100644 --- a/index.js +++ b/index.js @@ -20,8 +20,7 @@ app.get('/', (req, res) => { }) app.get('/client/:route', async (req, res) => { - let dat = await iterate(req, res, 'client'); - //res.send(dat); + await iterate(req, res, 'client'); }) app.get('/api/get/:route', async (req, res) => { diff --git a/routes.js b/routes.js index fc39271..09e22cb 100644 --- a/routes.js +++ b/routes.js @@ -29,7 +29,10 @@ async function iterate(req, res, index) { let keys = Object.keys(routesI); let cmd = req.params.route; - if (keys.indexOf(cmd) == -1) return '404 not found'; + if (keys.indexOf(cmd) == -1) { + res.status(404).send('fail'); + return; + } return await routesI[cmd].run(req, res, {}); } diff --git a/static/main.css b/static/main.css index 1a66419..110ecfc 100644 --- a/static/main.css +++ b/static/main.css @@ -12,14 +12,14 @@ body { } :root { - --dark-1: #2b2f36; + --dark-1: #362b2b; --dark-2: #d8d8d8; - --dark-3: rgb(73, 138, 236); + --dark-3: rgb(236, 73, 73); --light-1: #ffffff; - --light-2: #f8f8f8; + --light-2: #ffa9a9; - --hyperlink: rgb(139, 171, 219); + --hyperlink: rgb(255, 72, 72); --shadow-1: 0px 0px 2px 2px var(--dark-2); @@ -33,16 +33,21 @@ a { input, textarea, -.button { - border: 0; - border-radius: 0.2rem; - box-shadow: var(--shadow-1); +.button, +.area, +form { + border: solid var(--dark-2) 3px; + border-radius: 5px; font-size: 1rem; padding: 0.5rem; margin-bottom: 0.5rem; } +form span { + font-weight: bold; +} + .button a { text-decoration: none; color: var(--light-1); @@ -51,11 +56,6 @@ textarea, .area, form { width: 700px; - - box-shadow: var(--shadow-1); - - padding: 10px; - margin-top: 10px; } form { @@ -94,14 +94,19 @@ form { margin: 0; font-size: 1.2em; align-items: center; + margin-bottom: 10px; + position: sticky; + top: 0; } .header a { font-weight: bold; - color: white; + color: var(--light-1); + margin-left: 0.5em; + padding-left: 0.5em; + border-left: solid var(--light-2) 2px; } .header img { height: 2em; - margin-right: 1em; } \ No newline at end of file diff --git a/views/form.ejs b/views/form.ejs index 9d033b0..2a6c2cd 100644 --- a/views/form.ejs +++ b/views/form.ejs @@ -1,11 +1,14 @@ <%- include('header.ejs') -%>
+

+ <%= title %> +

<% for (let elem of data) { %> <%= elem.label %> <% } %> - +
<%- include('footer.ejs') -%> \ No newline at end of file diff --git a/views/header_block.ejs b/views/header_block.ejs index 4471231..5eddb5c 100644 --- a/views/header_block.ejs +++ b/views/header_block.ejs @@ -1,4 +1,11 @@
BiglyChat + <%if (username=='!nobody' ) { %> + + <% } else { %> + + <%= username %> + + <% } %>
\ No newline at end of file diff --git a/views/main.ejs b/views/main.ejs index 64f7c95..4580a6d 100644 --- a/views/main.ejs +++ b/views/main.ejs @@ -1,7 +1,12 @@ <%- include('header.ejs') -%>

BiglyChat

-

A community for video editing

+

Collab on videos... make creative animations... and more!

+

About

+

I am Onez, a self-taught developer since the age of 12. Following the unexpected growth + of Video Bot Thing, I made this as a home for the logo editing community. View the source if you want to contribute or make a + fork.

<%if (username=='!nobody' ) { %> <% } %>