refactor: global namespace + admin pages UI
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// Auth0 Account
|
||||
@@ -19,7 +19,7 @@ module.exports = {
|
||||
clientSecret: conf.clientSecret,
|
||||
callbackURL: conf.callbackURL
|
||||
}, function (accessToken, refreshToken, profile, cb) {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
WIKI.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// Azure AD Account
|
||||
@@ -24,7 +24,7 @@ module.exports = {
|
||||
let waadProfile = jwt.decode(params.id_token)
|
||||
waadProfile.id = waadProfile.oid
|
||||
waadProfile.provider = 'azure'
|
||||
wiki.db.User.processProfile(waadProfile).then((user) => {
|
||||
WIKI.db.User.processProfile(waadProfile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// Discord Account
|
||||
@@ -19,7 +19,7 @@ module.exports = {
|
||||
callbackURL: conf.callbackURL,
|
||||
scope: 'identify email'
|
||||
}, function (accessToken, refreshToken, profile, cb) {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
WIKI.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// Dropbox Account
|
||||
@@ -19,7 +19,7 @@ module.exports = {
|
||||
clientSecret: conf.clientSecret,
|
||||
callbackURL: conf.callbackURL
|
||||
}, (accessToken, refreshToken, profile, cb) => {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
WIKI.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// Facebook Account
|
||||
@@ -19,7 +19,7 @@ module.exports = {
|
||||
callbackURL: conf.callbackURL,
|
||||
profileFields: ['id', 'displayName', 'email']
|
||||
}, function (accessToken, refreshToken, profile, cb) {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
WIKI.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// GitHub Account
|
||||
@@ -19,7 +19,7 @@ module.exports = {
|
||||
callbackURL: conf.callbackURL,
|
||||
scope: ['user:email']
|
||||
}, (accessToken, refreshToken, profile, cb) => {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
WIKI.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// Google ID Account
|
||||
@@ -18,7 +18,7 @@ module.exports = {
|
||||
clientSecret: conf.clientSecret,
|
||||
callbackURL: conf.callbackURL
|
||||
}, (accessToken, refreshToken, profile, cb) => {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
WIKI.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// LDAP Account
|
||||
@@ -33,7 +33,7 @@ module.exports = {
|
||||
}, (profile, cb) => {
|
||||
profile.provider = 'ldap'
|
||||
profile.id = profile.dn
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
WIKI.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// Local Account
|
||||
@@ -17,7 +17,7 @@ module.exports = {
|
||||
usernameField: 'email',
|
||||
passwordField: 'password'
|
||||
}, (uEmail, uPassword, done) => {
|
||||
wiki.db.User.findOne({
|
||||
WIKI.db.User.findOne({
|
||||
where: {
|
||||
email: uEmail,
|
||||
provider: 'local'
|
||||
@@ -30,7 +30,7 @@ module.exports = {
|
||||
return done(err, null)
|
||||
})
|
||||
} else {
|
||||
return done(new wiki.Error.AuthLoginFailed(), null)
|
||||
return done(new WIKI.Error.AuthLoginFailed(), null)
|
||||
}
|
||||
}).catch((err) => {
|
||||
done(err, null)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// Microsoft Account
|
||||
@@ -18,7 +18,7 @@ module.exports = {
|
||||
clientSecret: conf.clientSecret,
|
||||
callbackURL: conf.callbackURL
|
||||
}, function (accessToken, refreshToken, profile, cb) {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
WIKI.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// OAuth2 Account
|
||||
@@ -20,7 +20,7 @@ module.exports = {
|
||||
clientSecret: conf.clientSecret,
|
||||
callbackURL: conf.callbackURL
|
||||
}, (accessToken, refreshToken, profile, cb) => {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
WIKI.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// Slack Account
|
||||
@@ -18,7 +18,7 @@ module.exports = {
|
||||
clientSecret: conf.clientSecret,
|
||||
callbackURL: conf.callbackURL
|
||||
}, (accessToken, refreshToken, profile, cb) => {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
WIKI.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// Twitch Account
|
||||
@@ -19,7 +19,7 @@ module.exports = {
|
||||
callbackURL: conf.callbackURL,
|
||||
scope: 'user_read'
|
||||
}, function (accessToken, refreshToken, profile, cb) {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
WIKI.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const winston = require('winston')
|
||||
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// Console
|
||||
@@ -12,7 +12,7 @@ module.exports = {
|
||||
props: [],
|
||||
init (logger, conf) {
|
||||
logger.add(winston.transports.Console, {
|
||||
level: wiki.config.logLevel,
|
||||
level: WIKI.config.logLevel,
|
||||
prettyPrint: true,
|
||||
colorize: true,
|
||||
silent: false,
|
||||
|
||||
@@ -5,7 +5,7 @@ const _ = require('lodash')
|
||||
// Mathjax
|
||||
// ------------------------------------
|
||||
|
||||
/* global wiki */
|
||||
/* global WIKI */
|
||||
|
||||
const mathRegex = [
|
||||
{
|
||||
@@ -67,7 +67,7 @@ module.exports = {
|
||||
resolve(result.svg)
|
||||
} else {
|
||||
resolve(currentMatch[0])
|
||||
wiki.logger.warn(result.errors.join(', '))
|
||||
WIKI.logger.warn(result.errors.join(', '))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user