diff --git a/gaseous-server/Controllers/BiosController.cs b/gaseous-server/Controllers/BiosController.cs index b78cc9b..bb7bef3 100644 --- a/gaseous-server/Controllers/BiosController.cs +++ b/gaseous-server/Controllers/BiosController.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO.Compression; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; @@ -25,6 +26,39 @@ namespace gaseous_server.Controllers return Classes.Bios.GetBios(PlatformId, AvailableOnly); } + [HttpGet] + [HttpHead] + [Route("zip/{PlatformId}")] + [ProducesResponseType(typeof(FileStreamResult), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public ActionResult GetBiosCompressed(long PlatformId) + { + try + { + IGDB.Models.Platform platform = Classes.Metadata.Platforms.GetPlatform(PlatformId); + + string biosPath = Path.Combine(gaseous_tools.Config.LibraryConfiguration.LibraryBIOSDirectory, platform.Slug); + + string tempFile = Path.GetTempFileName(); + + using (FileStream zipFile = System.IO.File.Create(tempFile)) + using (var zipArchive = new ZipArchive(zipFile, ZipArchiveMode.Create)) + { + foreach (string file in Directory.GetFiles(biosPath)) + { + zipArchive.CreateEntryFromFile(file, Path.GetFileName(file)); + } + } + + var stream = new FileStream(tempFile, FileMode.Open); + return File(stream, "application/zip", platform.Slug + ".zip"); + } + catch + { + return NotFound(); + } + } + [HttpGet] [HttpHead] [Route("{PlatformId}/{BiosName}")] diff --git a/gaseous-server/wwwroot/emulators/EmulatorJS b/gaseous-server/wwwroot/emulators/EmulatorJS index f7fa5d4..109a832 160000 --- a/gaseous-server/wwwroot/emulators/EmulatorJS +++ b/gaseous-server/wwwroot/emulators/EmulatorJS @@ -1 +1 @@ -Subproject commit f7fa5d41487a424233b40e903020455606d68fee +Subproject commit 109a832ffd25035ffb9d7a128fce469b08aca257 diff --git a/gaseous-server/wwwroot/pages/EmulatorJS.html b/gaseous-server/wwwroot/pages/EmulatorJS.html index 7e4da79..ba52a32 100644 --- a/gaseous-server/wwwroot/pages/EmulatorJS.html +++ b/gaseous-server/wwwroot/pages/EmulatorJS.html @@ -20,7 +20,7 @@ // Path to the data directory EJS_pathtodata = '/emulators/EmulatorJS/data/'; - EJS_DEBUG_XX = true; + EJS_DEBUG_XX = false; EJS_startOnLoaded = false; diff --git a/gaseous-server/wwwroot/pages/emulator.html b/gaseous-server/wwwroot/pages/emulator.html index 50aad73..b47622f 100644 --- a/gaseous-server/wwwroot/pages/emulator.html +++ b/gaseous-server/wwwroot/pages/emulator.html @@ -4,15 +4,6 @@
-Firmware: | -- |