System Settings UI + code cleanup
This commit is contained in:
parent
007ad30cc6
commit
5223368e37
@ -40,8 +40,7 @@
|
|||||||
"CORE_PATH": true,
|
"CORE_PATH": true,
|
||||||
"ROOTPATH": true,
|
"ROOTPATH": true,
|
||||||
"IS_DEBUG": true,
|
"IS_DEBUG": true,
|
||||||
"PROCNAME": true,
|
"PROCNAME": true
|
||||||
"WSInternalKey": true
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"rules": {
|
"rules": {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
# This is reserved for system use!
|
# This is reserved for system use!
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
name: Wiki.js
|
name: Wiki.js
|
||||||
|
version: v1.0-beta.5
|
||||||
capabilities:
|
capabilities:
|
||||||
guest: true
|
guest: true
|
||||||
rights: true
|
rights: true
|
||||||
|
File diff suppressed because one or more lines are too long
@ -5,6 +5,8 @@ var router = express.Router()
|
|||||||
const Promise = require('bluebird')
|
const Promise = require('bluebird')
|
||||||
const validator = require('validator')
|
const validator = require('validator')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
|
const axios = require('axios')
|
||||||
|
const moment = require('moment')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Admin
|
* Admin
|
||||||
@ -218,7 +220,18 @@ router.get('/settings', (req, res) => {
|
|||||||
return res.render('error-forbidden')
|
return res.render('error-forbidden')
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render('pages/admin/settings', { adminTab: 'settings' })
|
axios.get('https://api.github.com/repos/Requarks/wiki/releases/latest').then(resp => {
|
||||||
|
let sysversion = {
|
||||||
|
current: appdata.version,
|
||||||
|
latest: resp.data.tag_name,
|
||||||
|
latestPublishedAt: resp.data.published_at
|
||||||
|
}
|
||||||
|
|
||||||
|
res.render('pages/admin/settings', { adminTab: 'settings', sysversion })
|
||||||
|
}).catch(err => {
|
||||||
|
winston.warn(err)
|
||||||
|
res.render('pages/admin/settings', { adminTab: 'settings', sysversion: { current: appdata.version } })
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
@ -371,14 +371,13 @@ module.exports = {
|
|||||||
|
|
||||||
// Delete old index entry
|
// Delete old index entry
|
||||||
|
|
||||||
ws.emit('searchDel', {
|
search.delete(entryPath)
|
||||||
auth: WSInternalKey,
|
|
||||||
entryPath
|
|
||||||
})
|
|
||||||
|
|
||||||
// Create cache for new entry
|
// Create cache for new entry
|
||||||
|
|
||||||
return self.updateCache(newEntryPath)
|
return self.updateCache(newEntryPath).then(entry => {
|
||||||
|
return search.add(entry)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
|
|
||||||
const crypto = require('crypto')
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal Authentication
|
|
||||||
*/
|
|
||||||
module.exports = {
|
|
||||||
|
|
||||||
_curKey: false,
|
|
||||||
|
|
||||||
init (inKey) {
|
|
||||||
this._curKey = inKey
|
|
||||||
|
|
||||||
return this
|
|
||||||
},
|
|
||||||
|
|
||||||
generateKey () {
|
|
||||||
return crypto.randomBytes(20).toString('hex')
|
|
||||||
},
|
|
||||||
|
|
||||||
validateKey (inKey) {
|
|
||||||
return inKey === this._curKey
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -33,6 +33,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"auto-load": "^2.1.0",
|
"auto-load": "^2.1.0",
|
||||||
|
"axios": "^0.15.3",
|
||||||
"bcryptjs-then": "^1.0.1",
|
"bcryptjs-then": "^1.0.1",
|
||||||
"bluebird": "^3.4.7",
|
"bluebird": "^3.4.7",
|
||||||
"body-parser": "^1.15.2",
|
"body-parser": "^1.15.2",
|
||||||
@ -156,8 +157,7 @@
|
|||||||
"CORE_PATH",
|
"CORE_PATH",
|
||||||
"ROOTPATH",
|
"ROOTPATH",
|
||||||
"IS_DEBUG",
|
"IS_DEBUG",
|
||||||
"PROCNAME",
|
"PROCNAME"
|
||||||
"WSInternalKey"
|
|
||||||
],
|
],
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"assets/**/*",
|
"assets/**/*",
|
||||||
|
@ -64,9 +64,6 @@ const socketio = require('socket.io')
|
|||||||
|
|
||||||
var mw = autoload(CORE_PATH + '/core-middlewares')
|
var mw = autoload(CORE_PATH + '/core-middlewares')
|
||||||
var ctrl = autoload(path.join(ROOTPATH, '/controllers'))
|
var ctrl = autoload(path.join(ROOTPATH, '/controllers'))
|
||||||
var libInternalAuth = require('./libs/internalAuth')
|
|
||||||
|
|
||||||
global.WSInternalKey = libInternalAuth.generateKey()
|
|
||||||
|
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
// Define Express App
|
// Define Express App
|
||||||
|
@ -49,7 +49,7 @@ block content
|
|||||||
li
|
li
|
||||||
a(href='/admin/settings')
|
a(href='/admin/settings')
|
||||||
i.icon-cog
|
i.icon-cog
|
||||||
span Site Settings
|
span System Settings
|
||||||
li
|
li
|
||||||
a(href='/logout')
|
a(href='/logout')
|
||||||
i.icon-delete2
|
i.icon-delete2
|
||||||
|
@ -2,8 +2,35 @@ extends ./_layout.pug
|
|||||||
|
|
||||||
block adminContent
|
block adminContent
|
||||||
.hero
|
.hero
|
||||||
h1.title#title Site Settings
|
h1.title#title System Settings
|
||||||
h2.subtitle Manage site configuration
|
h2.subtitle Manage site configuration
|
||||||
.form-sections
|
.form-sections
|
||||||
section
|
section
|
||||||
| Coming soon
|
label.label System Version
|
||||||
|
.section-block
|
||||||
|
p Current Version: #[strong= sysversion.current]
|
||||||
|
if sysversion.latest
|
||||||
|
p Latest Version: #[strong= sysversion.latest] #[em (Published #{userMoment(sysversion.latestPublishedAt).fromNow()})]
|
||||||
|
p
|
||||||
|
if sysversion.current !== sysversion.latest
|
||||||
|
button.button.is-deep-orange Upgrade
|
||||||
|
else
|
||||||
|
button.button.is-disabled Upgrade
|
||||||
|
button.button.is-deep-orange.is-outlined Re-install current version
|
||||||
|
else
|
||||||
|
p: em Unable to query latest version. Try again later.
|
||||||
|
section
|
||||||
|
label.label Administrative Tools
|
||||||
|
.section-block
|
||||||
|
h6 Flush cache and rebuild indexes:
|
||||||
|
p.is-small If content or search results seems out-of-date or do not include latest content, flushing the cache can help resolve these issues.
|
||||||
|
p: button.button.is-teal.is-outlined Flush and Rebuild
|
||||||
|
h6 Reset the root administrator and guest accounts to defaults:
|
||||||
|
p.is-small
|
||||||
|
| The root administrator account will be reset to the email address in the configuration file and the password will be reinitialized to #[strong admin123].
|
||||||
|
br
|
||||||
|
| The guest account will be recreated with its access rights set to defaults.
|
||||||
|
p: button.button.is-teal.is-outlined Reset System Accounts
|
||||||
|
h6 Flush all active user sessions:
|
||||||
|
p.is-small All users will be logged out and forced to login again. Your current session will also be affected!
|
||||||
|
p: button.button.is-teal.is-outlined Flush Sessions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user