1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-08 23:10:05 +00:00

fix(upload): appStream uses CSRF + Session authentication

This commit is contained in:
Saad Jutt
2022-05-02 18:01:28 +05:00
parent a07f47a1ba
commit 1f89279264
10 changed files with 78 additions and 74 deletions

View File

@@ -14,8 +14,8 @@ export class WebController {
*
*/
@Get('/')
public async home(@Request() req: express.Request) {
return home(req)
public async home() {
return home()
}
/**
@@ -44,16 +44,13 @@ export class WebController {
}
}
const home = async (req: express.Request) => {
const home = async () => {
const indexHtmlPath = path.join(getWebBuildFolderPath(), 'index.html')
// Attention! Cannot use fileExists here,
// due to limitation after building executable
const content = await readFile(indexHtmlPath)
req.res?.cookie('XSRF-TOKEN', req.csrfToken())
req.res?.setHeader('Content-Type', 'text/html')
return content
}