mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Removed views
This commit is contained in:
parent
8189ddf362
commit
f26d61a209
11 changed files with 7 additions and 603 deletions
modules/qmining
|
@ -96,20 +96,7 @@ Load()
|
|||
// --------------------------------------------------------------
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
// req.hostname
|
||||
|
||||
let motd = ''
|
||||
try {
|
||||
motd = utils.ReadFile(motdFile)
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
res.render('main', {
|
||||
siteurl: url,
|
||||
qa: actions.ProcessQA(),
|
||||
motd: motd
|
||||
})
|
||||
res.end()
|
||||
res.end('hai')
|
||||
})
|
||||
|
||||
app.get('/manual', function (req, res) {
|
||||
|
@ -118,76 +105,19 @@ app.get('/manual', function (req, res) {
|
|||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
app.get('/legacy', function (req, res) {
|
||||
let qcount = data.Subjects.reduce((acc, currItem) => {
|
||||
acc += currItem.length
|
||||
return acc
|
||||
}, 0)
|
||||
let scount = data.length
|
||||
|
||||
let grouped = data.Subjects.reduce((res, s) => {
|
||||
let sName = s.getSubjNameWithoutYear()
|
||||
if (sName) {
|
||||
if (!res[sName]) {
|
||||
res[sName] = []
|
||||
}
|
||||
res[sName].push(s)
|
||||
} else {
|
||||
res.others.push(s)
|
||||
}
|
||||
return res
|
||||
}, {
|
||||
others: []
|
||||
})
|
||||
|
||||
const ordered = {}
|
||||
Object.keys(grouped).sort().forEach((key) => {
|
||||
ordered[key] = grouped[key]
|
||||
})
|
||||
|
||||
res.render('alldata', {
|
||||
data: data,
|
||||
orderedData: ordered,
|
||||
scount: scount,
|
||||
qcount: qcount,
|
||||
siteurl: url
|
||||
})
|
||||
|
||||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
app.post('/postfeedback', function (req, res) {
|
||||
res.redirect('back')
|
||||
logger.Log('New feedback message', logger.GetColor('bluebg'), true)
|
||||
utils.AppendToFile('\n\n' + logger.GetDateString() + ': ' + req.body.message_field, msgFile)
|
||||
})
|
||||
|
||||
app.get('/postfeedback', function (req, res) {
|
||||
res.redirect('/')
|
||||
})
|
||||
|
||||
app.get('/lred', function (req, res) {
|
||||
res.redirect('/legacy')
|
||||
res.redirect('/legacy') // TODO: redirect to react legacy
|
||||
res.end()
|
||||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
app.get('/menuClick', function (req, res) {
|
||||
res.redirect('/')
|
||||
res.end()
|
||||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
// all questions readable
|
||||
app.get('/allqr', function (req, res) {
|
||||
res.render('allqr', {
|
||||
d: data.toString().split('\n')
|
||||
})
|
||||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
app.get('/greasy', function (req, res) {
|
||||
res.redirect('https://greasyfork.org/en/scripts/38999-moodle-elearning-kmooc-test-help')
|
||||
res.redirect('/') // TODO: redirect to react /
|
||||
res.end()
|
||||
logger.LogReq(req)
|
||||
})
|
||||
|
@ -205,7 +135,7 @@ app.get('/donate', function (req, res) {
|
|||
})
|
||||
|
||||
app.get('/thanks', function (req, res) {
|
||||
res.render('thanks', {
|
||||
res.render('thanks', { // TODO: redirect to react thanks
|
||||
siteurl: url
|
||||
})
|
||||
res.end()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue