From ed5d3c2eda12e54656688ea00e45d6060ab922ef Mon Sep 17 00:00:00 2001 From: achiez Date: Fri, 19 Jun 2026 22:34:37 +0300 Subject: [PATCH] feat(links): fetch website and docs URLs from GitHub at startup - Add links.json to repo (alongside update.xml) with Website and Documentation URLs. - Add LinksManager to support link fetching on startup via raw.githubusercontent.com - Suppress TimeAligner failure instead of blocking app launch --- NebulaAuth/links.json | 4 +++ src/NebulaAuth/Core/LinksManager.cs | 33 +++++++++++++++++++ src/NebulaAuth/Model/RemoteLinks.cs | 7 ++++ src/NebulaAuth/Model/Shell.cs | 5 +-- src/NebulaAuth/View/LinksView.xaml | 17 ++++++---- src/NebulaAuth/View/LinksView.xaml.cs | 14 ++++++-- src/SteamLibForked/SteamMobile/TimeAligner.cs | 6 ++++ 7 files changed, 75 insertions(+), 11 deletions(-) create mode 100644 NebulaAuth/links.json create mode 100644 src/NebulaAuth/Core/LinksManager.cs create mode 100644 src/NebulaAuth/Model/RemoteLinks.cs diff --git a/NebulaAuth/links.json b/NebulaAuth/links.json new file mode 100644 index 0000000..e337513 --- /dev/null +++ b/NebulaAuth/links.json @@ -0,0 +1,4 @@ +{ + "Website": "https://achiefy.pro/?nebula=true", + "Documentation": "https://achiefy-project.gitbook.io/nebulaauth" +} diff --git a/src/NebulaAuth/Core/LinksManager.cs b/src/NebulaAuth/Core/LinksManager.cs new file mode 100644 index 0000000..b37b857 --- /dev/null +++ b/src/NebulaAuth/Core/LinksManager.cs @@ -0,0 +1,33 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; +using NebulaAuth.Model; +using Newtonsoft.Json; + +namespace NebulaAuth.Core; + +public static class LinksManager +{ + private const string LINKS_URL = + "https://raw.githubusercontent.com/achiez/NebulaAuth-Steam-Desktop-Authenticator-by-Achies/master/NebulaAuth/links.json"; + + private static readonly HttpClient HttpClient = new(); + + public static string? WebsiteUrl { get; private set; } + public static string? DocumentationUrl { get; private set; } + + public static async Task FetchAsync() + { + try + { + var json = await HttpClient.GetStringAsync(LINKS_URL).ConfigureAwait(false); + var links = JsonConvert.DeserializeObject(json); + WebsiteUrl = links?.Website; + DocumentationUrl = links?.Documentation; + } + catch (Exception ex) + { + Shell.Logger.Debug(ex, "Failed to fetch remote links"); + } + } +} \ No newline at end of file diff --git a/src/NebulaAuth/Model/RemoteLinks.cs b/src/NebulaAuth/Model/RemoteLinks.cs new file mode 100644 index 0000000..0f50b92 --- /dev/null +++ b/src/NebulaAuth/Model/RemoteLinks.cs @@ -0,0 +1,7 @@ +namespace NebulaAuth.Model; + +public class RemoteLinks +{ + public string? Website { get; set; } + public string? Documentation { get; set; } +} \ No newline at end of file diff --git a/src/NebulaAuth/Model/Shell.cs b/src/NebulaAuth/Model/Shell.cs index f2ce3e5..f4e61dd 100644 --- a/src/NebulaAuth/Model/Shell.cs +++ b/src/NebulaAuth/Model/Shell.cs @@ -3,7 +3,6 @@ using System.IO; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using NebulaAuth.Core; -using NebulaAuth.Model.Exceptions; using NebulaAuth.Model.MAAC; using NebulaAuth.Model.MafileExport; using NebulaAuth.Model.Mafiles; @@ -40,7 +39,8 @@ public static class Shell } catch (Exception ex) { - throw new CantAlignTimeException("", ex); + Logger.Error(ex, "Failed to align time with Steam"); + TimeAligner.SetTimeDifference(0); } var threads = Environment.ProcessorCount > 0 ? Environment.ProcessorCount : 1; @@ -48,6 +48,7 @@ public static class Shell ProxyAssignmentCache.Initialize(Storage.MaFiles); MAACStorage.Initialize(); MafileExporterStorage.Initialize(); + _ = LinksManager.FetchAsync(); ExtensionsLogger.LogDebug("Application started"); } diff --git a/src/NebulaAuth/View/LinksView.xaml b/src/NebulaAuth/View/LinksView.xaml index f859483..b737a22 100644 --- a/src/NebulaAuth/View/LinksView.xaml +++ b/src/NebulaAuth/View/LinksView.xaml @@ -8,7 +8,8 @@ d:DesignHeight="450" d:DesignWidth="800" TextElement.Foreground="{DynamicResource BaseContentBrush}" Background="Transparent" - RenderOptions.BitmapScalingMode="HighQuality"> + RenderOptions.BitmapScalingMode="HighQuality" + Loaded="LinksView_Loaded"> @@ -49,16 +50,20 @@ - -