Skip to content

Commit

Permalink
add - doc|bkp - Added local changelogs
Browse files Browse the repository at this point in the history
---

We've added local changelogs to the Nitrocid resources so that we can no
longer rely on Internet connectivity to fetch the changelogs.

In the "changes" command, you can use the -online switch to use the old
behavior.

  - Backportable for 0.1.1
  - Backportable for 0.1.0

---

Type: add
Breaking: False
Doc Required: True
Backport Required: True
Part: 1/1
  • Loading branch information
AptiviCEO committed Feb 6, 2025
1 parent 23127d9 commit d6117f5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion public/Nitrocid/Kernel/Starting/KernelStageActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ internal static void Stage02KernelUpdates()
{
Writing.WriteContentsText(upgradedPath, KernelMain.Version?.ToString() ?? "0.0.0.0");
SplashManager.BeginSplashOut(SplashManager.CurrentSplashContext);
string changes = UpdateManager.GetVersionChangelogs();
string changes = UpdateManager.FetchCurrentChangelogsFromResources();
InfoBoxButtonsColor.WriteInfoBoxButtons([
new InputChoiceInfo(Translate.DoTranslation("Acknowledged"), Translate.DoTranslation("Acknowledged")),
], changes);
Expand Down
9 changes: 9 additions & 0 deletions public/Nitrocid/Kernel/Updates/UpdateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
using Nitrocid.Misc.Splash;
using Nitrocid.Languages;
using Nitrocid.Kernel.Exceptions;
using Nitrocid.Misc.Reflection.Internal;

#if SPECIFIERREL
using Nitrocid.Files.Paths;
Expand Down Expand Up @@ -195,5 +196,13 @@ public static string GetVersionChangelogs()
return changes;
}

internal static string FetchCurrentChangelogsFromResources()
{
// Get the changelogs from resource
bool exists = ResourcesManager.DataExists("changes.chg", ResourcesType.Misc, out string? contents);
if (!exists)
return "";
return contents ?? "";
}
}
}
9 changes: 9 additions & 0 deletions public/Nitrocid/Nitrocid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@
</ItemGroup>
<!-- KS Manifest End -->

<!-- KS Release Changelogs -->
<ItemGroup>
<EmbeddedResource Include="..\..\tools\changes.chg">
<LogicalName>Nitrocid.Resources.changes.chg</LogicalName>
<Visible>false</Visible>
</EmbeddedResource>
</ItemGroup>
<!-- KS Release Changelogs -->

<!-- KS Package Files -->
<ItemGroup>
<None Include="OfficialAppIcon-NitrocidKS-512.png" Pack="true" PackagePath="\" />
Expand Down
4 changes: 3 additions & 1 deletion public/Nitrocid/Shell/Shells/UESH/Commands/Changes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Terminaux.Writer.ConsoleWriters;
using Nitrocid.Kernel.Updates;
using Nitrocid.Shell.ShellBase.Commands;
using Nitrocid.Shell.ShellBase.Switches;

namespace Nitrocid.Shell.Shells.UESH.Commands
{
Expand All @@ -34,7 +35,8 @@ class ChangesCommand : BaseCommand, ICommand

public override int Execute(CommandParameters parameters, ref string variableValue)
{
string changes = UpdateManager.GetVersionChangelogs();
bool online = SwitchManager.ContainsSwitch(parameters.SwitchesList, "-online");
string changes = online ? UpdateManager.GetVersionChangelogs() : UpdateManager.FetchCurrentChangelogsFromResources();
TextWriterColor.Write(changes);
return 0;
}
Expand Down
8 changes: 7 additions & 1 deletion public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,13 @@ internal class UESHShellInfo : BaseShellInfo, IShellInfo

new CommandInfo("changes", /* Localizable */ "What's new in this version of Nitrocid?",
[
new CommandArgumentInfo()
new CommandArgumentInfo(new[]
{
new SwitchInfo("online", /* Localizable */ "Fetch the changelogs from the internet instead of locally", new SwitchOptions()

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized

Check warning on line 183 in public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs

View workflow job for this annotation

GitHub Actions / build

This string, "Fetch the changelogs from the internet instead of locally", is unlocalized
{
AcceptsValues = false
}),
})
], new ChangesCommand()),

new CommandInfo("chattr", /* Localizable */ "Changes attribute of a file",
Expand Down

0 comments on commit d6117f5

Please sign in to comment.