mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-01-02 00:59:37 +00:00
Merge pull request #3521 from mikiher/subdirectory-fixes
Fixes and cleanup for subdirectory serving support
This commit is contained in:
commit
cb234fe1fc
12 changed files with 35 additions and 45 deletions
|
|
@ -243,6 +243,15 @@ class Server {
|
|||
await this.auth.initPassportJs()
|
||||
|
||||
const router = express.Router()
|
||||
// if RouterBasePath is set, modify all requests to include the base path
|
||||
if (global.RouterBasePath) {
|
||||
app.use((req, res, next) => {
|
||||
if (!req.url.startsWith(global.RouterBasePath)) {
|
||||
req.url = `${global.RouterBasePath}${req.url}`
|
||||
}
|
||||
next()
|
||||
})
|
||||
}
|
||||
app.use(global.RouterBasePath, router)
|
||||
app.disable('x-powered-by')
|
||||
|
||||
|
|
@ -340,7 +349,7 @@ class Server {
|
|||
Logger.info('Received ping')
|
||||
res.json({ success: true })
|
||||
})
|
||||
app.get('/healthcheck', (req, res) => res.sendStatus(200))
|
||||
router.get('/healthcheck', (req, res) => res.sendStatus(200))
|
||||
|
||||
this.server.listen(this.Port, this.Host, () => {
|
||||
if (this.Host) Logger.info(`Listening on http://${this.Host}:${this.Port}`)
|
||||
|
|
|
|||
|
|
@ -103,7 +103,8 @@ class SocketAuthority {
|
|||
cors: {
|
||||
origin: '*',
|
||||
methods: ['GET', 'POST']
|
||||
}
|
||||
},
|
||||
path: `${global.RouterBasePath}/socket.io`
|
||||
})
|
||||
|
||||
this.io.on('connection', (socket) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue