mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Changed auth exceptions, saving question from /ask if its matches are less than 90%
This commit is contained in:
parent
d5f6f22262
commit
742f8866c7
3 changed files with 24 additions and 28 deletions
|
@ -19,7 +19,8 @@
|
||||||
"nextdir": "nextStatic/qminingPagePublic",
|
"nextdir": "nextStatic/qminingPagePublic",
|
||||||
"name": "qmining",
|
"name": "qmining",
|
||||||
"urls": [
|
"urls": [
|
||||||
"qmining.frylabs.net"
|
"qmining.frylabs.net",
|
||||||
|
"localhost"
|
||||||
],
|
],
|
||||||
"isNextJs": true
|
"isNextJs": true
|
||||||
},
|
},
|
||||||
|
@ -30,9 +31,7 @@
|
||||||
],
|
],
|
||||||
"name": "api",
|
"name": "api",
|
||||||
"urls": [
|
"urls": [
|
||||||
"api.frylabs.net",
|
"api.frylabs.net"
|
||||||
"localhost",
|
|
||||||
"superhedghog.frylabs.net"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
|
|
|
@ -604,7 +604,11 @@ function setup(data: SubmoduleData): any {
|
||||||
res.json(response)
|
res.json(response)
|
||||||
|
|
||||||
const saveableQuestions = response.reduce((acc, res) => {
|
const saveableQuestions = response.reduce((acc, res) => {
|
||||||
if (res.answers.length === 0) {
|
const save = res.answers.every((answer) => {
|
||||||
|
return answer.match < 90
|
||||||
|
})
|
||||||
|
|
||||||
|
if (save) {
|
||||||
acc.push(res.question)
|
acc.push(res.question)
|
||||||
}
|
}
|
||||||
return acc
|
return acc
|
||||||
|
@ -621,6 +625,7 @@ function setup(data: SubmoduleData): any {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get('/ask', function (req: Request, res) {
|
app.get('/ask', function (req: Request, res) {
|
||||||
if (Object.keys(req.query).length === 0) {
|
if (Object.keys(req.query).length === 0) {
|
||||||
logger.DebugLog(`No query params /ask GET`, 'ask', 1)
|
logger.DebugLog(`No query params /ask GET`, 'ask', 1)
|
||||||
|
|
|
@ -54,15 +54,7 @@ function GetApp(): ModuleType {
|
||||||
auth({
|
auth({
|
||||||
userDB: userDB,
|
userDB: userDB,
|
||||||
jsonResponse: false,
|
jsonResponse: false,
|
||||||
exceptions: [
|
exceptions: ['/favicon.ico', '/img/'],
|
||||||
'/thanks',
|
|
||||||
'/thanks.html',
|
|
||||||
'/img/thanks.gif',
|
|
||||||
'/favicon.ico',
|
|
||||||
'/moodle-test-userscript/stable.user.js',
|
|
||||||
'/irc',
|
|
||||||
'/donate',
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
app.use((req: Request, res, next) => {
|
app.use((req: Request, res, next) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue