mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-04-25 23:06:43 +02:00
Fix ROUTER_BASE_PATH override for empty string
When the `ROUTER_BASE_PATH` env variable is set to an empty string it's mistakenly overriden to `/audiobookshelf` instead. The `/audiobookshelf` fallback should only be used when the `ROUTER_BASE_PATH` env variable is undefined, not just an empty string. Regression introduced in https://github.com/advplyr/audiobookshelf/pull/3810 See also: https://github.com/advplyr/audiobookshelf/pull/3810#discussion_r1948790937 Partially address https://github.com/advplyr/audiobookshelf/issues/3874
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const pkg = require('./package.json')
|
||||
|
||||
const routerBasePath = process.env.ROUTER_BASE_PATH || '/audiobookshelf'
|
||||
const routerBasePath = process.env.ROUTER_BASE_PATH ?? '/audiobookshelf'
|
||||
const serverHostUrl = process.env.NODE_ENV === 'production' ? '' : 'http://localhost:3333'
|
||||
const serverPaths = ['api/', 'public/', 'hls/', 'auth/', 'feed/', 'status', 'login', 'logout', 'init']
|
||||
const proxy = Object.fromEntries(serverPaths.map((path) => [`${routerBasePath}/${path}`, { target: process.env.NODE_ENV !== 'production' ? serverHostUrl : '/' }]))
|
||||
|
||||
Reference in New Issue
Block a user