From f19214ba6b21c5bd4bb390c74030bfb4a6031290 Mon Sep 17 00:00:00 2001 From: Michael Green <84688932+michael-j-green@users.noreply.github.com> Date: Mon, 28 Oct 2024 11:00:51 +1100 Subject: [PATCH] Settings UI changes complete --- .../Controllers/V1.0/SystemController.cs | 17 ++ .../Controllers/V1.1/GamesController.cs | 1 + .../Support/Database/MySQL/gaseous-1024.sql | 10 +- gaseous-server/wwwroot/index.html | 12 +- .../wwwroot/pages/settings/settings.html | 168 ++++++++++++------ .../wwwroot/pages/settings/settings.js | 24 ++- 6 files changed, 179 insertions(+), 53 deletions(-) diff --git a/gaseous-server/Controllers/V1.0/SystemController.cs b/gaseous-server/Controllers/V1.0/SystemController.cs index abaeaa3..80b2393 100644 --- a/gaseous-server/Controllers/V1.0/SystemController.cs +++ b/gaseous-server/Controllers/V1.0/SystemController.cs @@ -311,6 +311,12 @@ namespace gaseous_server.Controllers HasheousHost = Config.MetadataConfiguration.HasheousHost, HasheousSubmitFixes = (bool)Config.MetadataConfiguration.HasheousSubmitFixes, HasheousAPIKey = Config.MetadataConfiguration.HasheousAPIKey + }, + MetadataSource = new SystemSettingsModel.MetadataSourceItem() + { + Source = Config.MetadataConfiguration.MetadataSource, + IGDBClientId = Config.IGDB.ClientId, + IGDBClientSecret = Config.IGDB.Secret } }; @@ -334,6 +340,9 @@ namespace gaseous_server.Controllers Config.MetadataConfiguration.HasheousHost = model.SignatureSource.HasheousHost; Config.MetadataConfiguration.HasheousAPIKey = model.SignatureSource.HasheousAPIKey; Config.MetadataConfiguration.HasheousSubmitFixes = model.SignatureSource.HasheousSubmitFixes; + Config.MetadataConfiguration.MetadataSource = model.MetadataSource.Source; + Config.IGDB.ClientId = model.MetadataSource.IGDBClientId; + Config.IGDB.Secret = model.MetadataSource.IGDBClientSecret; Config.UpdateConfig(); } @@ -776,6 +785,7 @@ namespace gaseous_server.Controllers public int MinimumLogRetentionPeriod { get; set; } public bool EmulatorDebugMode { get; set; } public SignatureSourceItem SignatureSource { get; set; } + public MetadataSourceItem MetadataSource { get; set; } public class SignatureSourceItem { @@ -784,5 +794,12 @@ namespace gaseous_server.Controllers public string HasheousAPIKey { get; set; } public bool HasheousSubmitFixes { get; set; } } + + public class MetadataSourceItem + { + public HasheousClient.Models.MetadataModel.MetadataSources Source { get; set; } + public string IGDBClientId { get; set; } + public string IGDBClientSecret { get; set; } + } } } \ No newline at end of file diff --git a/gaseous-server/Controllers/V1.1/GamesController.cs b/gaseous-server/Controllers/V1.1/GamesController.cs index f1e9f8b..16f726b 100644 --- a/gaseous-server/Controllers/V1.1/GamesController.cs +++ b/gaseous-server/Controllers/V1.1/GamesController.cs @@ -553,6 +553,7 @@ FROM Favourites ON Game.Id = Favourites.GameId AND Favourites.UserId = @userid " + whereClause + " " + havingClause + " " + orderByClause; List RetVal = new List(); + Console.WriteLine(sql); DataTable dbResponse = db.ExecuteCMD(sql, whereParams, new Database.DatabaseMemoryCacheOptions(CacheEnabled: true, ExpirationSeconds: 60)); // get count diff --git a/gaseous-server/Support/Database/MySQL/gaseous-1024.sql b/gaseous-server/Support/Database/MySQL/gaseous-1024.sql index 96794e6..ac0a24a 100644 --- a/gaseous-server/Support/Database/MySQL/gaseous-1024.sql +++ b/gaseous-server/Support/Database/MySQL/gaseous-1024.sql @@ -96,4 +96,12 @@ CREATE VIEW view_UserTimeTracking AS SELECT *, DATE_ADD( SessionTime, INTERVAL SessionLength MINUTE ) AS SessionEnd -FROM UserTimeTracking; \ No newline at end of file +FROM UserTimeTracking; + +CREATE INDEX idx_game_name ON Game (`Name`); +CREATE INDEX idx_game_totalratingcount ON Game (TotalRatingCount); +CREATE INDEX idx_alternativename_game ON AlternativeName (Game); +CREATE INDEX idx_gamestate_romid ON GameState (RomId); +CREATE INDEX idx_gamestate_ismediagroup_userid ON GameState (IsMediaGroup, UserId); +CREATE INDEX idx_rommediagroup_gameid ON RomMediaGroup (GameId); +CREATE INDEX idx_favourites_userid_gameid ON Favourites (UserId, GameId); \ No newline at end of file diff --git a/gaseous-server/wwwroot/index.html b/gaseous-server/wwwroot/index.html index 7fa578b..3a7278c 100644 --- a/gaseous-server/wwwroot/index.html +++ b/gaseous-server/wwwroot/index.html @@ -129,6 +129,15 @@ head.appendChild(newLink); } + // wait for all scripts to load + do { + if (typeof getQueryString === "function") { + break; + } + console.log("Waiting for scripts to load..."); + await new Promise(r => setTimeout(r, 100)); + } while (typeof getQueryString !== "function"); + // start the application console.log("Starting Gaseous"); console.log("App Version: " + AppVersion); @@ -157,8 +166,9 @@ let pageSelection = getQueryString('page', 'string'); if (!pageSelection) { - pageSelection = GetPreference("DefaultHomePage", 'home'); + pageSelection = GetPreference("DefaultHomePage", "home"); } + console.log("Loading page: " + pageSelection); await LoadPageContent(pageSelection, 'content'); } else { // user is not signed in - load login page diff --git a/gaseous-server/wwwroot/pages/settings/settings.html b/gaseous-server/wwwroot/pages/settings/settings.html index aa428c8..03a3a3a 100644 --- a/gaseous-server/wwwroot/pages/settings/settings.html +++ b/gaseous-server/wwwroot/pages/settings/settings.html @@ -3,55 +3,120 @@
-
Metadata Sources
+
Metadata Settings
- - - - - - - - - - - - - - - - - - - - - -
- Signature Source - - - -
- - -
- - - -
+
+
Source
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ Signature Source + + + +
+ + +
+ Metadata Source + + + +
+ + +
+ + +
+
+
+ +
+
IGDB Configuration
+
+ + + + + + + + + +
+ IGDB Client ID + + +
+ IGDB Client Key + + +
+
+
+ +
+
Hasheous Configuration
+
+ + + + + + + + + + + + + +
+ Hasheous Host + + +
+ + + +
+ Hasheous API key + + +
+
+
+
+
Logging
@@ -85,6 +150,8 @@
+
+
Emulator
@@ -95,9 +162,10 @@
-
- -
+
+ +
+