Skip to content

Commit 029fe37

Browse files
authored
Merge branch 'dev' into volume
2 parents 04291fd + 0ab26d6 commit 029fe37

File tree

165 files changed

+3449
-2210
lines changed

Some content is hidden

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

165 files changed

+3449
-2210
lines changed

.github/workflows/default_plugins.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
dotnet-version: 7.0.x
1919

2020
- name: Determine New Plugin Updates
21-
uses: dorny/paths-filter@v2
21+
uses: dorny/paths-filter@v3
2222
id: changes
2323
with:
2424
filters: |

.github/workflows/stale.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
schedule:
77
- cron: '30 1 * * *'
88

9+
env:
10+
days-before-stale: 60
11+
days-before-close: 7
12+
exempt-issue-labels: 'keep-fresh'
13+
914
jobs:
1015
stale:
1116
runs-on: ubuntu-latest
@@ -15,12 +20,12 @@ jobs:
1520
steps:
1621
- uses: actions/stale@v9
1722
with:
18-
stale-issue-message: 'This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
19-
days-before-stale: 45
20-
days-before-close: 7
23+
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 }}'
24+
days-before-stale: ${{ env.days-before-stale }}
25+
days-before-close: ${{ env.days-before-close }}
2126
days-before-pr-close: -1
2227
exempt-all-milestones: true
2328
close-issue-message: 'This issue was closed because it has been stale for 7 days with no activity. If you feel this issue still needs attention please feel free to reopen.'
2429
stale-pr-label: 'no-pr-activity'
25-
exempt-issue-labels: 'keep-fresh'
30+
exempt-issue-labels: ${{ env.exempt-issue-labels }}
2631
exempt-pr-labels: 'keep-fresh,awaiting-approval,work-in-progress'

Flow.Launcher.Core/ExternalPlugins/CommunityPluginSource.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
using System.Net;
66
using System.Net.Http;
77
using System.Net.Http.Json;
8+
using System.Text.Json;
9+
using System.Text.Json.Serialization;
810
using System.Threading;
911
using System.Threading.Tasks;
1012

@@ -16,6 +18,11 @@ public record CommunityPluginSource(string ManifestFileUrl)
1618

1719
private List<UserPlugin> plugins = new();
1820

21+
private static JsonSerializerOptions PluginStoreItemSerializationOption = new JsonSerializerOptions()
22+
{
23+
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault
24+
};
25+
1926
/// <summary>
2027
/// Fetch and deserialize the contents of a plugins.json file found at <see cref="ManifestFileUrl"/>.
2128
/// We use conditional http requests to keep repeat requests fast.
@@ -32,12 +39,15 @@ public async Task<List<UserPlugin>> FetchAsync(CancellationToken token)
3239

3340
request.Headers.Add("If-None-Match", latestEtag);
3441

35-
using var response = await Http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, token).ConfigureAwait(false);
42+
using var response = await Http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, token)
43+
.ConfigureAwait(false);
3644

3745
if (response.StatusCode == HttpStatusCode.OK)
3846
{
39-
this.plugins = await response.Content.ReadFromJsonAsync<List<UserPlugin>>(cancellationToken: token).ConfigureAwait(false);
40-
this.latestEtag = response.Headers.ETag.Tag;
47+
this.plugins = await response.Content
48+
.ReadFromJsonAsync<List<UserPlugin>>(PluginStoreItemSerializationOption, cancellationToken: token)
49+
.ConfigureAwait(false);
50+
this.latestEtag = response.Headers.ETag?.Tag;
4151

4252
Log.Info(nameof(CommunityPluginSource), $"Loaded {this.plugins.Count} plugins from {ManifestFileUrl}");
4353
return this.plugins;
@@ -49,7 +59,8 @@ public async Task<List<UserPlugin>> FetchAsync(CancellationToken token)
4959
}
5060
else
5161
{
52-
Log.Warn(nameof(CommunityPluginSource), $"Failed to load resource {ManifestFileUrl} with response {response.StatusCode}");
62+
Log.Warn(nameof(CommunityPluginSource),
63+
$"Failed to load resource {ManifestFileUrl} with response {response.StatusCode}");
5364
throw new Exception($"Failed to load resource {ManifestFileUrl} with response {response.StatusCode}");
5465
}
5566
}

Flow.Launcher.Core/ExternalPlugins/UserPlugin.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public record UserPlugin
1414
public string UrlDownload { get; set; }
1515
public string UrlSourceCode { get; set; }
1616
public string IcoPath { get; set; }
17-
public DateTime LatestReleaseDate { get; set; }
18-
public DateTime DateAdded { get; set; }
17+
public DateTime? LatestReleaseDate { get; set; }
18+
public DateTime? DateAdded { get; set; }
1919

2020
}
2121
}

Flow.Launcher.Core/Flow.Launcher.Core.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@
5555
<ItemGroup>
5656
<PackageReference Include="Droplex" Version="1.7.0" />
5757
<PackageReference Include="FSharp.Core" Version="7.0.401" />
58-
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.3.2" />
58+
<PackageReference Include="Meziantou.Framework.Win32.Jobs" Version="3.2.1" />
59+
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.0" />
5960
<PackageReference Include="squirrel.windows" Version="1.5.2" NoWarn="NU1701" />
60-
<PackageReference Include="StreamJsonRpc" Version="2.17.8" />
61+
<PackageReference Include="StreamJsonRpc" Version="2.17.11" />
6162
</ItemGroup>
6263

6364
<ItemGroup>

Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public async Task InitializeAsync()
3737
_storage = new JsonStorage<ConcurrentDictionary<string, object>>(SettingPath);
3838
Settings = await _storage.LoadAsync();
3939

40-
if (Settings != null || Configuration == null)
40+
if (Configuration == null)
4141
{
4242
return;
4343
}

Flow.Launcher.Core/Plugin/NodePlugin.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,21 @@ public NodePlugin(string filename)
2828

2929
protected override Task<Stream> RequestAsync(JsonRPCRequestModel request, CancellationToken token = default)
3030
{
31-
_startInfo.ArgumentList[1] = JsonSerializer.Serialize(request);
31+
_startInfo.ArgumentList[1] = JsonSerializer.Serialize(request, RequestSerializeOption);
3232
return ExecuteAsync(_startInfo, token);
3333
}
3434

3535
protected override string Request(JsonRPCRequestModel rpcRequest, CancellationToken token = default)
3636
{
3737
// since this is not static, request strings will build up in ArgumentList if index is not specified
38-
_startInfo.ArgumentList[1] = JsonSerializer.Serialize(rpcRequest);
38+
_startInfo.ArgumentList[1] = JsonSerializer.Serialize(rpcRequest, RequestSerializeOption);
3939
return Execute(_startInfo);
4040
}
4141

4242
public override async Task InitAsync(PluginInitContext context)
4343
{
4444
_startInfo.ArgumentList.Add(context.CurrentPluginMetadata.ExecuteFilePath);
45+
_startInfo.ArgumentList.Add(string.Empty);
4546
_startInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
4647
await base.InitAsync(context);
4748
}

Flow.Launcher.Core/Plugin/ProcessStreamPluginV2.cs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,24 @@
55
using System.Threading.Tasks;
66
using Flow.Launcher.Infrastructure;
77
using Flow.Launcher.Plugin;
8+
using Meziantou.Framework.Win32;
89
using Nerdbank.Streams;
910

1011
namespace Flow.Launcher.Core.Plugin
1112
{
1213
internal abstract class ProcessStreamPluginV2 : JsonRPCPluginV2
1314
{
15+
private static JobObject _jobObject = new JobObject();
16+
17+
static ProcessStreamPluginV2()
18+
{
19+
_jobObject.SetLimits(new JobObjectLimits()
20+
{
21+
Flags = JobObjectLimitFlags.KillOnJobClose | JobObjectLimitFlags.DieOnUnhandledException
22+
});
23+
24+
_jobObject.AssignProcess(Process.GetCurrentProcess());
25+
}
1426

1527
public override string SupportedLanguage { get; set; }
1628
protected sealed override IDuplexPipe ClientPipe { get; set; }
@@ -30,22 +42,22 @@ public override async Task InitAsync(PluginInitContext context)
3042

3143
ClientProcess = Process.Start(StartInfo);
3244
ArgumentNullException.ThrowIfNull(ClientProcess);
33-
45+
3446
SetupPipe(ClientProcess);
3547

3648
ErrorStream = ClientProcess.StandardError;
3749

3850
await base.InitAsync(context);
3951
}
40-
52+
4153
private void SetupPipe(Process process)
4254
{
4355
var (reader, writer) = (PipeReader.Create(process.StandardOutput.BaseStream),
4456
PipeWriter.Create(process.StandardInput.BaseStream));
4557
ClientPipe = new DuplexPipe(reader, writer);
4658
}
47-
48-
59+
60+
4961
public override async Task ReloadDataAsync()
5062
{
5163
var oldProcess = ClientProcess;
@@ -57,8 +69,8 @@ public override async Task ReloadDataAsync()
5769
await oldProcess.WaitForExitAsync();
5870
oldProcess.Dispose();
5971
}
60-
61-
72+
73+
6274
public override async ValueTask DisposeAsync()
6375
{
6476
ClientProcess.Kill(true);

Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
</PropertyGroup>
1515

1616
<PropertyGroup>
17-
<Version>4.1.1</Version>
18-
<PackageVersion>4.1.1</PackageVersion>
19-
<AssemblyVersion>4.1.1</AssemblyVersion>
20-
<FileVersion>4.1.1</FileVersion>
17+
<Version>4.2.0</Version>
18+
<PackageVersion>4.2.0</PackageVersion>
19+
<AssemblyVersion>4.2.0</AssemblyVersion>
20+
<FileVersion>4.2.0</FileVersion>
2121
<PackageId>Flow.Launcher.Plugin</PackageId>
2222
<Authors>Flow-Launcher</Authors>
2323
<PackageLicenseExpression>MIT</PackageLicenseExpression>

Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,11 @@ internal class BoolToIMEConversionModeConverter : IValueConverter
99
{
1010
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1111
{
12-
if (value is bool v)
12+
return value switch
1313
{
14-
if (v)
15-
{
16-
return ImeConversionModeValues.Alphanumeric;
17-
}
18-
else
19-
{
20-
return ImeConversionModeValues.DoNotCare;
21-
}
22-
}
23-
return ImeConversionModeValues.DoNotCare;
14+
true => ImeConversionModeValues.Alphanumeric,
15+
_ => ImeConversionModeValues.DoNotCare
16+
};
2417
}
2518

2619
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
@@ -33,18 +26,11 @@ internal class BoolToIMEStateConverter : IValueConverter
3326
{
3427
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
3528
{
36-
if (value is bool v)
29+
return value switch
3730
{
38-
if (v)
39-
{
40-
return InputMethodState.Off;
41-
}
42-
else
43-
{
44-
return InputMethodState.DoNotCare;
45-
}
46-
}
47-
return InputMethodState.DoNotCare;
31+
true => InputMethodState.Off,
32+
_ => InputMethodState.DoNotCare
33+
};
4834
}
4935

5036
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

0 commit comments

Comments
 (0)