Added express-brute-loki, UI improvements, error page

This commit is contained in:
NGPixel committed 2016-08-23 00:25:36 -04:00
1 parent 24f90d4a17
commit aa740dea7a
10 files changed
+105 -30

No files matched your search

+1 -1
View File
@@ -1 +1 @@
.card,.highlight,.highlight pre,.textarea,embed,img,object{max-width:100%}a,hr{padding:0}a,button,input[type=button],input[type=file],input[type=submit],label{cursor:pointer}a,button,input,select,textarea{margin:0}a,input[type=radio],input[type=checkbox]{vertical-align:baseline}a:hover,strong,table th{color:#222324}body,pre,pre code{color:#69707a}.container,sub,sup{position:relative}.is-block,article,aside,details,figure,footer,header,hgroup,hr,nav,pre code,section,summary{display:block}.button,.delete,.input,.modal-close,.progress,.select select,.textarea{-moz-appearance:none;-webkit-appearance:none}.heading,.menu-label{letter-spacing:1px;text-transform:uppercase}@font-face{font-family:Roboto;src:url(/fonts/Roboto-Thin.woff) format("woff");font-weight:100;font-style:normal}@font-face{font-family:Roboto;src:url(/fonts/Roboto-ThinItalic.woff) format("woff");font-weight:100;font-style:italic}@font-face{font-family:Roboto;src:url(/fonts/Roboto-Light.woff) format("woff");font-weight:300;font-style:normal}@font-face{font-family:Roboto;src:url(/fonts/Roboto-LightItalic.woff) format("woff");font-weight:300;font-style:italic}@font-face{font-family:Roboto;src:url(/fonts/Roboto-Regular.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:Roboto;src:url(/fonts/Roboto-RegularItalic.woff) format("woff");font-weight:400;font-style:italic}@font-face{font-family:Roboto;src:url(/fonts/Roboto-Medium.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:Roboto;src:url(/fonts/Roboto-MediumItalic.woff) format("woff");font-weight:500;font-style:italic}@font-face{font-family:Roboto;src:url(/fonts/Roboto-Bold.woff) format("woff");font-weight:700;font-style:normal}@font-face{font-family:Roboto;src:url(/fonts/Roboto-BoldItalic.woff) format("woff");font-weight:700;font-style:italic}@font-face{font-family:Roboto;src:url(/fonts/Roboto-Black.woff) format("woff");font-weight:900;font-style:normal}@font-face{font-family:Roboto;src:url(/fonts/Roboto-BlackItalic.woff) format("woff");font-weight:900;font-style:italic}abbr,address,article,aside,audio,b,blockquote,body,body div,caption,cite,code,dd,del,details,dfn,dl,dt,em,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,p,pre,q,samp,section,small,span,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font-weight:400;vertical-align:baseline;background:0 0}td,td img{vertical-align:top}code,html,pre,pre code{background-color:#f5f7fa}*,:after,:before{box-sizing:inherit}ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}.is-clearfix:after,.notification:after,.select:after{content:" "}a{font-size:100%;background:0 0;color:#1fc8db;text-decoration:none;transition:none 86ms ease-out}del{text-decoration:line-through}abbr[title],dfn[title]{border-bottom:1px dotted #000;cursor:help}th{font-weight:700;vertical-align:bottom}td{font-weight:400}hr{height:1px;border:0;border-top:1px solid #ccc;border-top-color:#d3d6db;margin:40px 0}input,select{vertical-align:middle}input,select,textarea{font:99% sans-serif}table{border-collapse:collapse;border-spacing:0;font:100%;width:100%}body,code{font-weight:400}sub,sup{font-size:75%;line-height:0}sup{top:-.5em}sub{bottom:-.25em}code,kbd,pre,samp{font-family:monospace,sans-serif}button,input[type=button]{width:auto;overflow:visible}@keyframes spin-around{from{transform:rotate(0)}to{transform:rotate(359deg)}}html{box-sizing:border-box;font-size:14px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;min-width:300px;overflow-x:hidden;overflow-y:scroll;text-rendering:optimizeLegibility}body,button,input,select,textarea{font-family:Roboto,Helvetica,Arial,sans-serif}code,pre{-moz-osx-font-smoothing:auto;-webkit-font-smoothing:auto;font-family:"Source Code Pro",Monaco,Inconsolata,monospace;line-height:1.25}body{font-size:1rem;line-height:1.428571428571429}code{color:#ed6c63;font-size:12px;padding:1px 2px 2px}.button,.fa,.input,.textarea,table td,table th{vertical-align:top}small{font-size:11px}span{font-style:inherit;font-weight:inherit}.label,strong{font-weight:700}pre{white-space:pre;word-wrap:normal}.button,.nav-left,.table td.is-icon,.table th.is-icon,.tabs,.tag{white-space:nowrap}pre code{overflow-x:auto;padding:16px 20px}.box,.button{background-color:#fff}table td,table th{text-align:left}.fa,.has-text-centered{text-align:center}.block:not(:last-child),.box:not(:last-child),.content:not(:last-child),.highlight:not(:last-child),.level:not(:last-child),.message:not(:last-child),.notification:not(:last-child),.progress:not(:last-child),.subtitle:not(:last-child),.tabs:not(:last-child),.title:not(:last-child){margin-bottom:20px}@media screen and (min-width:980px){.container{margin:0 auto;max-width:960px}.container.is-fluid{margin:0 20px;max-width:none}.is-block-desktop{display:block!important}}.fa{font-sizLine truncated .card,.highlight,.highlight pre,.textarea,embed,img,object{max-width:100%}a,hr{padding:0}a,button,input[type=button],input[type=file],input[type=submit],label{cursor:pointer}a,button,input,select,textarea{margin:0}a,input[type=radio],input[type=checkbox]{vertical-align:baseline}a:hover,strong,table th{color:#222324}body,pre,pre code{color:#69707a}.container,sub,sup{position:relative}.is-block,article,aside,details,figure,footer,header,hgroup,hr,nav,pre code,section,summary{display:block}.button,.delete,.input,.modal-close,.progress,.select select,.textarea{-moz-appearance:none;-webkit-appearance:none}.heading,.menu-label{letter-spacing:1px;text-transform:uppercase}abbr,address,article,aside,audio,b,blockquote,body,body div,caption,cite,code,dd,del,details,dfn,dl,dt,em,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,p,pre,q,samp,section,small,span,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font-weight:400;vertical-align:baseline;background:0 0}td,td img{vertical-align:top}code,html,pre,pre code{background-color:#f5f7fa}*,:after,:before{box-sizing:inherit}ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}.is-clearfix:after,.notification:after,.select:after{content:" "}a{font-size:100%;background:0 0;color:#1fc8db;text-decoration:none;transition:none 86ms ease-out}del{text-decoration:line-through}abbr[title],dfn[title]{border-bottom:1px dotted #000;cursor:help}th{font-weight:700;vertical-align:bottom}td{font-weight:400}hr{height:1px;border:0;border-top:1px solid #ccc;border-top-color:#d3d6db;margin:40px 0}input,select{vertical-align:middle}input,select,textarea{font:99% sans-serif}table{border-collapse:collapse;border-spacing:0;font:100%;width:100%}sub,sup{font-size:75%;line-height:0}sup{top:-.5em}sub{bottom:-.25em}code,kbd,pre,samp{font-family:monospace,sans-serif}button,input[type=button]{width:auto;overflow:visible}@keyframes spin-around{from{transform:rotate(0)}to{transform:rotate(359deg)}}html{box-sizing:border-box;font-size:14px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;min-width:300px;overflow-x:hidden;overflow-y:scroll;text-rendering:optimizeLegibility}body,button,input,select,textarea{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"}code,pre{-moz-osx-font-smoothing:auto;-webkit-font-smoothing:auto;font-family:"Source Code Pro",Monaco,Inconsolata,monospace;line-height:1.25}body{font-size:1rem;font-weight:400;line-height:1.428571428571429}code{font-size:12px;padding:1px 2px 2px}.button,.fa,.input,.textarea,table td,table th{vertical-align:top}small{font-size:11px}span{font-style:inherit;font-weight:inherit}.label,strong{font-weight:700}pre{white-space:pre;word-wrap:normal}.button,.nav-left,.table td.is-icon,.table th.is-icon,.tabs,.tag{white-space:nowrap}pre code{overflow-x:auto;padding:16px 20px}.box,.button{background-color:#fff}table td,table th{text-align:left}.fa,.has-text-centered{text-align:center}.block:not(:last-child),.box:not(:last-child),.content:not(:last-child),.highlight:not(:last-child),.level:not(:last-child),.message:not(:last-child),.notification:not(:last-child),.progress:not(:last-child),.subtitle:not(:last-child),.tabs:not(:last-child),.title:not(:last-child){margin-bottom:20px}@media screen and (min-width:980px){.container{margin:0 auto;max-width:960px}.container.is-fluid{margin:0 20px;max-width:none}.is-block-desktop{display:block!important}}.fa{font-size:21px}@media screen and (max-width:768px){.is-block-mobile{display:block!important}}@media screen and (min-width:769px){.is-block-tablet{display:block!important}}@media screen and (min-width:769px) and (max-width:979px){.is-block-tablet-only{display:block!important}}@media screen and (max-width:979px){.is-block-touch{display:block!important}}@media screen and (min-width:980px) and (max-width:1179px){.is-block-desktop-only{display:block!important}}@media screen and (min-width:1180px){.container{max-width:1200px}.is-block-widescreen{display:block!important}}.is-flex{display:flex}@media screen and (max-width:768px){.is-flex-mobile{display:flex!important}}@media screen and (min-width:769px){.is-flex-tablet{display:flex!important}}@media screen and (min-width:769px) and (max-width:979px){.is-flex-tablet-only{display:flex!important}}@media screen and (max-width:979px){.is-flex-touch{display:flex!important}}@media screen and (min-width:980px){.is-flex-desktop{display:flex!important}}@media screen and (min-width:980px) and (max-width:1179px){.is-flex-desktop-only{display:flex!important}}@media screen and (min-width:1180px){.is-flex-widescreen{display:flex!important}}.is-inline{display:inline}@media screen and (max-width:768px){.is-inline-mobile{display:inline!important}}@media screen and (min-width:769px)Line truncated
+1 -1
View File
@@ -1,4 +1,4 @@
@import './layout/_fonts'; //@import './layout/_fonts';
@import './layout/_base'; @import './layout/_base';
$warning: #f68b39; $warning: #f68b39;
+2 -1
View File
@@ -5,4 +5,5 @@ html {
box-sizing: inherit; box-sizing: inherit;
} }
$family-sans-serif: "Roboto", "Helvetica", "Arial", sans-serif; //$family-sans-serif: "Roboto", "Helvetica", "Arial", sans-serif;
$family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
+53 -2
View File
@@ -1,4 +1,11 @@
.sd-menus {
width: 300px;
}
.mkcontent { .mkcontent {
h1 { h1 {
@@ -12,13 +19,21 @@ .mkcontent {
font-size: 80%; font-size: 80%;
color: $purple; color: $purple;
border-bottom: none; border-bottom: none;
&:visited {
color: $purple !important;
}
} }
.hljs { .hljs {
padding: 0; padding: 0;
border-bottom: 1px solid $grey-light;
border-right: 1px solid $grey-light;
border-radius: 3px; border-radius: 3px;
> code {
box-shadow: inset 0 0 5px 0 $grey-light;
}
} }
pre + p { pre + p {
@@ -29,4 +44,40 @@ .mkcontent {
float:right; float:right;
} }
img.pagelogo {
float: right;
margin-top: -50px;
max-width: 200px;
}
strong {
color: $grey-dark;
}
}
.content a:not(.button):visited {
color: $turquoise;
font-weight: 500;
}
code {
font-weight: 500;
color: $purple;
}
p code {
padding: 2px 5px;
border-radius: 4px;
}
.card-header {
background-color: $turquoise;
}
.card-header-title {
color: #FFF;
font-weight: 400;
font-size: 16px;
padding: 10px 20px;
} }
+8 -9
View File
@@ -2,15 +2,14 @@ var express = require('express');
var router = express.Router(); var router = express.Router();
var passport = require('passport'); var passport = require('passport');
var ExpressBrute = require('express-brute'); var ExpressBrute = require('express-brute');
//var ExpressBruteRedisStore = require('express-brute-redis'); var ExpressBruteLokiStore = require('D:\\git\\express-brute-loki');
var moment = require('moment'); var moment = require('moment');
/** /**
* Setup Express-Brute * Setup Express-Brute
*/ */
/*var EBstore = new ExpressBruteRedisStore({ var EBstore = new ExpressBruteLokiStore({
prefix: 'bf:', path: './data/brute.db'
client: red
}); });
var bruteforce = new ExpressBrute(EBstore, { var bruteforce = new ExpressBrute(EBstore, {
freeRetries: 5, freeRetries: 5,
@@ -26,7 +25,7 @@ var bruteforce = new ExpressBrute(EBstore, {
}); });
res.redirect('/login'); res.redirect('/login');
} }
});*/ });
/** /**
* Login form * Login form
@@ -37,7 +36,7 @@ router.get('/login', function(req, res, next) {
}); });
}); });
router.post('/login', /*bruteforce.prevent,*/ function(req, res, next) { router.post('/login', bruteforce.prevent, function(req, res, next) {
passport.authenticate('local', function(err, user, info) { passport.authenticate('local', function(err, user, info) {
if (err) { return next(err); } if (err) { return next(err); }
@@ -54,9 +53,9 @@ router.post('/login', /*bruteforce.prevent,*/ function(req, res, next) {
req.logIn(user, function(err) { req.logIn(user, function(err) {
if (err) { return next(err); } if (err) { return next(err); }
//req.brute.reset(function () { req.brute.reset(function () {
return res.redirect('/'); return res.redirect('/');
//}); });
}); });
})(req, res, next); })(req, res, next);
+3 -2
View File
@@ -11,10 +11,11 @@ router.get('/', (req, res) => {
var Promise = require('bluebird'); var Promise = require('bluebird');
var fs = Promise.promisifyAll(require("fs")); var fs = Promise.promisifyAll(require("fs"));
fs.readFileAsync("repo/Home.md", "utf8").then(function(contents) { fs.readFileAsync("repo/Storage/Redis.md", "utf8").then(function(contents) {
let pageData = mark.parse(contents); let pageData = mark.parse(contents);
if(!pageData.title) { if(!pageData.title) {
pageData.title = 'Gollum'; pageData.title = 'Redis';
pageData.subtitle = 'An open source, in-memory data structure store, used as database, cache and message broker.'
} }
res.render('pages/view', { pageData }); res.render('pages/view', { pageData });
}); });
+2 -2
View File
@@ -38,7 +38,7 @@
"cheerio": "^0.20.0", "cheerio": "^0.20.0",
"compression": "^1.6.2", "compression": "^1.6.2",
"connect-flash": "^0.1.1", "connect-flash": "^0.1.1",
"connect-loki": "^1.0.4", "connect-loki": "^1.0.5",
"connect-redis": "^3.1.0", "connect-redis": "^3.1.0",
"cookie-parser": "^1.4.3", "cookie-parser": "^1.4.3",
"express": "^4.14.0", "express": "^4.14.0",
@@ -102,7 +102,7 @@
"mocha": "^3.0.2", "mocha": "^3.0.2",
"mocha-lcov-reporter": "^1.2.0", "mocha-lcov-reporter": "^1.2.0",
"nodemon": "^1.10.2", "nodemon": "^1.10.2",
"snyk": "^1.18.0", "snyk": "^1.18.1",
"vue": "^1.0.26" "vue": "^1.0.26"
} }
} }
+3 -6
View File
@@ -6,11 +6,8 @@ nav.nav.has-shadow.stickyscroll
a.nav-item(href='/') a.nav-item(href='/')
h1.title Wiki h1.title Wiki
.nav-center .nav-center
p.nav-item.control.has-addons p.nav-item
input.input(type='text', placeholder='Find...') input.input(type='text', placeholder='Search...', style= { 'max-width': '300px', width: '33vw' })
a.button.is-info
span.icon.is-small
i.fa.fa-search
span.nav-toggle span.nav-toggle
span span
span span
@@ -25,7 +22,7 @@ nav.nav.has-shadow.stickyscroll
span.icon span.icon
i.fa.fa-edit i.fa.fa-edit
span Edit span Edit
a.button.is-primary(href='#') a.button.is-primary(href='#', onclick='$(".modal").addClass("is-active");')
span.icon span.icon
i.fa.fa-plus i.fa.fa-plus
span Create span Create
+14 -5
View File
@@ -14,8 +14,17 @@ html
link(type='text/css', rel='stylesheet', href='/css/app.css') link(type='text/css', rel='stylesheet', href='/css/app.css')
body(class='server-error') body(class='server-error')
#root section.hero.is-warning.is-fullheight
img(src='/images/logo-text_218x80.png') .hero-body
h1 Oops, something went wrong .container
h4= message a(href='/'): img(src='/favicons/android-icon-96x96.png')
pre #{error.stack} h1.title(style={ 'margin-top': '30px'})= message
h2.subtitle(style={ 'margin-bottom': '50px'}) Oops, something went wrong
a.button.is-warning.is-inverted(href='/') Go Home
if error.stack
section.section
.container.is-fluid
.content
h3 Detailed debug trail:
pre: code #{error.stack}
+18 -1
View File
@@ -14,7 +14,7 @@ block content
.container.is-fluid .container.is-fluid
.columns .columns
.column.is-narrow .column.is-narrow.sd-menus.is-hidden-touch
.box .box
aside.menu(style= { 'min-width': '200px' }) aside.menu(style= { 'min-width': '200px' })
@@ -23,6 +23,8 @@ block content
ul.menu-list ul.menu-list
li li
a(href='/') Home a(href='/') Home
li
a(href='/') Storage
li li
a(href='/account') Account a(href='/account') Account
.box.stickyscroll(data-margin-top=70) .box.stickyscroll(data-margin-top=70)
@@ -41,3 +43,18 @@ block content
.content.mkcontent .content.mkcontent
!= pageData.html != pageData.html
.modal
.modal-background
.modal-container
.modal-content
.card.is-fullwidth
header.card-header
p.card-header-title Create New Page
.card-content
.content
label.label Enter the full path:
p.control
input.input(type='text', placeholder='/path', value='/storage/new-page')
footer.card-footer
a.card-footer-item(onclick='$(".modal").removeClass("is-active");') Discard
a.card-footer-item Create