mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-24 18:56:32 -05:00
Adapt code for eslint-config-standard 17
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
66ab5ab51b
commit
d26dcd04a1
24 changed files with 82 additions and 82 deletions
4
app.js
4
app.js
|
@ -46,7 +46,7 @@ if (config.useSSL) {
|
|||
const options = {
|
||||
key: fs.readFileSync(config.sslKeyPath, 'utf8'),
|
||||
cert: fs.readFileSync(config.sslCertPath, 'utf8'),
|
||||
ca: ca,
|
||||
ca,
|
||||
dhparam: fs.readFileSync(config.dhParamPath, 'utf8'),
|
||||
requestCert: false,
|
||||
rejectUnauthorized: false
|
||||
|
@ -242,7 +242,7 @@ app.get('*', function (req, res) {
|
|||
io.use(realtime.secure)
|
||||
// socket.io auth
|
||||
io.use(passportSocketIo.authorize({
|
||||
cookieParser: cookieParser,
|
||||
cookieParser,
|
||||
key: config.sessionName,
|
||||
secret: config.sessionSecret,
|
||||
store: sessionStore,
|
||||
|
|
|
@ -24,10 +24,10 @@ const sourceURL = getGitHubURL(repository.url, commitID || version)
|
|||
const fullversion = commitID ? `${version}-${commitID}` : version
|
||||
|
||||
const packageConfig = {
|
||||
version: version,
|
||||
version,
|
||||
minimumCompatibleVersion: '0.5.0',
|
||||
fullversion: fullversion,
|
||||
sourceURL: sourceURL
|
||||
fullversion,
|
||||
sourceURL
|
||||
}
|
||||
|
||||
const configFilePath = path.resolve(appRootPath, process.env.CMD_CONFIG_FILE ||
|
||||
|
|
|
@ -37,9 +37,9 @@ module.exports = {
|
|||
function responseError (res, code, detail, msg) {
|
||||
res.status(code).render('error.ejs', {
|
||||
title: code + ' ' + detail + ' ' + msg,
|
||||
code: code,
|
||||
detail: detail,
|
||||
msg: msg,
|
||||
code,
|
||||
detail,
|
||||
msg,
|
||||
opengraph: []
|
||||
})
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ const errors = require('./errors')
|
|||
|
||||
// public
|
||||
const History = {
|
||||
historyGet: historyGet,
|
||||
historyPost: historyPost,
|
||||
historyDelete: historyDelete,
|
||||
updateHistory: updateHistory
|
||||
historyGet,
|
||||
historyPost,
|
||||
historyDelete,
|
||||
updateHistory
|
||||
}
|
||||
|
||||
function getHistory (userid, callback) {
|
||||
|
|
|
@ -73,7 +73,7 @@ const umzug = new Umzug({
|
|||
},
|
||||
storage: 'sequelize',
|
||||
storageOptions: {
|
||||
sequelize: sequelize
|
||||
sequelize
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ module.exports = function (sequelize, DataTypes) {
|
|||
const title = Note.parseNoteTitle(body)
|
||||
if (fsModifiedTime.isAfter(dbModifiedTime) && note.content !== body) {
|
||||
note.update({
|
||||
title: title,
|
||||
title,
|
||||
content: body,
|
||||
lastchangeAt: fsModifiedTime
|
||||
}).then(function (note) {
|
||||
|
@ -221,7 +221,7 @@ module.exports = function (sequelize, DataTypes) {
|
|||
authorship = Note.updateAuthorshipByOperation(operations[i], null, authorship)
|
||||
}
|
||||
note.update({
|
||||
authorship: authorship
|
||||
authorship
|
||||
}).then(function (note) {
|
||||
return callback(null, note.id)
|
||||
}).catch(function (err) {
|
||||
|
|
|
@ -47,7 +47,7 @@ function sendDmpWorker (data, callback) {
|
|||
const cacheKey = Date.now() + '_' + shortId.generate()
|
||||
dmpCallbackCache[cacheKey] = callback
|
||||
data = Object.assign(data, {
|
||||
cacheKey: cacheKey
|
||||
cacheKey
|
||||
})
|
||||
dmpWorker.send(data)
|
||||
}
|
||||
|
@ -151,8 +151,8 @@ module.exports = function (sequelize, DataTypes) {
|
|||
if (count <= 0) return callback(null, null)
|
||||
sendDmpWorker({
|
||||
msg: 'get revision',
|
||||
revisions: revisions,
|
||||
count: count
|
||||
revisions,
|
||||
count
|
||||
}, callback)
|
||||
}).catch(function (err) {
|
||||
return callback(err, null)
|
||||
|
@ -272,7 +272,7 @@ module.exports = function (sequelize, DataTypes) {
|
|||
} else {
|
||||
Revision.create({
|
||||
noteId: note.id,
|
||||
patch: patch,
|
||||
patch,
|
||||
content: note.content,
|
||||
length: note.content.length,
|
||||
authorship: note.authorship
|
||||
|
|
|
@ -21,12 +21,12 @@ const ot = require('./ot')
|
|||
// public
|
||||
const realtime = {
|
||||
io: null,
|
||||
onAuthorizeSuccess: onAuthorizeSuccess,
|
||||
onAuthorizeFail: onAuthorizeFail,
|
||||
secure: secure,
|
||||
connection: connection,
|
||||
getStatus: getStatus,
|
||||
isReady: isReady,
|
||||
onAuthorizeSuccess,
|
||||
onAuthorizeFail,
|
||||
secure,
|
||||
connection,
|
||||
getStatus,
|
||||
isReady,
|
||||
maintenance: true
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ function finishUpdateNote (note, _note, callback) {
|
|||
const body = note.server.document
|
||||
const title = note.title = models.Note.parseNoteTitle(body)
|
||||
const values = {
|
||||
title: title,
|
||||
title,
|
||||
content: body,
|
||||
authorship: note.authorship,
|
||||
lastchangeuserId: note.lastchangeuser,
|
||||
|
@ -242,7 +242,7 @@ function getStatus (callback) {
|
|||
})
|
||||
models.User.count().then(function (regcount) {
|
||||
return callback
|
||||
// eslint-disable-next-line node/no-callback-literal
|
||||
// eslint-disable-next-line n/no-callback-literal
|
||||
? callback({
|
||||
onlineNotes: Object.keys(notes).length,
|
||||
onlineUsers: Object.keys(users).length,
|
||||
|
@ -251,9 +251,9 @@ function getStatus (callback) {
|
|||
registeredUsers: regcount,
|
||||
onlineRegisteredUsers: regaddresses.length,
|
||||
distinctOnlineRegisteredUsers: distinctregaddresses.length,
|
||||
isConnectionBusy: isConnectionBusy,
|
||||
isConnectionBusy,
|
||||
connectionSocketQueueLength: connectionSocketQueue.length,
|
||||
isDisconnectBusy: isDisconnectBusy,
|
||||
isDisconnectBusy,
|
||||
disconnectSocketQueueLength: disconnectSocketQueue.length
|
||||
})
|
||||
: null
|
||||
|
@ -303,7 +303,7 @@ function emitOnlineUsers (socket) {
|
|||
if (user) { users.push(buildUserOutData(user)) }
|
||||
})
|
||||
const out = {
|
||||
users: users
|
||||
users
|
||||
}
|
||||
realtime.io.to(noteId).emit('online users', out)
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ function startConnection (socket) {
|
|||
where: {
|
||||
id: noteId
|
||||
},
|
||||
include: include
|
||||
include
|
||||
}).then(function (note) {
|
||||
if (!note) {
|
||||
return failConnection(404, 'note not found', socket)
|
||||
|
@ -492,18 +492,18 @@ function startConnection (socket) {
|
|||
id: noteId,
|
||||
alias: note.alias,
|
||||
title: note.title,
|
||||
owner: owner,
|
||||
ownerprofile: ownerprofile,
|
||||
owner,
|
||||
ownerprofile,
|
||||
permission: note.permission,
|
||||
lastchangeuser: lastchangeuser,
|
||||
lastchangeuserprofile: lastchangeuserprofile,
|
||||
lastchangeuser,
|
||||
lastchangeuserprofile,
|
||||
socks: [],
|
||||
users: {},
|
||||
tempUsers: {},
|
||||
createtime: moment(createtime).valueOf(),
|
||||
updatetime: moment(updatetime).valueOf(),
|
||||
server: server,
|
||||
authors: authors,
|
||||
server,
|
||||
authors,
|
||||
authorship: note.authorship
|
||||
}
|
||||
|
||||
|
@ -523,7 +523,7 @@ function failConnection (code, err, socket) {
|
|||
connectNextSocket()
|
||||
// emit error info
|
||||
socket.emit('info', {
|
||||
code: code
|
||||
code
|
||||
})
|
||||
return socket.disconnect(true)
|
||||
}
|
||||
|
@ -665,12 +665,12 @@ function operationCallback (socket, operation) {
|
|||
if (!note.authors[userId]) {
|
||||
models.Author.findOrCreate({
|
||||
where: {
|
||||
noteId: noteId,
|
||||
userId: userId
|
||||
noteId,
|
||||
userId
|
||||
},
|
||||
defaults: {
|
||||
noteId: noteId,
|
||||
userId: userId,
|
||||
noteId,
|
||||
userId,
|
||||
color: user.color
|
||||
}
|
||||
}).spread(function (author, created) {
|
||||
|
@ -739,7 +739,7 @@ function connection (socket) {
|
|||
id: socket.id,
|
||||
address: socket.handshake.headers['x-forwarded-for'] || socket.handshake.address,
|
||||
'user-agent': socket.handshake.headers['user-agent'],
|
||||
color: color,
|
||||
color,
|
||||
cursor: null,
|
||||
login: false,
|
||||
userid: null,
|
||||
|
@ -784,7 +784,7 @@ function connection (socket) {
|
|||
if (permission === 'freely' && !config.allowAnonymous && !config.allowAnonymousEdits) return
|
||||
note.permission = permission
|
||||
models.Note.update({
|
||||
permission: permission
|
||||
permission
|
||||
}, {
|
||||
where: {
|
||||
id: noteId
|
||||
|
@ -794,7 +794,7 @@ function connection (socket) {
|
|||
return
|
||||
}
|
||||
const out = {
|
||||
permission: permission
|
||||
permission
|
||||
}
|
||||
realtime.io.to(note.id).emit('permission', out)
|
||||
for (let i = 0, l = note.socks.length; i < l; i++) {
|
||||
|
@ -870,7 +870,7 @@ function connection (socket) {
|
|||
if (user) { users.push(buildUserOutData(user)) }
|
||||
})
|
||||
const out = {
|
||||
users: users
|
||||
users
|
||||
}
|
||||
socket.emit('online users', out)
|
||||
})
|
||||
|
|
|
@ -13,9 +13,9 @@ const errors = require('./errors')
|
|||
|
||||
// public
|
||||
const response = {
|
||||
showIndex: showIndex,
|
||||
githubActions: githubActions,
|
||||
gitlabActions: gitlabActions
|
||||
showIndex,
|
||||
githubActions,
|
||||
gitlabActions
|
||||
}
|
||||
|
||||
function showIndex (req, res, next) {
|
||||
|
@ -29,7 +29,7 @@ function showIndex (req, res, next) {
|
|||
imprint: fs.existsSync(path.join(config.docsPath, 'imprint.md')),
|
||||
privacyStatement: fs.existsSync(path.join(config.docsPath, 'privacy.md')),
|
||||
termsOfUse: fs.existsSync(path.join(config.docsPath, 'terms-of-use.md')),
|
||||
deleteToken: deleteToken
|
||||
deleteToken
|
||||
}
|
||||
|
||||
if (authStatus) {
|
||||
|
@ -72,8 +72,8 @@ function githubActionGist (req, res, note) {
|
|||
const data = {
|
||||
client_id: config.github.clientID,
|
||||
client_secret: config.github.clientSecret,
|
||||
code: code,
|
||||
state: state
|
||||
code,
|
||||
state
|
||||
}
|
||||
const authUrl = 'https://github.com/login/oauth/access_token'
|
||||
fetch(authUrl, {
|
||||
|
@ -100,7 +100,7 @@ function githubActionGist (req, res, note) {
|
|||
files: {}
|
||||
}
|
||||
gist.files[filename] = {
|
||||
content: content
|
||||
content
|
||||
}
|
||||
const gistUrl = 'https://api.github.com/gists'
|
||||
return fetch(gistUrl, {
|
||||
|
|
|
@ -18,7 +18,7 @@ passport.use(new LocalStrategy({
|
|||
if (!validator.isEmail(email)) return done(null, false)
|
||||
models.User.findOne({
|
||||
where: {
|
||||
email: email
|
||||
email
|
||||
}
|
||||
}).then(function (user) {
|
||||
if (!user) return done(null, false)
|
||||
|
|
|
@ -18,7 +18,7 @@ passport.serializeUser(function (user, done) {
|
|||
passport.deserializeUser(function (id, done) {
|
||||
models.User.findOne({
|
||||
where: {
|
||||
id: id
|
||||
id
|
||||
}
|
||||
}).then(function (user) {
|
||||
// Don't die on non-existent user
|
||||
|
|
|
@ -41,7 +41,7 @@ passport.use(new LDAPStrategy({
|
|||
|
||||
const profile = {
|
||||
id: 'LDAP-' + uuid,
|
||||
username: username,
|
||||
username,
|
||||
displayName: user.displayName,
|
||||
emails: user.mail ? Array.isArray(user.mail) ? user.mail : [user.mail] : [],
|
||||
avatarUrl: null,
|
||||
|
|
|
@ -60,8 +60,8 @@ function parseProfile (data) {
|
|||
|
||||
return {
|
||||
id: id || username,
|
||||
username: username,
|
||||
displayName: displayName,
|
||||
username,
|
||||
displayName,
|
||||
emails: email ? [email] : []
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ exports.passportGeneralCallback = function callback (accessToken, refreshToken,
|
|||
},
|
||||
defaults: {
|
||||
profile: stringifiedProfile,
|
||||
accessToken: accessToken,
|
||||
refreshToken: refreshToken
|
||||
accessToken,
|
||||
refreshToken
|
||||
}
|
||||
}).spread(function (user, created) {
|
||||
if (user) {
|
||||
|
|
|
@ -18,8 +18,8 @@ exports.getInfo = function getInfo (req, res, note) {
|
|||
title: meta.title || title,
|
||||
description: meta.description || (markdown ? models.Note.generateDescription(markdown) : null),
|
||||
viewcount: note.viewcount,
|
||||
createtime: createtime,
|
||||
updatetime: updatetime
|
||||
createtime,
|
||||
updatetime
|
||||
}
|
||||
res.set({
|
||||
'Access-Control-Allow-Origin': '*', // allow CORS as API
|
||||
|
|
|
@ -75,8 +75,8 @@ exports.showNote = function (req, res, next) {
|
|||
'X-Robots-Tag': 'noindex, nofollow' // prevent crawling
|
||||
})
|
||||
return res.render('hedgedoc.ejs', {
|
||||
title: title,
|
||||
opengraph: opengraph
|
||||
title,
|
||||
opengraph
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
@ -98,12 +98,12 @@ exports.getPublishData = function (req, res, note, callback) {
|
|||
title = models.Note.generateWebTitle(meta.title || title)
|
||||
const ogdata = models.Note.parseOpengraph(meta, title)
|
||||
const data = {
|
||||
title: title,
|
||||
title,
|
||||
description: meta.description || (markdown ? models.Note.generateDescription(markdown) : null),
|
||||
lang: meta.lang || null,
|
||||
viewcount: note.viewcount,
|
||||
createtime: createtime,
|
||||
updatetime: updatetime,
|
||||
createtime,
|
||||
updatetime,
|
||||
body: markdown,
|
||||
theme: meta.slideOptions && isRevealTheme(meta.slideOptions.theme),
|
||||
meta: JSON.stringify(extracted.meta),
|
||||
|
|
|
@ -70,7 +70,7 @@ statusRouter.post('/temp', urlencodedParser, function (req, res) {
|
|||
} else {
|
||||
logger.debug(`SERVER received temp from [${host}]: ${req.body.data}`)
|
||||
models.Temp.create({
|
||||
data: data
|
||||
data
|
||||
}).then(function (temp) {
|
||||
if (temp) {
|
||||
res.header('Access-Control-Allow-Origin', '*')
|
||||
|
|
|
@ -49,7 +49,7 @@ process.on('message', function (data) {
|
|||
const result = getRevision(data.revisions, data.count)
|
||||
process.send({
|
||||
msg: 'check',
|
||||
result: result,
|
||||
result,
|
||||
cacheKey: data.cacheKey
|
||||
})
|
||||
} catch (err) {
|
||||
|
@ -128,7 +128,7 @@ function getRevision (revisions, count) {
|
|||
const data = {
|
||||
content: finalContent,
|
||||
patch: dmp.patch_fromText(lastPatch),
|
||||
authorship: authorship
|
||||
authorship
|
||||
}
|
||||
const msEnd = new Date().getTime()
|
||||
logger.debug(msEnd - msStart + 'ms')
|
||||
|
|
|
@ -220,7 +220,7 @@ export function getStorageHistory (callback) {
|
|||
if (typeof data === 'string') { data = JSON.parse(data) }
|
||||
callback(data)
|
||||
}
|
||||
// eslint-disable-next-line node/no-callback-literal
|
||||
// eslint-disable-next-line n/no-callback-literal
|
||||
callback([])
|
||||
}
|
||||
|
||||
|
|
|
@ -1230,7 +1230,7 @@ ui.toolbar.export.dropbox.click(function (event) {
|
|||
files: [
|
||||
{
|
||||
url: noteurl + '/download',
|
||||
filename: filename
|
||||
filename
|
||||
}
|
||||
],
|
||||
error: function (errorMessage) {
|
||||
|
@ -1538,7 +1538,7 @@ function initRevisionViewer () {
|
|||
const revisionViewerTextArea = document.getElementById('revisionViewer')
|
||||
revisionViewer = CodeMirror.fromTextArea(revisionViewerTextArea, {
|
||||
mode: defaultEditorMode,
|
||||
viewportMargin: viewportMargin,
|
||||
viewportMargin,
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
showCursorWhenSelecting: true,
|
||||
|
@ -2005,7 +2005,7 @@ function importFromUrl (url) {
|
|||
}
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
url: url,
|
||||
url,
|
||||
success: function (data) {
|
||||
const extension = url.split('.').pop()
|
||||
if (extension === 'html') {
|
||||
|
@ -2999,7 +2999,7 @@ function emitUserStatus (force) {
|
|||
|
||||
const userStatus = {
|
||||
idle: idle.isAway,
|
||||
type: type
|
||||
type
|
||||
}
|
||||
|
||||
if (force || JSON.stringify(userStatus) !== JSON.stringify(userStatusCache)) {
|
||||
|
|
|
@ -99,7 +99,7 @@ export default class Editor {
|
|||
const ch = match[1].length
|
||||
const pos = {
|
||||
line: cursor.line,
|
||||
ch: ch
|
||||
ch
|
||||
}
|
||||
if (cm.getOption('indentWithTabs')) {
|
||||
cm.replaceRange(tab, pos, pos, '+input')
|
||||
|
@ -618,7 +618,7 @@ export default class Editor {
|
|||
mode: defaultEditorMode,
|
||||
backdrop: defaultEditorMode,
|
||||
keyMap: 'sublime',
|
||||
viewportMargin: viewportMargin,
|
||||
viewportMargin,
|
||||
styleActiveLine: true,
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
|
|
|
@ -36,7 +36,7 @@ whiteList.figcaption = []
|
|||
|
||||
const filterXSSOptions = {
|
||||
allowCommentTag: true,
|
||||
whiteList: whiteList,
|
||||
whiteList,
|
||||
escapeHtml: function (html) {
|
||||
// allow html comment in multiple lines
|
||||
return html.replace(/<(?!!--)/g, '<').replace(/-->/g, '__HTML_COMMENT_END__').replace(/>/g, '>').replace(/__HTML_COMMENT_END__/g, '-->')
|
||||
|
@ -73,6 +73,6 @@ function preventXSS (html) {
|
|||
window.preventXSS = preventXSS
|
||||
|
||||
module.exports = {
|
||||
preventXSS: preventXSS,
|
||||
preventXSS,
|
||||
escapeAttrValue: filterXSS.escapeAttrValue
|
||||
}
|
||||
|
|
|
@ -348,8 +348,8 @@ import { md } from './extra'
|
|||
convertSlides()
|
||||
},
|
||||
// TODO: Do these belong in the API?
|
||||
processSlides: processSlides,
|
||||
convertSlides: convertSlides,
|
||||
slidify: slidify
|
||||
processSlides,
|
||||
convertSlides,
|
||||
slidify
|
||||
}
|
||||
}))
|
||||
|
|
Loading…
Reference in a new issue