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 03248a8 commit 41d436f
Show file tree
Hide file tree
Showing 5 changed files with 35 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 @@ -90,7 +90,7 @@ internal static void Stage02KernelUpdates()
{
FilesystemTools.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
12 changes: 12 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 @@ -181,5 +182,16 @@ public static string GetVersionChangelogs()
return changes;
}

internal static string FetchCurrentChangelogsFromResources()
{
// Get the changelogs from resource
bool exists = ResourcesManager.DataExists("changes.chg", ResourcesType.Misc, out var stream);
if (!exists)
return "";

// Convert the stream to the string and return its contents
string contents = ResourcesManager.ConvertToString(stream);
return contents;
}
}
}
9 changes: 9 additions & 0 deletions public/Nitrocid/Nitrocid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@
</ItemGroup>
<!-- KS Audio Themes -->

<!-- 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
11 changes: 10 additions & 1 deletion public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,16 @@ internal class UESHShellInfo : BaseShellInfo<UESHShell>, IShellInfo
new CommandArgumentInfo(true)
], new CDirCommand()),

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

Check warning on line 180 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 marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized

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

View workflow job for this annotation

GitHub Actions / Make API Reference

This string, "Fetch the changelogs from the internet instead of locally", is marked as localizable, but is unlocalized

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

View workflow job for this annotation

GitHub Actions / Make API Reference

This string, "Fetch the changelogs from the internet instead of locally", is marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized

Check warning on line 180 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 marked as localizable, but is unlocalized
{
AcceptsValues = false
}),
})
], new ChangesCommand()),

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

0 comments on commit 41d436f

Please sign in to comment.