]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
display the current version in the changelog window (#34556)
authorMilon <milonpl.git@proton.me>
Sat, 25 Jan 2025 11:21:52 +0000 (12:21 +0100)
committerGitHub <noreply@github.com>
Sat, 25 Jan 2025 11:21:52 +0000 (12:21 +0100)
* just works first try

* introduce more magic numbers into the codebase

* idiot doesnt know the difference between AND/OR

Content.Client/Changelog/ChangelogWindow.xaml.cs
Resources/Locale/en-US/changelog/changelog-window.ftl

index 9b7fd75436928b93790fc99370e442141ddeb756..cb07e16a9c28f82ff268ce66445a0b10c6822c08 100644 (file)
@@ -8,6 +8,8 @@ using JetBrains.Annotations;
 using Robust.Client.AutoGenerated;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.XAML;
+using Robust.Shared;
+using Robust.Shared.Configuration;
 using Robust.Shared.Console;
 
 namespace Content.Client.Changelog
@@ -15,8 +17,9 @@ namespace Content.Client.Changelog
     [GenerateTypedNameReferences]
     public sealed partial class ChangelogWindow : FancyWindow
     {
-        [Dependency] private readonly IClientAdminManager _adminManager = default!;
         [Dependency] private readonly ChangelogManager _changelog = default!;
+        [Dependency] private readonly IClientAdminManager _adminManager = default!;
+        [Dependency] private readonly IConfigurationManager _cfg = default!;
 
         public ChangelogWindow()
         {
@@ -67,8 +70,22 @@ namespace Content.Client.Changelog
                 Tabs.SetTabTitle(i++, Loc.GetString($"changelog-tab-title-{changelog.Name}"));
             }
 
-            var version = typeof(ChangelogWindow).Assembly.GetName().Version ?? new Version(1, 0);
-            VersionLabel.Text = Loc.GetString("changelog-version-tag", ("version", version.ToString()));
+            // Try to get the current version from the build.json file
+            var version = _cfg.GetCVar(CVars.BuildVersion);
+            var forkId = _cfg.GetCVar(CVars.BuildForkId);
+
+            var versionText = Loc.GetString("changelog-version-unknown");
+
+            // Make sure these aren't empty, like in a dev env
+            if (!string.IsNullOrEmpty(version) && !string.IsNullOrEmpty(forkId))
+            {
+                versionText = Loc.GetString("changelog-version-tag",
+                    ("fork", forkId),
+                    ("version", version[..7])); // Only show the first 7 characters
+            }
+
+            // if else statements are ugly, shut up
+            VersionLabel.Text = versionText;
 
             TabsUpdated();
         }
index b7f5d6a2fae94edde57b92898e6b729572f5a929..9d17dea62995af18ecd843805d3f42a590d84b00 100644 (file)
@@ -5,7 +5,8 @@ changelog-author-changed = [color=#EEE]{ $author }[/color] changed:
 changelog-today = Today
 changelog-yesterday = Yesterday
 changelog-new-changes = new changes
-changelog-version-tag = version v{ $version }
+changelog-version-unknown = Unknown Version
+changelog-version-tag = { $fork }/{ $version }
 
 changelog-button = Changelog
 changelog-button-new-entries = Changelog (new!)