diff options
author | geireann <geireann.lindfield@gmail.com> | 2023-08-08 16:25:10 -0400 |
---|---|---|
committer | geireann <geireann.lindfield@gmail.com> | 2023-08-08 16:25:10 -0400 |
commit | ab9cc075775e9451611395ad27dc20ca58dda9ff (patch) | |
tree | a9fc7f953d57f0000653d0f867afa320c925a913 /src/server/server_Initialization.ts | |
parent | 2b31bb73accaa2a6420242eddb60a309774de02a (diff) |
fixed searching web pages that are not cors readable to not generate an error
Diffstat (limited to 'src/server/server_Initialization.ts')
-rw-r--r-- | src/server/server_Initialization.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/server/server_Initialization.ts b/src/server/server_Initialization.ts index c1934451c..372c1169c 100644 --- a/src/server/server_Initialization.ts +++ b/src/server/server_Initialization.ts @@ -100,7 +100,7 @@ function buildWithMiddleware(server: express.Express) { passport.session(), (req: express.Request, res: express.Response, next: express.NextFunction) => { res.locals.user = req.user; - if (req.originalUrl.endsWith('.png') /*|| req.originalUrl.endsWith(".js")*/ && req.method === 'GET' && (res as any)._contentLength) { + if ((req.originalUrl.endsWith('.png') || req.originalUrl.endsWith(".js")) && req.method === 'GET' ) { const period = 30000; res.set('Cache-control', `public, max-age=${period}`); } else { @@ -176,6 +176,8 @@ function proxyServe(req: any, requrl: string, response: any) { const htmlText = htmlInputText .toString('utf8') .replace('<head>', '<head> <style>[id ^= "google"] { display: none; } </style>') + .replace('<script', '<noscript') + .replace('</script', '</noscript') // .replace(/href="https?([^"]*)"/g, httpsToCors) .replace(/data-srcset="[^"]*"/g, '') .replace(/srcset="[^"]*"/g, '') |