diff --git a/CloudServer/server.js b/CloudServer/server.js index 7c67dd1..6184dc4 100644 --- a/CloudServer/server.js +++ b/CloudServer/server.js @@ -148,13 +148,35 @@ function safeRelativeToBase(baseDir, relativePath) { return full; } -app.use('/media/audio/general', express.static(getBeepAudioDirs(), { fallthrough: true })); -app.use('/media/audio/beep', express.static(getBeepAudioDirs(), { fallthrough: true })); -app.use('/media/audio/music', express.static(audioMusicDir, { fallthrough: true })); -app.use('/media/audio/voice', express.static(audioVoiceDir, { fallthrough: true })); -app.use('/media/audio/line', express.static(audioLineDir, { fallthrough: true })); -app.use('/media/audio/station', express.static(audioStationDir, { fallthrough: true })); -app.use('/media/temp', express.static(tempBroadcastDir, { fallthrough: true })); +app.use('/media/audio/general', (req, res, next) => { + const dirs = getBeepAudioDirs(); + if (!dirs || dirs.length === 0) return next(); + let i = 0; + const tryNext = () => { + if (i >= dirs.length) return next(); + const dir = String(dirs[i++] || ''); + if (!dir) return tryNext(); + express.static(dir, { fallthrough: true })(req, res, tryNext); + }; + tryNext(); +}); +app.use('/media/audio/beep', (req, res, next) => { + const dirs = getBeepAudioDirs(); + if (!dirs || dirs.length === 0) return next(); + let i = 0; + const tryNext = () => { + if (i >= dirs.length) return next(); + const dir = String(dirs[i++] || ''); + if (!dir) return tryNext(); + express.static(dir, { fallthrough: true })(req, res, tryNext); + }; + tryNext(); +}); +app.use('/media/audio/music', express.static(String(audioMusicDir || ''), { fallthrough: true })); +app.use('/media/audio/voice', express.static(String(audioVoiceDir || ''), { fallthrough: true })); +app.use('/media/audio/line', express.static(String(audioLineDir || ''), { fallthrough: true })); +app.use('/media/audio/station', express.static(String(audioStationDir || ''), { fallthrough: true })); +app.use('/media/temp', express.static(String(tempBroadcastDir || ''), { fallthrough: true })); app.get('/media/audio/general/:path(*)', (req, res) => { const rel = decodeURIComponent(req.params.path || ''); diff --git a/station_broadcast.lua b/station_broadcast.lua index 2dd1ddc..5cc8b1d 100644 --- a/station_broadcast.lua +++ b/station_broadcast.lua @@ -1,6 +1,6 @@ -- 1. Configuration & Constants -local APP_VERSION_TEXT = "v1.0.102" +local APP_VERSION_TEXT = "v1.0.103" local CONFIG = { CLOUD_URL = "ws://stabadmin.fse-media.group",