* Added fake site warning

* Fixed a bunch of style bugs for chrome browsers
* Improved check box styles on desktop and mobile
* Touch up tool tip styles. Only dark now.
* Created a separate terms page
* Added 2FA auth token options to login
* Added tool tip displays to some buttons on editor
* Added pinned and archived options to overflow menu
* Changed shared note styles
* Disabled Scroll into view
* Made image display smaller when adding images to notes
* Added a last used color option
* Updated help page
* Fixed spelling error on terms page
* Added a big ass green label on the new note icon
* Scratch pad now opens a note, which is the scratch pad
* Added better 2fa guide
* Added change password option
* Added log out and log out all active sessions option
* Added strict rate limiting on login and register actions
* Added middleware to routes that force authentication to be accessed
* Fixed bug that was causing shared notes to appear empty
* Updated option now appears on shared notes after they are actually updated
This commit is contained in:
Max G committed 2020-07-23 05:00:20 +00:00
1 parent a8a966866c
commit b34a62e114
24 files changed
+559 -483

No files matched your search

+21 -12
View File
@@ -21,17 +21,17 @@ const port = 3000
//
// Request Rate Limiter
//
const rateLimit = require('express-rate-limit');
const rateLimit = require('express-rate-limit')
//Limiter for the entire app
const limiter = rateLimit({
windowMs: 10 * 60 * 1000, // minutes
max: 1000 // limit each IP to 100 requests per windowMs
});
windowMs: 10 * 60 * 1000, // 10 minutes
max: 1000 // limit each IP to 1000 requests per windowMs
})
// apply to all requests
app.use(limiter);
var http = require('http').createServer(app);
var io = require('socket.io')(http, {
path:'/socket'
@@ -222,6 +222,7 @@ app.use(express.json({limit: '5mb'}))
app.use(function(req, res, next){
//Always null out master key, never allow it set from outside
req.headers.userId = null
req.headers.masterKey = null
req.headers.sessionId = null
@@ -243,10 +244,7 @@ app.use(function(req, res, next){
})
.catch(error => {
console.log(error)
res.statusMessage = error //Throw 400 error if token is bad
res.status(400).end()
next('Unauthorized')
})
} else {
next() //No token. Move along.
@@ -260,13 +258,12 @@ let UserTest = require('@models/User')
let NoteTest = require('@models/Note')
let AuthTest = require('@helpers/Auth')
Auth.testTwoFactor()
Auth.test()
UserTest.keyPairTest('genMan23', '1', printResults)
UserTest.keyPairTest('genMan25', '1', printResults)
.then( ({testUserId, masterKey}) => NoteTest.test(testUserId, masterKey, printResults))
.then( message => {
if(printResults) console.log(message)
Auth.testTwoFactor()
})
@@ -303,4 +300,16 @@ app.use('/api/quick-note', quickNote)
//Output running status
app.listen(port, () => {
// console.log(`Listening on port ${port}!`)
})
//
//Error handlers
//
//Default error handler just say unauthorized for everything
app.use(function (err, req, res, next) {
if (err) {
res.status(401).send('Unauthorized')
return
}
next()
})