diff --git a/scripts/tests/all-tests.ts b/scripts/tests/all-tests.ts index a82fdfc5..dc11e48d 100644 --- a/scripts/tests/all-tests.ts +++ b/scripts/tests/all-tests.ts @@ -61,6 +61,7 @@ export const runTests = async () => { const pass = () => assertEquals(true, true); + // eslint-disable-next-line @typescript-eslint/no-explicit-any const invalid: [string, any][] = []; const missing: string[] = []; diff --git a/server/routes/account.ts b/server/routes/account.ts index f6ce5b58..61ae00fe 100644 --- a/server/routes/account.ts +++ b/server/routes/account.ts @@ -28,11 +28,13 @@ router.post('/get-roles', (req, res) => { res.json(Role.all()); }); -router.get('/sign-in', (_req, res) => { +router.get('/sign-in', (req, res, next) => { + if (req.session.account) return next(); res.sendTemplate('entries/account/sign-in'); }); -router.get('/sign-up', (_req, res) => { +router.get('/sign-up', (req, res, next) => { + if (req.session.account) return next(); res.sendTemplate('entries/account/sign-up'); }); diff --git a/server/server.ts b/server/server.ts index 7b9bd514..df536c3a 100644 --- a/server/server.ts +++ b/server/server.ts @@ -2,9 +2,13 @@ import env, { __root, resolve } from './utilities/env.ts'; import { log, error } from './utilities/terminal-logging.ts'; import { App, ResponseStatus } from './structure/app/app.ts'; import { Session } from './structure/sessions.ts'; +import { getJSON, log as serverLog } from './utilities/files.ts'; +import { homeBuilder } from './utilities/page-builder.ts'; +import Account from './structure/accounts.ts'; import { log as serverLog } from './utilities/files.ts'; import { runBuild } from './bundler.ts'; import { router as api } from './routes/api.ts'; +import Role from './structure/roles.ts'; import { FileUpload } from './middleware/stream.ts'; import { stdin } from './utilities/utilties.ts'; import { ReqBody } from './structure/app/req.ts'; diff --git a/server/utilities/env.ts b/server/utilities/env.ts index e7629f1b..ea8ac1dd 100644 --- a/server/utilities/env.ts +++ b/server/utilities/env.ts @@ -1,7 +1,7 @@ import os from 'https://deno.land/x/dos@v0.11.0/mod.ts'; import * as blog from 'https://deno.land/x/blog@0.3.3/deps.ts'; import path from 'node:path'; -import { error, log } from './terminal-logging.ts'; +import { error } from './terminal-logging.ts'; /** * Makes paths consistent across platforms diff --git a/shared/status-messages.ts b/shared/status-messages.ts index f3391200..bdab92a5 100644 --- a/shared/status-messages.ts +++ b/shared/status-messages.ts @@ -184,12 +184,14 @@ export const messages: { color: 'success', code: 200, instructions: 'You will be redirected to the home page.', + redirect: '/home', }, 'account:logged-out': { message: 'You have been logged out.', color: 'success', code: 200, instructions: 'You will be redirected to the home page.', + redirect: '/home', }, 'account:no-role': { message: 'This account does not have this role',