add routes, error & config

This commit is contained in:
2023-03-11 15:04:03 +01:00
parent 5ca3e383a6
commit c83fa2cfd9
11 changed files with 216 additions and 8 deletions

View File

@@ -0,0 +1,29 @@
/*
* myevent - routes.js (admin)
*
* Created by Janis Hutz 03/11/2023, Licensed under the GPL V3 License
* https://janishutz.com, development@janishutz.com
*
*
*/
const path = require( 'path' );
module.exports = ( app, settings ) => {
app.get( '/admin/login', ( request, response ) => {
response.sendFile( path.join( __dirname + '/ui/login.html' ) );
} );
app.get( '/admin', ( request, response ) => {
if ( request.session.loggedIn ) {
if ( settings[ 'init' ] ) {
response.sendFile( path.join( __dirname + '/ui/panel.html' ) );
} else {
response.sendFile( path.join( __dirname + '/ui/setup.html' ) );
}
} else {
response.redirect( '/admin/login' );
}
} );
};

View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>login :: myevent - admin panel</title>
</head>
<body>
<div class="content">
<img src="/assets/logo.png" alt="myevent-logo" class="logo">
<div class="lang" id="en">
<h1>Welcome to myevent!</h1>
<p>Thank you for installing and using myevent! Let's get started by setting it up! First plan of action is to log in to the admin panel where you can replace this page here with your own landing page!</p>
<a href="/admin/login" class="button">To the admin panel</a>
</div>
</div>
</body>
</html>