Skip to content

Check if plugin is modified before querying #3791

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
merged 1 commit into from
Jul 1, 2025
Merged
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
11 changes: 9 additions & 2 deletions Flow.Launcher.Core/Plugin/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

// We should not initialize API in static constructor because it will create another API instance
private static IPublicAPI api = null;
private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService<IPublicAPI>();

Check warning on line 36 in Flow.Launcher.Core/Plugin/PluginManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Ioc` is not a recognized word. (unrecognized-spelling)

private static PluginsSettings Settings;
private static List<PluginMetadata> _metadatas;

Check warning on line 39 in Flow.Launcher.Core/Plugin/PluginManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`metadatas` is not a recognized word. (unrecognized-spelling)
private static readonly List<string> _modifiedPlugins = new();

/// <summary>
Expand Down Expand Up @@ -110,8 +110,8 @@
{
await Task.WhenAll(AllPlugins.Select(plugin => plugin.Plugin switch
{
IReloadable p => Task.Run(p.ReloadData),

Check warning on line 113 in Flow.Launcher.Core/Plugin/PluginManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Reloadable` is not a recognized word. (unrecognized-spelling)
IAsyncReloadable p => p.ReloadDataAsync(),

Check warning on line 114 in Flow.Launcher.Core/Plugin/PluginManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Reloadable` is not a recognized word. (unrecognized-spelling)
_ => Task.CompletedTask,
}).ToArray());
}
Expand Down Expand Up @@ -173,12 +173,12 @@
/// <param name="settings"></param>
public static void LoadPlugins(PluginsSettings settings)
{
_metadatas = PluginConfig.Parse(Directories);

Check warning on line 176 in Flow.Launcher.Core/Plugin/PluginManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`metadatas` is not a recognized word. (unrecognized-spelling)
Settings = settings;
Settings.UpdatePluginSettings(_metadatas);

Check warning on line 178 in Flow.Launcher.Core/Plugin/PluginManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`metadatas` is not a recognized word. (unrecognized-spelling)
AllPlugins = PluginsLoader.Plugins(_metadatas, Settings);

Check warning on line 179 in Flow.Launcher.Core/Plugin/PluginManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`metadatas` is not a recognized word. (unrecognized-spelling)
// Since dotnet plugins need to get assembly name first, we should update plugin directory after loading plugins
UpdatePluginDirectory(_metadatas);

Check warning on line 181 in Flow.Launcher.Core/Plugin/PluginManager.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`metadatas` is not a recognized word. (unrecognized-spelling)
}

private static void UpdatePluginDirectory(List<PluginMetadata> metadatas)
Expand Down Expand Up @@ -290,7 +290,14 @@
return Array.Empty<PluginPair>();

if (!NonGlobalPlugins.TryGetValue(query.ActionKeyword, out var plugin))
return GlobalPlugins;
{
return GlobalPlugins.Where(p => !PluginModified(p.Metadata.ID)).ToList();
}

if (API.PluginModified(plugin.Metadata.ID))
{
return Array.Empty<PluginPair>();
}

return new List<PluginPair>
{
Expand All @@ -300,7 +307,7 @@

public static ICollection<PluginPair> ValidPluginsForHomeQuery()
{
return _homePlugins.ToList();
return _homePlugins.Where(p => !PluginModified(p.Metadata.ID)).ToList();
}

public static async Task<List<Result>> QueryForPluginAsync(PluginPair pair, Query query, CancellationToken token)
Expand Down
Loading