From 9abb53de1a5355ae780ccc39a2955e3720f7fac3 Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Thu, 5 Feb 2026 12:35:33 -0500 Subject: [PATCH] Fix search to use SquidWTF HiFi API with round-robin base URLs, capitalize provider names in UI, and widen tracks modal to 90% --- allstarr/Controllers/AdminController.cs | 48 +++++++++++++++++++++++++ allstarr/wwwroot/index.html | 47 ++++++++++++++++-------- 2 files changed, 80 insertions(+), 15 deletions(-) diff --git a/allstarr/Controllers/AdminController.cs b/allstarr/Controllers/AdminController.cs index a8f2103..6017e29 100644 --- a/allstarr/Controllers/AdminController.cs +++ b/allstarr/Controllers/AdminController.cs @@ -40,6 +40,9 @@ public class AdminController : ControllerBase private readonly IWebHostEnvironment _environment; private readonly IServiceProvider _serviceProvider; private readonly string _envFilePath; + private readonly List _squidWtfApiUrls; + private static int _urlIndex = 0; + private static readonly object _urlIndexLock = new(); private const string CacheDirectory = "/app/cache/spotify"; public AdminController( @@ -77,6 +80,9 @@ public class AdminController : ControllerBase _jellyfinHttpClient = httpClientFactory.CreateClient(); _serviceProvider = serviceProvider; + // Decode SquidWTF base URLs + _squidWtfApiUrls = DecodeSquidWtfUrls(); + // .env file path is always /app/.env in Docker (mounted from host) // In development, it's in the parent directory of ContentRootPath _envFilePath = _environment.IsDevelopment() @@ -86,6 +92,27 @@ public class AdminController : ControllerBase _logger.LogInformation("Admin controller initialized. .env path: {EnvFilePath}", _envFilePath); } + private static List DecodeSquidWtfUrls() + { + var encodedUrls = new[] + { + "aHR0cHM6Ly90cml0b24uc3F1aWQud3Rm", // triton + "aHR0cHM6Ly90aWRhbC1hcGkuYmluaW11bS5vcmc=", // binimum + "aHR0cHM6Ly90aWRhbC5raW5vcGx1cy5vbmxpbmU=", // kinoplus + "aHR0cHM6Ly9oaWZpLXR3by5zcG90aXNhdmVyLm5ldA==", // spoti-2 + "aHR0cHM6Ly9oaWZpLW9uZS5zcG90aXNhdmVyLm5ldA==", // spoti-1 + "aHR0cHM6Ly93b2xmLnFxZGwuc2l0ZQ==", // wolf + "aHR0cDovL2h1bmQucXFkbC5zaXRl", // hund + "aHR0cHM6Ly9rYXR6ZS5xcWRsLnNpdGU=", // katze + "aHR0cHM6Ly92b2dlbC5xcWRsLnNpdGU=", // vogel + "aHR0cHM6Ly9tYXVzLnFxZGwuc2l0ZQ==" // maus + }; + + return encodedUrls + .Select(encoded => System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(encoded))) + .ToList(); + } + /// /// Helper method to safely check if a dynamic cache result has a value /// Handles the case where JsonElement cannot be compared to null directly @@ -159,6 +186,27 @@ public class AdminController : ControllerBase }); } + /// + /// Get a random SquidWTF base URL for searching (round-robin) + /// + [HttpGet("squidwtf-base-url")] + public IActionResult GetSquidWtfBaseUrl() + { + if (_squidWtfApiUrls.Count == 0) + { + return NotFound(new { error = "No SquidWTF base URLs configured" }); + } + + string baseUrl; + lock (_urlIndexLock) + { + baseUrl = _squidWtfApiUrls[_urlIndex]; + _urlIndex = (_urlIndex + 1) % _squidWtfApiUrls.Count; + } + + return Ok(new { baseUrl }); + } + /// /// Get list of configured playlists with their current data /// diff --git a/allstarr/wwwroot/index.html b/allstarr/wwwroot/index.html index 4a4a665..8008b02 100644 --- a/allstarr/wwwroot/index.html +++ b/allstarr/wwwroot/index.html @@ -879,7 +879,7 @@