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", "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": {

View file

@ -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)

View file

@ -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) => {