diff --git a/.github/workflows/BuildDockerOnTag.yml b/.github/workflows/BuildDockerOnTag.yml index e4e1a6d..8bb64ed 100644 --- a/.github/workflows/BuildDockerOnTag.yml +++ b/.github/workflows/BuildDockerOnTag.yml @@ -14,6 +14,12 @@ jobs: uses: actions/checkout@v3 with: submodules: 'true' + - + name: Install dotnet tool + run: dotnet tool install -g dotnetCampus.TagToVersion + - + name: Set tag to version + run: dotnet TagToVersion -t ${{ github.ref }} - name: Set up QEMU uses: docker/setup-qemu-action@v2 diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..2c52bf2 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/build/Version.props b/build/Version.props new file mode 100644 index 0000000..4c8b5b7 --- /dev/null +++ b/build/Version.props @@ -0,0 +1,5 @@ + + + 1.5.0 + + \ No newline at end of file diff --git a/gaseous-server/Controllers/SystemController.cs b/gaseous-server/Controllers/SystemController.cs index 5d5cd9c..7cc40fc 100644 --- a/gaseous-server/Controllers/SystemController.cs +++ b/gaseous-server/Controllers/SystemController.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Data; using System.Linq; +using System.Reflection; +using System.Text; using System.Threading.Tasks; using gaseous_tools; using Microsoft.AspNetCore.Mvc; @@ -49,6 +51,22 @@ namespace gaseous_server.Controllers return ReturnValue; } + [HttpGet] + [Route("Version")] + [ProducesResponseType(StatusCodes.Status200OK)] + public Version GetSystemVersion() { + return Assembly.GetExecutingAssembly().GetName().Version; + } + + [HttpGet] + [Route("VersionFile")] + [ProducesResponseType(StatusCodes.Status200OK)] + public FileContentResult GetSystemVersionAsFile() { + string ver = "var AppVersion = \"" + Assembly.GetExecutingAssembly().GetName().Version.ToString() + "\""; + byte[] bytes = Encoding.UTF8.GetBytes(ver); + return File(bytes, "text/javascript"); + } + private SystemInfo.PathItem GetDisk(string Path) { SystemInfo.PathItem pathItem = new SystemInfo.PathItem { @@ -63,6 +81,12 @@ namespace gaseous_server.Controllers public class SystemInfo { + public Version ApplicationVersion { + get + { + return Assembly.GetExecutingAssembly().GetName().Version; + } + } public List? Paths { get; set; } public long DatabaseSize { get; set; } public List? PlatformStatistics { get; set; } diff --git a/gaseous-server/Program.cs b/gaseous-server/Program.cs index 32e203b..d3603f2 100644 --- a/gaseous-server/Program.cs +++ b/gaseous-server/Program.cs @@ -1,5 +1,5 @@ -using System.Reflection; -using System.Text.Json.Serialization; +using System.Reflection; +using System.Text.Json.Serialization; using gaseous_server; using gaseous_tools; using Microsoft.AspNetCore.Http.Features; @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.OpenApi.Models; -Logging.Log(Logging.LogType.Information, "Startup", "Starting Gaseous Server"); +Logging.Log(Logging.LogType.Information, "Startup", "Starting Gaseous Server " + Assembly.GetExecutingAssembly().GetName().Version); // set up db Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString); diff --git a/gaseous-server/wwwroot/index.html b/gaseous-server/wwwroot/index.html index 8c09c26..22b2e7f 100644 --- a/gaseous-server/wwwroot/index.html +++ b/gaseous-server/wwwroot/index.html @@ -2,23 +2,42 @@ - + + - + - - - + + + Gaseous Games + + + $('#content').load('/pages/' + myParam + '.html?v=' + AppVersion); + }); + diff --git a/gaseous-server/wwwroot/pages/dialogs/upload.html b/gaseous-server/wwwroot/pages/dialogs/upload.html index 3904276..a913b59 100644 --- a/gaseous-server/wwwroot/pages/dialogs/upload.html +++ b/gaseous-server/wwwroot/pages/dialogs/upload.html @@ -55,7 +55,7 @@ subModalVariables = modalVariables; - $('#modal-content-sub').load('/pages/dialogs/' + dialogPage + '.html'); + $('#modal-content-sub').load('/pages/dialogs/' + dialogPage + '.html?v=' + AppVersion); } function closeSubDialog() { diff --git a/gaseous-server/wwwroot/pages/emulator.html b/gaseous-server/wwwroot/pages/emulator.html index 2563af0..35bd3ef 100644 --- a/gaseous-server/wwwroot/pages/emulator.html +++ b/gaseous-server/wwwroot/pages/emulator.html @@ -44,7 +44,7 @@ switch (getQueryString('engine', 'string')) { case 'EmulatorJS': - $('#emulator').load('/pages/EmulatorJS.html'); + $('#emulator').load('/pages/EmulatorJS.html?v=' + AppVersion); break; } }); diff --git a/gaseous-server/wwwroot/pages/settings.html b/gaseous-server/wwwroot/pages/settings.html index 00ba206..ca9b811 100644 --- a/gaseous-server/wwwroot/pages/settings.html +++ b/gaseous-server/wwwroot/pages/settings.html @@ -42,6 +42,6 @@ } } - $('#properties_bodypanel').load('/pages/settings/' + TabName + '.html'); + $('#properties_bodypanel').load('/pages/settings/' + TabName + '.html?v=' + AppVersion); } diff --git a/gaseous-server/wwwroot/pages/settings/about.html b/gaseous-server/wwwroot/pages/settings/about.html index 16fa1f2..af7c7a0 100644 --- a/gaseous-server/wwwroot/pages/settings/about.html +++ b/gaseous-server/wwwroot/pages/settings/about.html @@ -11,6 +11,10 @@ Bugs and Feature Requests https://github.com/gaseous-project/gaseous-server/issues + + Server Version + +

Data Sources

@@ -38,4 +42,13 @@ The Old School Emulation Center - \ No newline at end of file + + + \ No newline at end of file diff --git a/gaseous-server/wwwroot/scripts/main.js b/gaseous-server/wwwroot/scripts/main.js index 3d6dc43..c1983df 100644 --- a/gaseous-server/wwwroot/scripts/main.js +++ b/gaseous-server/wwwroot/scripts/main.js @@ -103,7 +103,7 @@ function showDialog(dialogPage, variables) { modalVariables = variables; - $('#modal-content').load('/pages/dialogs/' + dialogPage + '.html'); + $('#modal-content').load('/pages/dialogs/' + dialogPage + '.html?v=' + AppVersion); } function closeDialog() { @@ -145,7 +145,7 @@ function showSubDialog(dialogPage, variables) { subModalVariables = variables; - $('#modal-content-sub').load('/pages/dialogs/' + dialogPage + '.html'); + $('#modal-content-sub').load('/pages/dialogs/' + dialogPage + '.html?v=' + AppVersion); } function closeSubDialog() {