Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions src/Languages/lang_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,112 @@
"This option WILL cause issues. Any operation incapable of elevating itself WILL FAIL. Install/update/uninstall as administrator will NOT WORK.": "This option WILL cause issues. Any operation incapable of elevating itself WILL FAIL. Install/update/uninstall as administrator will NOT WORK.",
"Delegate package operations to the Devolutions Agent broker": "Delegate package operations to the Devolutions Agent broker",
"When enabled, install, update and uninstall operations for supported package managers will be performed by the Devolutions Agent service instead of requesting UAC elevation. Operations will fail unless the agent is installed and running.": "When enabled, install, update and uninstall operations for supported package managers will be performed by the Devolutions Agent service instead of requesting UAC elevation. Operations will fail unless the agent is installed and running.",
"Inspect active package broker policy": "Inspect active package broker policy",
"Check Devolutions Agent reachability and review the policy currently enforced for package operations.": "Check Devolutions Agent reachability and review the policy currently enforced for package operations.",
"Active package broker policy": "Active package broker policy",
"Loading active package broker policy": "Loading active package broker policy",
"Contacting the Devolutions Agent service.": "Contacting the Devolutions Agent service.",
"Devolutions Agent is unavailable": "Devolutions Agent is unavailable",
"The package broker could not be reached. Verify that Devolutions Agent is installed and running, then refresh.": "The package broker could not be reached. Verify that Devolutions Agent is installed and running, then refresh.",
"Policy inspection is unsupported": "Policy inspection is unsupported",
"The installed Devolutions Agent is reachable but does not support active policy inspection. Update the Agent and try again.": "The installed Devolutions Agent is reachable but does not support active policy inspection. Update the Agent and try again.",
"Access to the active policy was denied": "Access to the active policy was denied",
"Devolutions Agent did not authorize UniGetUI to inspect the active package policy.": "Devolutions Agent did not authorize UniGetUI to inspect the active package policy.",
"The active policy is unavailable": "The active policy is unavailable",
"Devolutions Agent supports policy inspection but could not provide the active policy. Review the Agent configuration and try again.": "Devolutions Agent supports policy inspection but could not provide the active policy. Review the Agent configuration and try again.",
"The policy response is invalid": "The policy response is invalid",
"Devolutions Agent returned a malformed or incompatible policy response.": "Devolutions Agent returned a malformed or incompatible policy response.",
"Policy inspection is available on Windows only": "Policy inspection is available on Windows only",
"This page cannot contact the Windows Devolutions Agent service on the current platform.": "This page cannot contact the Windows Devolutions Agent service on the current platform.",
"Connected to Devolutions Agent": "Connected to Devolutions Agent",
"The active package broker policy was loaded successfully.": "The active package broker policy was loaded successfully.",
"Refresh": "Refresh",
"Refresh active policy": "Refresh active policy",
"Policy metadata": "Policy metadata",
"Enforcement": "Enforcement",
"Rules": "Rules",
"The active policy contains no rules.": "The active policy contains no rules.",
"Canonical policy JSON": "Canonical policy JSON",
"Copy canonical policy JSON to clipboard": "Copy canonical policy JSON to clipboard",
"Server version": "Server version",
"Policy ID": "Policy ID",
"Revision": "Revision",
"Policy version": "Policy version",
"Published": "Published",
"Valid from": "Valid from",
"Valid until": "Valid until",
"Description": "Description",
"Support URL": "Support URL",
"Default decision": "Default decision",
"Rule precedence": "Rule precedence",
"Audit mode": "Audit mode",
"Rule {0}: {1}": "Rule {0}: {1}",
"Rule ID": "Rule ID",
"Priority": "Priority",
"Decision": "Decision",
"Reason": "Reason",
"Match criteria": "Match criteria",
"Constraints": "Constraints",
"Package managers": "Package managers",
"Package identifiers": "Package identifiers",
"Package names": "Package names",
"Versions": "Versions",
"Version range": "Version range",
"Scopes": "Scopes",
"Architectures": "Architectures",
"Elevation": "Elevation",
"Interactive": "Interactive",
"Prerelease": "Prerelease",
"Has custom parameters": "Has custom parameters",
"Has custom install location": "Has custom install location",
"Has pre/post commands": "Has pre/post commands",
"Has kill-before-operation": "Has kill-before-operation",
"Has uninstall previous": "Has uninstall previous",
"Allow interactive": "Allow interactive",
"Allow skip hash check": "Allow skip hash check",
"Allow prerelease": "Allow prerelease",
"Allow custom install location": "Allow custom install location",
"Allowed install location patterns": "Allowed install location patterns",
"Allow custom parameters": "Allow custom parameters",
"Allowed custom parameters": "Allowed custom parameters",
"Allowed custom parameter patterns": "Allowed custom parameter patterns",
"Denied custom parameters": "Denied custom parameters",
"Allow pre/post commands": "Allow pre/post commands",
"Allow kill-before-operation": "Allow kill-before-operation",
"Allow uninstall previous": "Allow uninstall previous",
"Allow upgrade": "Allow upgrade",
"Not set": "Not set",
"Any": "Any",
"None": "None",
"{0} to {1}; include prerelease: {2}": "{0} to {1}; include prerelease: {2}",
"Allow": "Allow",
"Deny": "Deny",
"PriorityThenDeny": "Priority, then deny",
"Winget": "WinGet",
"PowerShell": "PowerShell",
"PowerShell7": "PowerShell 7",
"Apt": "APT",
"Bun": "Bun",
"Cargo": "Cargo",
"Chocolatey": "Chocolatey",
"Dnf": "DNF",
"Dotnet": ".NET Tool",
"Flatpak": "Flatpak",
"Homebrew": "Homebrew",
"Npm": "npm",
"Pacman": "Pacman",
"Pip": "Pip",
"Scoop": "Scoop",
"Snap": "Snap",
"Vcpkg": "Vcpkg",
"User": "User",
"Machine": "Machine",
"X86": "x86",
"X64": "x64",
"Arm64": "ARM64",
"Neutral": "Neutral",
"Standard": "Standard",
"Elevated": "Elevated",
"Allow custom command-line arguments": "Allow custom command-line arguments",
"Custom command-line arguments can change the way in which programs are installed, upgraded or uninstalled, in a way UniGetUI cannot control. Using custom command-lines can break packages. Proceed with caution.": "Custom command-line arguments can change the way in which programs are installed, upgraded or uninstalled, in a way UniGetUI cannot control. Using custom command-lines can break packages. Proceed with caution.",
"Ignore custom pre-install and post-install commands when importing packages from a bundle": "Ignore custom pre-install and post-install commands when importing packages from a bundle",
Expand Down
16 changes: 15 additions & 1 deletion src/UniGetUI.Avalonia/Infrastructure/SettingsSearchIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ public sealed class SettingsSearchResult
/// </summary>
public static class SettingsSearchIndex
{
private sealed record Entry(string Title, string[] Keywords, Type PageType, string? Anchor);
private sealed record Entry(
string Title,
string[] Keywords,
Type PageType,
string? Anchor,
bool WindowsOnly = false);

// Order matters only as a tie-break for equally-ranked matches.
private static readonly Entry[] Entries =
Expand Down Expand Up @@ -109,6 +114,7 @@ private sealed record Entry(string Title, string[] Keywords, Type PageType, stri
new("Ask for administrator privileges once for each batch of operations", ["administrator", "admin rights", "elevation", "uac", "batch"], typeof(Administrator), "AdminElevationCard"),
new("Ask only once for administrator privileges", ["admin once", "cache admin rights"], typeof(Administrator), "CacheAdminOnceCard"),
new("Prohibit any kind of Elevation via UniGetUI Elevator or GSudo", ["prohibit elevation", "no elevation"], typeof(Administrator), "ProhibitElevationCard"),
new("Inspect active package broker policy", ["policy", "package broker", "devolutions agent", "rules", "enforcement"], typeof(AgentPolicyInspector), null, WindowsOnly: true),
new("Allow custom command-line arguments", ["command line arguments", "cli arguments"], typeof(Administrator), "AdminRestrictionsOpsCard"),
new("Ignore custom pre-install and post-install commands when importing packages from a bundle", ["pre-install commands", "post-install commands"], typeof(Administrator), "PrePostCommandCard"),
new("Allow changing the paths for package manager executables", ["manager paths", "executable path"], typeof(Administrator), "AdminManagerPathsCard"),
Expand All @@ -132,6 +138,11 @@ private sealed record Entry(string Title, string[] Keywords, Type PageType, stri
private const int NoMatch = int.MaxValue;

public static IReadOnlyList<SettingsSearchResult> Search(string query, int limit = 8)
{
return Search(query, limit, OperatingSystem.IsWindows());
}

internal static IReadOnlyList<SettingsSearchResult> Search(string query, int limit, bool isWindows)
{
var queryWords = Tokenize(query);
if (queryWords.Count == 0) return [];
Expand All @@ -140,6 +151,8 @@ public static IReadOnlyList<SettingsSearchResult> Search(string query, int limit

foreach (var e in Entries)
{
if (e.WindowsOnly && !isWindows) continue;

int score = Rank(queryWords, CoreTools.Translate(e.Title), e.Title, e.Keywords);
if (score < NoMatch)
scored.Add((score, new SettingsSearchResult
Expand Down Expand Up @@ -263,6 +276,7 @@ void Flush()
nameof(Internet) => "Internet connection settings",
nameof(Backup) => "Package backup",
nameof(Administrator) => "Administrator rights and other dangerous settings",
nameof(AgentPolicyInspector) => "Active package broker policy",
nameof(Experimental) => "Experimental settings and developer options",
_ => "UniGetUI Settings",
});
Expand Down
3 changes: 3 additions & 0 deletions src/UniGetUI.Avalonia/InternalsVisibleTo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("UniGetUI.Tests")]
1 change: 1 addition & 0 deletions src/UniGetUI.Avalonia/UniGetUI.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
<ProjectReference Include="..\UniGetUI.Interface.Enums\UniGetUI.Interface.Enums.csproj" />
<ProjectReference Include="..\UniGetUI.Interface.IpcApi\UniGetUI.Interface.IpcApi.csproj" />
<ProjectReference Include="..\UniGetUI.Interface.Telemetry\UniGetUI.Interface.Telemetry.csproj" />
<ProjectReference Include="..\UniGetUI.PackageEngine.AgentBroker\UniGetUI.PackageEngine.AgentBroker.csproj" />
<ProjectReference Include="..\UniGetUI.PackageEngine.PackageEngine\UniGetUI.PackageEngine.PEInterface.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using UniGetUI.Avalonia.ViewModels;
using UniGetUI.Avalonia.Views.Pages.SettingsPages;
using UniGetUI.Core.SettingsEngine;
using UniGetUI.Core.SettingsEngine.SecureSettings;
using UniGetUI.Core.Tools;
Expand All @@ -10,6 +11,7 @@ namespace UniGetUI.Avalonia.ViewModels.Pages.SettingsPages;
public partial class AdministratorViewModel : ViewModelBase
{
public event EventHandler? RestartRequired;
public event EventHandler<Type>? NavigationRequested;

// ── Warning banner strings ────────────────────────────────────────────
public string WarningTitle { get; } = CoreTools.Translate("Warning") + "!";
Expand Down Expand Up @@ -67,4 +69,8 @@ private void RefreshPrePostState()
{
IsPrePostCommandsEnabled = SecureSettings.Get(SecureSettings.K.AllowPrePostOpCommand);
}

[RelayCommand]
private void NavigateToAgentPolicyInspector() =>
NavigationRequested?.Invoke(this, typeof(AgentPolicyInspector));
}
Loading
Loading