diff --git a/CloudServer/server.js b/CloudServer/server.js index 4b0ef11..2829bec 100644 --- a/CloudServer/server.js +++ b/CloudServer/server.js @@ -50,7 +50,9 @@ const audioStationDir = path.join(audioRootDir, 'station'); const listFilePath = path.join(appRootDir, 'list.txt'); const tempBroadcastDir = path.join(appRootDir, 'temp-broadcast'); const stationScriptPath = path.join(appRootDir, 'station_broadcast.lua'); +const stationUpdateScriptPath = path.join(appRootDir, 'update_station_broadcast.lua'); const STATION_SCRIPT_DOWNLOAD_PATH = '/downloads/station_broadcast.lua'; +const STATION_UPDATE_SCRIPT_DOWNLOAD_PATH = '/downloads/update_station_broadcast.lua'; const STREAMABLE_AUDIO_EXTENSIONS = ['.wav', '.mp3', '.ogg', '.flac', '.m4a', '.aac', '.opus']; const MUSIC_AUDIO_EXTENSIONS = [...STREAMABLE_AUDIO_EXTENSIONS, '.dfpwm']; @@ -2190,6 +2192,13 @@ app.get(STATION_SCRIPT_DOWNLOAD_PATH, (req, res) => { return res.sendFile(stationScriptPath); }); +app.get(STATION_UPDATE_SCRIPT_DOWNLOAD_PATH, (req, res) => { + if (!fs.existsSync(stationUpdateScriptPath)) { + return res.status(404).send('update_station_broadcast.lua not found'); + } + return res.sendFile(stationUpdateScriptPath); +}); + app.get('/api/streams', (req, res) => { const streams = []; const seen = new Set(); diff --git a/install_station_broadcast.lua b/install_station_broadcast.lua index c4d1faf..1461c2f 100644 --- a/install_station_broadcast.lua +++ b/install_station_broadcast.lua @@ -1,4 +1,5 @@ local STATION_BROADCAST_URL = "http://stabadmin.fse-media.group/downloads/station_broadcast.lua" +local UPDATE_SCRIPT_URL = "http://stabadmin.fse-media.group/downloads/update_station_broadcast.lua" local function fetch(url) if not http then @@ -64,7 +65,8 @@ local function downloadTo(url, path) end local targets = { - { url = STATION_BROADCAST_URL, path = shell.resolve("/startup") } + { url = STATION_BROADCAST_URL, path = shell.resolve("/startup") }, + { url = UPDATE_SCRIPT_URL, path = shell.resolve("/update_station_broadcast.lua") } } for _, t in ipairs(targets) do @@ -76,4 +78,5 @@ for _, t in ipairs(targets) do end print("Install complete.") +print("Update helper installed as /update_station_broadcast.lua") print("Run 'reboot' to start StationBroadcast on boot.")