2020-01-04 21:59:57 +00:00
|
|
|
'use strict'
|
|
|
|
|
2020-01-04 22:30:23 +00:00
|
|
|
const realtime = require('../realtime/realtime')
|
|
|
|
const config = require('../config')
|
2020-01-04 21:59:57 +00:00
|
|
|
|
|
|
|
exports.getStatus = async (req, res) => {
|
|
|
|
res.set({
|
|
|
|
'Cache-Control': 'private', // only cache by client
|
|
|
|
'X-Robots-Tag': 'noindex, nofollow', // prevent crawling
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
})
|
2020-05-16 19:25:57 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
const data = await realtime.getStatus()
|
|
|
|
res.send(data)
|
|
|
|
} catch (e) {
|
|
|
|
console.error(e)
|
|
|
|
res.status(500).send(e.toString())
|
|
|
|
}
|
2020-01-04 21:59:57 +00:00
|
|
|
}
|
|
|
|
|
2020-04-28 01:13:16 +00:00
|
|
|
exports.getMetrics = async (req, res) => {
|
|
|
|
const data = await realtime.getStatus()
|
|
|
|
|
|
|
|
res.set({
|
|
|
|
'Cache-Control': 'private', // only cache by client
|
|
|
|
'X-Robots-Tag': 'noindex, nofollow', // prevent crawling
|
|
|
|
'Content-Type': 'text/plain; charset=utf-8'
|
|
|
|
})
|
|
|
|
res.render('../js/lib/common/metrics.ejs', data)
|
|
|
|
}
|
|
|
|
|
2020-01-04 21:59:57 +00:00
|
|
|
exports.getConfig = (req, res) => {
|
|
|
|
const data = {
|
|
|
|
domain: config.domain,
|
|
|
|
urlpath: config.urlPath,
|
|
|
|
debug: config.debug,
|
|
|
|
version: config.fullversion,
|
|
|
|
plantumlServer: config.plantuml.server,
|
|
|
|
DROPBOX_APP_KEY: config.dropbox.appKey,
|
|
|
|
allowedUploadMimeTypes: config.allowedUploadMimeTypes,
|
|
|
|
defaultUseHardbreak: config.defaultUseHardbreak,
|
2020-01-31 09:51:14 +00:00
|
|
|
linkifyHeaderStyle: config.linkifyHeaderStyle,
|
|
|
|
useCDN: config.useCDN
|
2020-01-04 21:59:57 +00:00
|
|
|
}
|
|
|
|
res.set({
|
|
|
|
'Cache-Control': 'private', // only cache by client
|
|
|
|
'X-Robots-Tag': 'noindex, nofollow', // prevent crawling
|
|
|
|
'Content-Type': 'application/javascript'
|
|
|
|
})
|
|
|
|
res.render('../js/lib/common/constant.ejs', data)
|
|
|
|
}
|