Change config to camel case with backwards compatibility

This refactors the configs a bit to now use camel case everywhere.
This change should help to clean up the config interface and make it
better understandable.

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
Sheogorath
2018-03-07 15:17:35 +01:00
parent fa4a8418af
commit 2411dffa2c
29 changed files with 290 additions and 237 deletions

View File

@@ -45,10 +45,10 @@ function secure (socket, next) {
var handshakeData = socket.request
if (handshakeData.headers.cookie) {
handshakeData.cookie = cookie.parse(handshakeData.headers.cookie)
handshakeData.sessionID = cookieParser.signedCookie(handshakeData.cookie[config.sessionname], config.sessionsecret)
handshakeData.sessionID = cookieParser.signedCookie(handshakeData.cookie[config.sessionName], config.sessionSecret)
if (handshakeData.sessionID &&
handshakeData.cookie[config.sessionname] &&
handshakeData.cookie[config.sessionname] !== handshakeData.sessionID) {
handshakeData.cookie[config.sessionName] &&
handshakeData.cookie[config.sessionName] !== handshakeData.sessionID) {
if (config.debug) { logger.info('AUTH success cookie: ' + handshakeData.sessionID) }
return next()
} else {
@@ -284,7 +284,7 @@ function extractNoteIdFromSocket (socket) {
return false
}
var hostUrl = url.parse(referer)
var noteId = config.urlpath ? hostUrl.pathname.slice(config.urlpath.length + 1, hostUrl.pathname.length).split('/')[1] : hostUrl.pathname.split('/')[1]
var noteId = config.urlPath ? hostUrl.pathname.slice(config.urlPath.length + 1, hostUrl.pathname.length).split('/')[1] : hostUrl.pathname.split('/')[1]
return noteId
} else {
return false
@@ -330,7 +330,7 @@ function emitRefresh (socket) {
var note = notes[noteId]
var out = {
title: note.title,
docmaxlength: config.documentmaxlength,
docmaxlength: config.documentMaxLength,
owner: note.owner,
ownerprofile: note.ownerprofile,
lastchangeuser: note.lastchangeuser,
@@ -788,7 +788,7 @@ function connection (socket) {
var note = notes[noteId]
// Only owner can change permission
if (note.owner && note.owner === socket.request.user.id) {
if (permission === 'freely' && !config.allowanonymous && !config.allowanonymousedits) return
if (permission === 'freely' && !config.allowAnonymous && !config.allowAnonymousedits) return
note.permission = permission
models.Note.update({
permission: permission