Skip to content

Commit

Permalink
Fix Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
noremacsim committed Nov 29, 2022
1 parent 0f2bd6e commit bb2dd0b
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 79 deletions.
4 changes: 2 additions & 2 deletions App/controllers/userController.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ module.exports = {
name: 'user',

signinView: async (request, h) => {

if (request.state.twoFAPassed === true &&
if (
request.state.twoFAPassed === true &&
request.state.isLoggedIn === true
) {
return h.redirect(`/`);
Expand Down
113 changes: 60 additions & 53 deletions App/views/error/404.html
Original file line number Diff line number Diff line change
@@ -1,59 +1,66 @@
<html lang="en"><head>
<meta charset="utf-8">
<title>404 Page Not Found</title>
<style type="text/css">
<html lang="en">
<head>
<meta charset="utf-8" />
<title>404 Page Not Found</title>
<style type="text/css">
::selection {
background-color: #e13300;
color: white;
}
::-moz-selection {
background-color: #e13300;
color: white;
}

::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4f5155;
}

body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}

a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #d0d0d0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}

h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #d0d0d0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}

code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #d0d0d0;
box-shadow: 0 0 8px #d0d0d0;
}

#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}

p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1>404 Page Not Found</h1>
<p>The page you requested was not found.</p> </div>

</body></html>
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1>404 Page Not Found</h1>
<p>The page you requested was not found.</p>
</div>
</body>
</html>
5 changes: 4 additions & 1 deletion Core/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ let Controllers = [];
fs.readdirSync(path.join(__dirname, '../../App/controllers/'))
.filter((file) => file !== 'index.js')
.forEach((file) => {
controller = require(path.join(__dirname + '../../../App/controllers/', file));
controller = require(path.join(
__dirname + '../../../App/controllers/',
file
));
Controllers[controller.name] = controller;
});

Expand Down
4 changes: 2 additions & 2 deletions Core/helpers/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ module.exports.functions = {
exists: function (request, h) {
// Check if path exists in routes
let requestedPath = '/';
const checkRequestedPath = obj => obj.path === request?.route?.path;
const checkRequestedPath = (obj) => obj.path === request?.route?.path;
h.request.server._core.router.routes.forEach((element) => {
if (element.routes.some(checkRequestedPath)) {
requestedPath = request?.route?.path;
}
})
});

if (requestedPath === '/{any*}') {
requestedPath = '/';
Expand Down
2 changes: 1 addition & 1 deletion Core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ module.exports.Middleware = require('./middleware');
module.exports.Controllers = require('./controllers');
module.exports.Routes = require('./routes');
module.exports.driftyCore = require('./driftyCore.js');
console.log('loaded');
console.log('loaded');
8 changes: 4 additions & 4 deletions Core/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ const db = {};
fs.readdirSync(__dirname + '/')
.filter((file) => file.indexOf('.') !== 0 && file !== 'index.js')
.forEach((file) => {
const model = require(path.join(
__dirname + '/',
file
))(sequelize, Sequelize.DataTypes);
const model = require(path.join(__dirname + '/', file))(
sequelize,
Sequelize.DataTypes
);
db[model.name] = model;
});

Expand Down
1 change: 0 additions & 1 deletion Core/models/routeMethods.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = (sequelize, DataTypes) => {

const Drifty_Routes_Method = sequelize.define('Drifty_Routes_Method', {
type: DataTypes.ENUM('GET', 'POST', 'PUT'),
});
Expand Down
23 changes: 13 additions & 10 deletions Core/models/routeMiddleware.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
module.exports = (sequelize, DataTypes) => {
const Drifty_Routes_Middleware = sequelize.define('Drifty_Routes_Middleware', {
handler: {
type: DataTypes.STRING,
unique: false,
allowNull: false,
validate: {
notNull: {
msg: 'Requires a handler',
const Drifty_Routes_Middleware = sequelize.define(
'Drifty_Routes_Middleware',
{
handler: {
type: DataTypes.STRING,
unique: false,
allowNull: false,
validate: {
notNull: {
msg: 'Requires a handler',
},
},
},
},
});
}
);

Drifty_Routes_Middleware.associate = function (models) {
Drifty_Routes_Middleware.belongsTo(models.Drifty_Routes);
Expand Down
7 changes: 3 additions & 4 deletions Core/routes/error.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Boom = require('boom');
const pathHelpers = require("../helpers/paths");
const pathHelpers = require('../helpers/paths');

module.exports = [
{
Expand All @@ -8,9 +8,8 @@ module.exports = [
handler: (request, h) => {
const accept = request.headers.accept;

const requestedPath = pathHelpers.exists(request, h)
if (requestedPath)
{
const requestedPath = pathHelpers.exists(request, h);
if (requestedPath) {
return h.redirect(`/user/login?path=${requestedPath}`);
}

Expand Down
2 changes: 1 addition & 1 deletion bin/build-routes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// In here we will build custom routes from the DB.
// This will be needed as we will start to save our routes within the DB instead of a file.
// Our routes I think.... are defined before db let me check......
// Our routes I think.... are defined before db let me check......

0 comments on commit bb2dd0b

Please sign in to comment.