Skip to content

Commit e6c4cc2

Browse files
authored
Merge pull request #4037 from AWAS666/httpspref
Prefer https over http setting for url
2 parents eb261f5 + 1e3306e commit e6c4cc2

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

Plugins/Flow.Launcher.Plugin.Url/Languages/en.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@
1919
<system:String x:Key="flowlauncher_plugin_url_new_window">New window</system:String>
2020

2121
<system:String x:Key="flowlauncher_plugin_url_private_mode">Private mode</system:String>
22+
23+
<system:String x:Key="flowlauncher_plugin_url_usehttps">Prefer https over http</system:String>
2224
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.Url/Main.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public List<Result> Query(Query query)
6060
Score = 8,
6161
Action = _ =>
6262
{
63-
if (!raw.StartsWith("http", StringComparison.OrdinalIgnoreCase))
63+
if (!raw.StartsWith("http://", StringComparison.OrdinalIgnoreCase) && !raw.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
6464
{
65-
raw = "http://" + raw;
65+
raw = GetHttpPreference() + "://" + raw;
6666
}
6767
try
6868
{
@@ -97,6 +97,11 @@ public List<Result> Query(Query query)
9797
return [];
9898
}
9999

100+
private static string GetHttpPreference()
101+
{
102+
return Settings.AlwaysOpenWithHttps ? "https" : "http";
103+
}
104+
100105
public bool IsURL(string raw)
101106
{
102107
raw = raw.ToLower();

Plugins/Flow.Launcher.Plugin.Url/Settings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,7 @@ public bool OpenInNewBrowserWindow
4747
public bool OpenInPrivateMode { get; set; } = false;
4848

4949
public string PrivateModeArgument { get; set; } = string.Empty;
50+
51+
public bool AlwaysOpenWithHttps { get; set; } = false;
5052
}
5153
}

Plugins/Flow.Launcher.Plugin.Url/SettingsControl.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<Grid.RowDefinitions>
2020
<RowDefinition Height="auto" />
2121
<RowDefinition Height="auto" />
22+
<RowDefinition Height="auto" />
2223
</Grid.RowDefinitions>
2324

2425
<CheckBox
@@ -113,5 +114,13 @@
113114
IsChecked="{Binding Settings.OpenInPrivateMode, Mode=TwoWay}" />
114115
</Grid>
115116
</Grid>
117+
118+
<CheckBox
119+
Grid.Row="2"
120+
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
121+
HorizontalAlignment="Left"
122+
VerticalAlignment="Center"
123+
Content="{DynamicResource flowlauncher_plugin_url_usehttps}"
124+
IsChecked="{Binding Settings.AlwaysOpenWithHttps, Mode=TwoWay}" />
116125
</Grid>
117126
</UserControl>

0 commit comments

Comments
 (0)