Merge pull request #4037 from AWAS666/httpspref

Prefer https over http setting for url
This commit is contained in:
Jack Ye 2025-10-12 13:41:29 +08:00 committed by GitHub
commit e6c4cc25e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 2 deletions

View file

@ -19,4 +19,6 @@
<system:String x:Key="flowlauncher_plugin_url_new_window">New window</system:String>
<system:String x:Key="flowlauncher_plugin_url_private_mode">Private mode</system:String>
<system:String x:Key="flowlauncher_plugin_url_usehttps">Prefer https over http</system:String>
</ResourceDictionary>

View file

@ -60,9 +60,9 @@ namespace Flow.Launcher.Plugin.Url
Score = 8,
Action = _ =>
{
if (!raw.StartsWith("http", StringComparison.OrdinalIgnoreCase))
if (!raw.StartsWith("http://", StringComparison.OrdinalIgnoreCase) && !raw.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
{
raw = "http://" + raw;
raw = GetHttpPreference() + "://" + raw;
}
try
{
@ -97,6 +97,11 @@ namespace Flow.Launcher.Plugin.Url
return [];
}
private static string GetHttpPreference()
{
return Settings.AlwaysOpenWithHttps ? "https" : "http";
}
public bool IsURL(string raw)
{
raw = raw.ToLower();

View file

@ -47,5 +47,7 @@
public bool OpenInPrivateMode { get; set; } = false;
public string PrivateModeArgument { get; set; } = string.Empty;
public bool AlwaysOpenWithHttps { get; set; } = false;
}
}

View file

@ -19,6 +19,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<CheckBox
@ -113,5 +114,13 @@
IsChecked="{Binding Settings.OpenInPrivateMode, Mode=TwoWay}" />
</Grid>
</Grid>
<CheckBox
Grid.Row="2"
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Content="{DynamicResource flowlauncher_plugin_url_usehttps}"
IsChecked="{Binding Settings.AlwaysOpenWithHttps, Mode=TwoWay}" />
</Grid>
</UserControl>