mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Added Request type with cookies and session, and fixed stuff that it broke
This commit is contained in:
parent
865e97a754
commit
3b902d736f
9 changed files with 117 additions and 95 deletions
|
@ -29,7 +29,7 @@ import utils from '../../utils/utils'
|
|||
import logger from '../../utils/logger'
|
||||
import auth from '../../middlewares/auth.middleware'
|
||||
import { SetupData } from '../../server'
|
||||
import { ModuleType } from '../../types/basicTypes'
|
||||
import { ModuleType, Request } from '../../types/basicTypes'
|
||||
|
||||
// stuff gotten from server.js
|
||||
let publicdirs = []
|
||||
|
@ -104,7 +104,7 @@ function GetApp(): ModuleType {
|
|||
// --------------------------------------------------------------
|
||||
|
||||
// to be backwards compatible
|
||||
app.get('/ask', function(req, 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}`
|
||||
|
@ -173,7 +173,7 @@ function GetApp(): ModuleType {
|
|||
]
|
||||
|
||||
simpleRedirects.forEach((redirect) => {
|
||||
app.get(redirect.from, function(req, res) {
|
||||
app.get(redirect.from, function(req: Request, res) {
|
||||
if (!redirect.nolog) {
|
||||
logger.LogReq(req)
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ function GetApp(): ModuleType {
|
|||
|
||||
routes.forEach((route) => {
|
||||
logger.DebugLog(`Added route /${route}`, 'Qmining routes', 1)
|
||||
app.get(`/${route}`, function(req: express.Request, res) {
|
||||
app.get(`/${route}`, function(req: Request, res) {
|
||||
logger.LogReq(req)
|
||||
res.redirect(
|
||||
utils.formatUrl({
|
||||
|
@ -216,12 +216,12 @@ function GetApp(): ModuleType {
|
|||
|
||||
// --------------------------------------------------------------
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
app.get('/', function(req: Request, res) {
|
||||
res.end('hai')
|
||||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
app.get('/getVeteranPw', function(req, res) {
|
||||
app.get('/getVeteranPw', function(req: Request, res) {
|
||||
res.render('veteranPw', {
|
||||
cid: req.query.cid || '',
|
||||
devel: process.env.NS_DEVEL,
|
||||
|
@ -229,11 +229,11 @@ function GetApp(): ModuleType {
|
|||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
app.get('*', function(req, res) {
|
||||
app.get('*', function(req: Request, res) {
|
||||
res.status(404).render('404')
|
||||
})
|
||||
|
||||
app.post('*', function(req, res) {
|
||||
app.post('*', function(req: Request, res) {
|
||||
res.status(404).render('404')
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue