Skip to content

Commit f031454

Browse files
authored
Merge branch 'dev' into ui_wpf_modern
2 parents e175db0 + 9b04989 commit f031454

File tree

238 files changed

+7600
-1218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+7600
-1218
lines changed

.github/workflows/default_plugins.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v5
1414
- name: Setup .NET
15-
uses: actions/setup-dotnet@v4
15+
uses: actions/setup-dotnet@v5
1616
with:
1717
dotnet-version: 9.0.x
1818

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
"**/SolutionAssemblyInfo.cs"
3030
version: ${{ env.FlowVersion }}.${{ env.BUILD_NUMBER }}
3131
- name: Setup .NET
32-
uses: actions/setup-dotnet@v4
32+
uses: actions/setup-dotnet@v5
3333
with:
3434
dotnet-version: 9.0.x
3535
# cache: true

.github/workflows/release_pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v5
1515

16-
- uses: actions/setup-python@v5
16+
- uses: actions/setup-python@v6
1717
with:
1818
python-version: "3.x"
1919

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
issues: write
1919
pull-requests: write
2020
steps:
21-
- uses: actions/stale@v9
21+
- uses: actions/stale@v10
2222
with:
2323
stale-issue-message: 'This issue is stale because it has been open ${{ env.days-before-stale }} days with no activity. Remove stale label or comment or this will be closed in ${{ env.days-before-stale }} days.\n\nAlternatively this issue can be kept open by adding one of the following labels:\n${{ env.exempt-issue-labels }}'
2424
days-before-stale: ${{ env.days-before-stale }}

Flow.Launcher.Core/ExternalPlugins/Environments/PythonEnvironment.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
1111
{
1212
internal class PythonEnvironment : AbstractPluginEnvironment
1313
{
14+
private static readonly string ClassName = nameof(PythonEnvironment);
15+
1416
internal override string Language => AllowedLanguage.Python;
1517

1618
internal override string EnvName => DataLocation.PythonEnvironmentName;
@@ -39,9 +41,20 @@ internal override void InstallEnvironment()
3941

4042
// Python 3.11.4 is no longer Windows 7 compatible. If user is on Win 7 and
4143
// uses Python plugin they need to custom install and use v3.8.9
42-
JTF.Run(() => DroplexPackage.Drop(App.python_3_11_4_embeddable, InstallPath));
44+
JTF.Run(async () =>
45+
{
46+
try
47+
{
48+
await DroplexPackage.Drop(App.python_3_11_4_embeddable, InstallPath);
4349

44-
PluginsSettingsFilePath = ExecutablePath;
50+
PluginsSettingsFilePath = ExecutablePath;
51+
}
52+
catch (System.Exception e)
53+
{
54+
API.ShowMsgError(API.GetTranslation("failToInstallPythonEnv"));
55+
API.LogException(ClassName, "Failed to install Python environment", e);
56+
}
57+
});
4558
}
4659

4760
internal override PluginPair CreatePluginPair(string filePath, PluginMetadata metadata)

Flow.Launcher.Core/ExternalPlugins/Environments/TypeScriptEnvironment.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
1111
{
1212
internal class TypeScriptEnvironment : AbstractPluginEnvironment
1313
{
14+
private static readonly string ClassName = nameof(TypeScriptEnvironment);
15+
1416
internal override string Language => AllowedLanguage.TypeScript;
1517

1618
internal override string EnvName => DataLocation.NodeEnvironmentName;
@@ -34,9 +36,20 @@ internal override void InstallEnvironment()
3436
{
3537
FilesFolders.RemoveFolderIfExists(InstallPath, (s) => API.ShowMsgBox(s));
3638

37-
JTF.Run(() => DroplexPackage.Drop(App.nodejs_16_18_0, InstallPath));
39+
JTF.Run(async () =>
40+
{
41+
try
42+
{
43+
await DroplexPackage.Drop(App.nodejs_16_18_0, InstallPath);
3844

39-
PluginsSettingsFilePath = ExecutablePath;
45+
PluginsSettingsFilePath = ExecutablePath;
46+
}
47+
catch (System.Exception e)
48+
{
49+
API.ShowMsgError(API.GetTranslation("failToInstallTypeScriptEnv"));
50+
API.LogException(ClassName, "Failed to install TypeScript environment", e);
51+
}
52+
});
4053
}
4154

4255
internal override PluginPair CreatePluginPair(string filePath, PluginMetadata metadata)

Flow.Launcher.Core/ExternalPlugins/Environments/TypeScriptV2Environment.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments
1111
{
1212
internal class TypeScriptV2Environment : AbstractPluginEnvironment
1313
{
14+
private static readonly string ClassName = nameof(TypeScriptV2Environment);
15+
1416
internal override string Language => AllowedLanguage.TypeScriptV2;
1517

1618
internal override string EnvName => DataLocation.NodeEnvironmentName;
@@ -34,9 +36,20 @@ internal override void InstallEnvironment()
3436
{
3537
FilesFolders.RemoveFolderIfExists(InstallPath, (s) => API.ShowMsgBox(s));
3638

37-
JTF.Run(() => DroplexPackage.Drop(App.nodejs_16_18_0, InstallPath));
39+
JTF.Run(async () =>
40+
{
41+
try
42+
{
43+
await DroplexPackage.Drop(App.nodejs_16_18_0, InstallPath);
3844

39-
PluginsSettingsFilePath = ExecutablePath;
45+
PluginsSettingsFilePath = ExecutablePath;
46+
}
47+
catch (System.Exception e)
48+
{
49+
API.ShowMsgError(API.GetTranslation("failToInstallTypeScriptEnv"));
50+
API.LogException(ClassName, "Failed to install TypeScript environment", e);
51+
}
52+
});
4053
}
4154

4255
internal override PluginPair CreatePluginPair(string filePath, PluginMetadata metadata)

Flow.Launcher.Core/ExternalPlugins/PluginsManifest.cs

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Threading.Tasks;
55
using CommunityToolkit.Mvvm.DependencyInjection;
66
using Flow.Launcher.Plugin;
7+
using Flow.Launcher.Infrastructure;
78

89
namespace Flow.Launcher.Core.ExternalPlugins
910
{
@@ -12,10 +13,10 @@ public static class PluginsManifest
1213
private static readonly string ClassName = nameof(PluginsManifest);
1314

1415
private static readonly CommunityPluginStore mainPluginStore =
15-
new("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/plugin_api_v2/plugins.json",
16-
"https://fastly.jsdelivr.net/gh/Flow-Launcher/Flow.Launcher.PluginsManifest@plugin_api_v2/plugins.json",
17-
"https://gcore.jsdelivr.net/gh/Flow-Launcher/Flow.Launcher.PluginsManifest@plugin_api_v2/plugins.json",
18-
"https://cdn.jsdelivr.net/gh/Flow-Launcher/Flow.Launcher.PluginsManifest@plugin_api_v2/plugins.json");
16+
new("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json",
17+
"https://fastly.jsdelivr.net/gh/Flow-Launcher/Flow.Launcher.PluginsManifest@main/plugins.json",
18+
"https://gcore.jsdelivr.net/gh/Flow-Launcher/Flow.Launcher.PluginsManifest@main/plugins.json",
19+
"https://cdn.jsdelivr.net/gh/Flow-Launcher/Flow.Launcher.PluginsManifest@main/plugins.json");
1920

2021
private static readonly SemaphoreSlim manifestUpdateLock = new(1);
2122

@@ -39,13 +40,23 @@ public static async Task<bool> UpdateManifestAsync(bool usePrimaryUrlOnly = fals
3940
var results = await mainPluginStore.FetchAsync(token, usePrimaryUrlOnly).ConfigureAwait(false);
4041

4142
// If the results are empty, we shouldn't update the manifest because the results are invalid.
42-
if (results.Count != 0)
43-
{
44-
UserPlugins = results;
45-
lastFetchedAt = DateTime.Now;
43+
if (results.Count == 0)
44+
return false;
4645

47-
return true;
46+
var updatedPluginResults = new List<UserPlugin>();
47+
var appVersion = SemanticVersioning.Version.Parse(Constant.Version);
48+
49+
for (int i = 0; i < results.Count; i++)
50+
{
51+
if (IsMinimumAppVersionSatisfied(results[i], appVersion))
52+
updatedPluginResults.Add(results[i]);
4853
}
54+
55+
UserPlugins = updatedPluginResults;
56+
57+
lastFetchedAt = DateTime.Now;
58+
59+
return true;
4960
}
5061
}
5162
catch (Exception e)
@@ -59,5 +70,28 @@ public static async Task<bool> UpdateManifestAsync(bool usePrimaryUrlOnly = fals
5970

6071
return false;
6172
}
73+
74+
private static bool IsMinimumAppVersionSatisfied(UserPlugin plugin, SemanticVersioning.Version appVersion)
75+
{
76+
if (string.IsNullOrEmpty(plugin.MinimumAppVersion))
77+
return true;
78+
79+
try
80+
{
81+
if (appVersion >= SemanticVersioning.Version.Parse(plugin.MinimumAppVersion))
82+
return true;
83+
}
84+
catch (Exception e)
85+
{
86+
API.LogException(ClassName, $"Failed to parse the minimum app version {plugin.MinimumAppVersion} for plugin {plugin.Name}. "
87+
+ "Plugin excluded from manifest", e);
88+
return false;
89+
}
90+
91+
API.LogInfo(ClassName, $"Plugin {plugin.Name} requires minimum Flow Launcher version {plugin.MinimumAppVersion}, "
92+
+ $"but current version is {Constant.Version}. Plugin excluded from manifest.");
93+
94+
return false;
95+
}
6296
}
6397
}

Flow.Launcher.Core/Plugin/PluginInstaller.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
44
using System.IO.Compression;

Flow.Launcher.Core/Plugin/PluginsLoader.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,9 @@ private static IEnumerable<PluginPair> DotNetPlugins(List<PluginMetadata> source
124124
API.GetTranslation("pluginsHaveErrored") :
125125
API.GetTranslation("pluginHasErrored");
126126

127-
_ = Task.Run(() =>
128-
{
129-
API.ShowMsgBox($"{errorMessage}{Environment.NewLine}{Environment.NewLine}" +
130-
$"{errorPluginString}{Environment.NewLine}{Environment.NewLine}" +
131-
API.GetTranslation("referToLogs"), string.Empty,
132-
MessageBoxButton.OK, MessageBoxImage.Warning);
133-
});
127+
API.ShowMsgError($"{errorMessage}{Environment.NewLine}{Environment.NewLine}" +
128+
$"{errorPluginString}{Environment.NewLine}{Environment.NewLine}" +
129+
API.GetTranslation("referToLogs"));
134130
}
135131

136132
return plugins;

0 commit comments

Comments
 (0)