diff --git a/backend/app.ts b/backend/app.ts index 0320827..52c290f 100644 --- a/backend/app.ts +++ b/backend/app.ts @@ -116,10 +116,10 @@ async function main() { // ! I did not want to do it like this how tf did I back myself into this shit app.get('/admin', (req, res) => res.render('admin', { version: App.pkgVersion })); - app.get('/login', (req, res) => res.render('login', { version: App.pkgVersion })); // Routing app.use('/setup', (await import('./routers/setup.js')).router); + app.use('/login', (await import('./routers/login.js')).router); app.use('/api', (await import('./routers/api.js')).router); app.use('/', (await import('./routers/index.js')).router); diff --git a/backend/routers/login.ts b/backend/routers/login.ts new file mode 100644 index 0000000..3d07501 --- /dev/null +++ b/backend/routers/login.ts @@ -0,0 +1,16 @@ +import { path } from '@tycrek/joint'; +import { Router, json as BodyParserJson } from 'express'; +import { log } from '../log'; +import { UserConfig } from '../UserConfig'; +import { App } from '../app'; + +const router = Router({ caseSensitive: true }); + +// Static routes +router.get('/', (req, res) => !UserConfig.ready ? res.redirect('/') : res.render('login', { version: App.pkgVersion })); +router.get('/ui.js', (req, res) => !UserConfig.ready ? res.send('') : res.type('text/javascript').sendFile(path.join('dist-frontend/login.mjs'))); + +router.post('/', BodyParserJson(), async (req, res) => { +}); + +export { router };