Repository navigation
Improve the Software Catalog and Catalog Editor #5517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Gabriel Dufresne (GabrielDuf)
merged 15 commits into
main
from
catalog-editor-improvements
Oct 14, 2026
+1,544
−218
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
27fd740
Improve the Software Catalog and Catalog Editor experience
GabrielDuf 23856b4
Fix catalog review findings: quit hang, first run, startup and refresh
GabrielDuf b725218
Fix remaining catalog review findings
GabrielDuf 1b570ff
Load the catalog document when Discover is the startup page
GabrielDuf d00a099
Support version pins in the Software Catalog
GabrielDuf 962e7a6
Reload the Software Catalog when its file changes
GabrielDuf 51a4b23
Explain why the Software Catalog could not be loaded
GabrielDuf 549b003
Add Update, Uninstall and Details actions to catalog tiles
GabrielDuf 5bfc5fe
Don't crash when assistive technology invokes a disabled control
GabrielDuf d8560c4
Only open on the Software Catalog when a catalog is set up
GabrielDuf 5b900e8
Centre the dots on the catalog tiles' More actions button
GabrielDuf 3fe6415
Match the catalog lookup test to the "Latest" version label
GabrielDuf 75b0d6d
Save the machine-wide catalog through UAC on Windows
GabrielDuf bf9bd62
Fix catalog review findings: details actions, pins, first run, late m…
GabrielDuf abbac9c
Name the catalog signature's JSON type info explicitly
GabrielDuf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/UniGetUI.Avalonia/Infrastructure/MacAdminFileInstaller.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| using System.Diagnostics; | ||
| using System.Runtime.Versioning; | ||
|
|
||
| namespace UniGetUI.Avalonia.Infrastructure; | ||
|
|
||
| /// <summary> | ||
| /// Writes a file to a root-owned location on macOS through the system administrator prompt. | ||
| /// </summary> | ||
| [SupportedOSPlatform("macos")] | ||
| internal static class MacAdminFileInstaller | ||
| { | ||
| private const int UserCanceledError = -128; | ||
|
|
||
| /// <summary> | ||
| /// Copies <paramref name="contents"/> to <paramref name="destination"/> as root, creating its folder. | ||
| /// <paramref name="prompt"/> is shown in the password dialog. Returns false when the user cancels it. | ||
| /// </summary> | ||
| public static async Task<bool> WriteAsync(string destination, string contents, string prompt) | ||
| { | ||
| string stagingDirectory = Directory.CreateTempSubdirectory("unigetui-admin-write-").FullName; | ||
| try | ||
| { | ||
| string staged = Path.Combine(stagingDirectory, Path.GetFileName(destination)); | ||
| await File.WriteAllTextAsync(staged, contents); | ||
|
|
||
| string folder = Path.GetDirectoryName(destination)!; | ||
| string command = $"/bin/mkdir -p {ShellQuote(folder)} && /usr/bin/install -m 0644 {ShellQuote(staged)} {ShellQuote(destination)}"; | ||
| var startInfo = new ProcessStartInfo("/usr/bin/osascript") | ||
| { | ||
| RedirectStandardError = true, | ||
| RedirectStandardOutput = true, | ||
| UseShellExecute = false, | ||
| }; | ||
| startInfo.ArgumentList.Add("-e"); | ||
| startInfo.ArgumentList.Add($"do shell script \"{AppleScriptEscape(command)}\" with prompt \"{AppleScriptEscape(prompt)}\" with administrator privileges"); | ||
|
|
||
| using var process = Process.Start(startInfo) | ||
| ?? throw new IOException("Could not start the administrator prompt."); | ||
| string error = await process.StandardError.ReadToEndAsync(); | ||
| await process.WaitForExitAsync(); | ||
| if (process.ExitCode == 0) return true; | ||
| if (error.Contains($"({UserCanceledError})", StringComparison.Ordinal)) return false; | ||
| throw new IOException(error.Trim()); | ||
| } | ||
| finally | ||
| { | ||
| try { Directory.Delete(stagingDirectory, recursive: true); } | ||
| catch { /* best effort cleanup of a temp folder */ } | ||
| } | ||
| } | ||
|
|
||
| internal static string ShellQuote(string value) => "'" + value.Replace("'", "'\\''") + "'"; | ||
|
|
||
| internal static string AppleScriptEscape(string value) => value.Replace("\\", "\\\\").Replace("\"", "\\\""); | ||
| } |
60 changes: 60 additions & 0 deletions
60
src/UniGetUI.Avalonia/Infrastructure/WindowsAdminFileInstaller.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| using System.ComponentModel; | ||
| using System.Diagnostics; | ||
| using System.Runtime.Versioning; | ||
| using UniGetUI.Core.Tools; | ||
|
|
||
| namespace UniGetUI.Avalonia.Infrastructure; | ||
|
|
||
| [SupportedOSPlatform("windows")] | ||
| internal static class WindowsAdminFileInstaller | ||
| { | ||
| private const int ErrorCancelled = 1223; | ||
| private const int RobocopyFirstFailureCode = 8; | ||
|
|
||
| public static async Task<bool> WriteAsync(string destination, string contents) | ||
| { | ||
| string stagingDirectory = Directory.CreateTempSubdirectory("unigetui-admin-write-").FullName; | ||
| try | ||
| { | ||
| await File.WriteAllTextAsync(Path.Combine(stagingDirectory, Path.GetFileName(destination)), contents); | ||
|
|
||
| using var process = new Process { StartInfo = CreateStartInfo(stagingDirectory, destination) }; | ||
| CoreTools.PrepareForegroundForElevation(); | ||
| try | ||
| { | ||
| process.Start(); | ||
| } | ||
| catch (Win32Exception ex) when (ex.NativeErrorCode == ErrorCancelled) | ||
| { | ||
| return false; | ||
| } | ||
| await process.WaitForExitAsync(); | ||
| if (process.ExitCode >= RobocopyFirstFailureCode) | ||
| throw new IOException(CoreTools.Translate("Could not copy the file to {0} as an administrator (robocopy exit code {1}).", | ||
| destination, process.ExitCode)); | ||
| return true; | ||
| } | ||
| finally | ||
| { | ||
| try { Directory.Delete(stagingDirectory, recursive: true); } | ||
| catch { } | ||
| } | ||
| } | ||
|
|
||
| internal static ProcessStartInfo CreateStartInfo(string stagingDirectory, string destination) | ||
| { | ||
| var startInfo = new ProcessStartInfo(Path.Combine(Environment.SystemDirectory, "robocopy.exe")) | ||
| { | ||
| UseShellExecute = true, | ||
| Verb = "runas", | ||
| WindowStyle = ProcessWindowStyle.Hidden, | ||
| }; | ||
| foreach (string argument in new[] | ||
| { | ||
| stagingDirectory, Path.GetDirectoryName(destination)!, Path.GetFileName(destination), | ||
| "/IS", "/IT", "/R:0", "/W:0", "/NP", "/NJH", "/NJS", | ||
| }) | ||
| startInfo.ArgumentList.Add(argument); | ||
| return startInfo; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.