This commit is contained in:
Fasterino
2025-04-12 01:16:54 +03:00
parent fb036c6085
commit 1600435f95
2 changed files with 22 additions and 3 deletions

View File

@@ -52,17 +52,36 @@ export default function getProxy(cfg: Config) {
if (Config.isStatic(proxyData)) {
log.PROXY_TYPE = 'STATIC'
const path = join(volumePath, proxyData.folder, '/' + req.path.substring(proxyData.exclude))
let path = join(volumePath, proxyData.folder, req.path.substring(proxyData.exclude))
log.FILE_PATH = path
lstat(path, (err, stat) => {
if (err || !stat.isFile()) {
if (!err && stat.isDirectory()) {
path = join(path, 'index.html')
lstat(path, (err, stat) => {
if (err || !stat.isFile()) {
log.FILE_FOUND = false
prettyLog(log)
res.status(404).send('<h1>File not exist</h1>')
return
}
log.FILE_FOUND = true
prettyLog(log)
res.sendFile(path)
})
return
}
log.FILE_FOUND = false
prettyLog(log)
res.status(404).send('<h1>File not exist</h1>')
return
}
log.FILE_FOUND = false
log.FILE_FOUND = true
prettyLog(log)
res.sendFile(path)

View File

@@ -9,6 +9,6 @@
"outDir": "dist"
},
"lib": [
"es2015"
"es2022"
]
}