Changed auth exceptions, saving question from /ask if its matches are less than 90%

This commit is contained in:
mrfry 2021-04-30 16:08:34 +02:00
parent d5f6f22262
commit 742f8866c7
3 changed files with 24 additions and 28 deletions

View file

@ -19,7 +19,8 @@
"nextdir": "nextStatic/qminingPagePublic",
"name": "qmining",
"urls": [
"qmining.frylabs.net"
"qmining.frylabs.net",
"localhost"
],
"isNextJs": true
},
@ -30,9 +31,7 @@
],
"name": "api",
"urls": [
"api.frylabs.net",
"localhost",
"superhedghog.frylabs.net"
"api.frylabs.net"
]
},
"main": {

View file

@ -604,7 +604,11 @@ function setup(data: SubmoduleData): any {
res.json(response)
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)
}
return acc
@ -621,6 +625,7 @@ function setup(data: SubmoduleData): any {
}
})
})
app.get('/ask', function (req: Request, res) {
if (Object.keys(req.query).length === 0) {
logger.DebugLog(`No query params /ask GET`, 'ask', 1)

View file

@ -54,15 +54,7 @@ function GetApp(): ModuleType {
auth({
userDB: userDB,
jsonResponse: false,
exceptions: [
'/thanks',
'/thanks.html',
'/img/thanks.gif',
'/favicon.ico',
'/moodle-test-userscript/stable.user.js',
'/irc',
'/donate',
],
exceptions: ['/favicon.ico', '/img/'],
})
)
app.use((req: Request, res, next) => {