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
|
@ -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) => {
|
||||
|
@ -112,7 +104,7 @@ function GetApp(): ModuleType {
|
|||
// --------------------------------------------------------------
|
||||
|
||||
// to be backwards compatible
|
||||
app.get('/ask', function(req: Request, res) {
|
||||
app.get('/ask', function (req: Request, res) {
|
||||
logger.DebugLog(`Qmining module ask redirect`, 'ask', 1)
|
||||
res.redirect(
|
||||
`http://api.frylabs.net/ask?q=${req.query.q}&subj=${req.query.subj}&data=${req.query.data}`
|
||||
|
@ -192,7 +184,7 @@ function GetApp(): ModuleType {
|
|||
]
|
||||
|
||||
simpleRedirects.forEach((redirect) => {
|
||||
app.get(redirect.from, function(req: Request, res) {
|
||||
app.get(redirect.from, function (req: Request, res) {
|
||||
if (!redirect.nolog) {
|
||||
logger.LogReq(req)
|
||||
}
|
||||
|
@ -220,7 +212,7 @@ function GetApp(): ModuleType {
|
|||
|
||||
routes.forEach((route) => {
|
||||
logger.DebugLog(`Added route /${route}`, 'Qmining routes', 1)
|
||||
app.get(`/${route}`, function(req: Request, res) {
|
||||
app.get(`/${route}`, function (req: Request, res) {
|
||||
res.redirect(
|
||||
utils.formatUrl({
|
||||
pathname: `${route}.html`,
|
||||
|
@ -234,16 +226,16 @@ function GetApp(): ModuleType {
|
|||
|
||||
// --------------------------------------------------------------
|
||||
|
||||
app.get('/', function(req: Request, res) {
|
||||
app.get('/', function (req: Request, res) {
|
||||
res.end('hai')
|
||||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
app.get('*', function(req: Request, res) {
|
||||
app.get('*', function (req: Request, res) {
|
||||
res.status(404).render('404')
|
||||
})
|
||||
|
||||
app.post('*', function(req: Request, res) {
|
||||
app.post('*', function (req: Request, res) {
|
||||
res.status(404).render('404')
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue