diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index caac10c93..dd3fb2fca 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -13,7 +13,7 @@ jobs:
issues: write
pull-requests: write
steps:
- - uses: actions/stale@v8
+ - uses: actions/stale@v9
with:
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.'
days-before-stale: 45
diff --git a/Flow.Launcher.Core/Flow.Launcher.Core.csproj b/Flow.Launcher.Core/Flow.Launcher.Core.csproj
index 312dfdd9e..5cd09d407 100644
--- a/Flow.Launcher.Core/Flow.Launcher.Core.csproj
+++ b/Flow.Launcher.Core/Flow.Launcher.Core.csproj
@@ -57,7 +57,7 @@
-
+
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs b/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
index 3ffac1343..3848af6a4 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
@@ -15,11 +15,11 @@ namespace Flow.Launcher.Core.Plugin
public required string SettingPath { get; init; }
public Dictionary SettingControls { get; } = new();
-
+
public IReadOnlyDictionary Inner => Settings;
protected ConcurrentDictionary Settings { get; set; }
public required IPublicAPI API { get; init; }
-
+
private JsonStorage> _storage;
// maybe move to resource?
@@ -37,18 +37,18 @@ namespace Flow.Launcher.Core.Plugin
_storage = new JsonStorage>(SettingPath);
Settings = await _storage.LoadAsync();
- if (Settings != null)
+ if (Settings != null || Configuration == null)
{
return;
}
- foreach (var (type, attributes) in Configuration.Body)
+ foreach (var (type, attributes) in Configuration.Body)
{
if (attributes.Name == null)
{
continue;
}
-
+
if (!Settings.ContainsKey(attributes.Name))
{
Settings[attributes.Name] = attributes.DefaultValue;
@@ -56,7 +56,7 @@ namespace Flow.Launcher.Core.Plugin
}
}
-
+
public void UpdateSettings(IReadOnlyDictionary settings)
{
if (settings == null || settings.Count == 0)
@@ -80,34 +80,35 @@ namespace Flow.Launcher.Core.Plugin
comboBox.Dispatcher.Invoke(() => comboBox.SelectedItem = value);
break;
case CheckBox checkBox:
- checkBox.Dispatcher.Invoke(() => checkBox.IsChecked = value is bool isChecked ? isChecked : bool.Parse(value as string ?? string.Empty));
+ checkBox.Dispatcher.Invoke(() =>
+ checkBox.IsChecked = value is bool isChecked
+ ? isChecked
+ : bool.Parse(value as string ?? string.Empty));
break;
}
}
}
+
Save();
}
-
+
public async Task SaveAsync()
{
await _storage.SaveAsync();
}
-
+
public void Save()
{
_storage.Save();
}
-
+
public Control CreateSettingPanel()
{
- if (Settings == null)
+ if (Settings == null || Settings.Count == 0)
return new();
var settingWindow = new UserControl();
- var mainPanel = new Grid
- {
- Margin = settingPanelMargin, VerticalAlignment = VerticalAlignment.Center
- };
+ var mainPanel = new Grid { Margin = settingPanelMargin, VerticalAlignment = VerticalAlignment.Center };
ColumnDefinition gridCol1 = new ColumnDefinition();
ColumnDefinition gridCol2 = new ColumnDefinition();
@@ -242,10 +243,7 @@ namespace Flow.Launcher.Core.Plugin
Margin = new Thickness(10, 0, 0, 0), Content = "Browse"
};
- var dockPanel = new DockPanel()
- {
- Margin = settingControlMargin
- };
+ var dockPanel = new DockPanel() { Margin = settingControlMargin };
DockPanel.SetDock(Btn, Dock.Right);
dockPanel.Children.Add(Btn);
@@ -352,7 +350,10 @@ namespace Flow.Launcher.Core.Plugin
case "checkbox":
var checkBox = new CheckBox
{
- IsChecked = Settings[attribute.Name] is bool isChecked ? isChecked : bool.Parse(attribute.DefaultValue),
+ IsChecked =
+ Settings[attribute.Name] is bool isChecked
+ ? isChecked
+ : bool.Parse(attribute.DefaultValue),
Margin = settingCheckboxMargin,
HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
ToolTip = attribute.Description
@@ -375,14 +376,12 @@ namespace Flow.Launcher.Core.Plugin
break;
case "hyperlink":
- var hyperlink = new Hyperlink
- {
- ToolTip = attribute.Description, NavigateUri = attribute.url
- };
+ var hyperlink = new Hyperlink { ToolTip = attribute.Description, NavigateUri = attribute.url };
var linkbtn = new System.Windows.Controls.Button
{
- HorizontalAlignment = System.Windows.HorizontalAlignment.Right, Margin = settingControlMargin
+ HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
+ Margin = settingControlMargin
};
linkbtn.Content = attribute.urlLabel;
@@ -408,12 +407,9 @@ namespace Flow.Launcher.Core.Plugin
mainPanel.Children.Add(panel);
mainPanel.Children.Add(contentControl);
rowCount++;
-
}
return settingWindow;
}
-
-
}
}
diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs b/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs
index 60130843e..390da072b 100644
--- a/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs
+++ b/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs
@@ -91,7 +91,7 @@ namespace Flow.Launcher.Core.Plugin
private void SetupJsonRPC()
{
- var formatter = new JsonMessageFormatter();
+ var formatter = new SystemTextJsonFormatter { JsonSerializerOptions = RequestSerializeOption };
var handler = new NewLineDelimitedMessageHandler(ClientPipe,
formatter);
@@ -100,10 +100,8 @@ namespace Flow.Launcher.Core.Plugin
RPC.AddLocalRpcMethod("UpdateResults", new Action((rawQuery, response) =>
{
var results = ParseResults(response);
- ResultsUpdated?.Invoke(this, new ResultUpdatedEventArgs { Query = new Query()
- {
- RawQuery = rawQuery
- }, Results = results });
+ ResultsUpdated?.Invoke(this,
+ new ResultUpdatedEventArgs { Query = new Query() { RawQuery = rawQuery }, Results = results });
}));
RPC.SynchronizationContext = null;
RPC.StartListening();