11using System ;
22using System . Collections . Generic ;
33using System . Text . RegularExpressions ;
4+ using System . Windows . Controls ;
45
56namespace Flow . Launcher . Plugin . Url
67{
7- public class Main : IPlugin , IPluginI18n
8+ public class Main : IPlugin , IPluginI18n , ISettingProvider
89 {
910 //based on https://gist.github.com/dperini/729294
1011 private const string urlPattern = "^" +
@@ -58,13 +59,13 @@ public List<Result> Query(Query query)
5859 Score = 8 ,
5960 Action = _ =>
6061 {
61- if ( ! raw . ToLower ( ) . StartsWith ( "http" ) )
62+ if ( ! raw . ToLower ( ) . StartsWith ( GetHttpPreference ( ) ) )
6263 {
63- raw = "http ://" + raw ;
64+ raw = GetHttpPreference ( ) + " ://" + raw ;
6465 }
6566 try
6667 {
67- Context . API . OpenUrl ( raw ) ;
68+ Context . API . OpenUrl ( raw ) ;
6869
6970 return true ;
7071 }
@@ -80,6 +81,11 @@ public List<Result> Query(Query query)
8081 return new List < Result > ( 0 ) ;
8182 }
8283
84+ private string GetHttpPreference ( )
85+ {
86+ return _settings . AlwaysOpenWithHttps ? "https" : "http" ;
87+ }
88+
8389 public bool IsURL ( string raw )
8490 {
8591 raw = raw . ToLower ( ) ;
@@ -113,5 +119,10 @@ public string GetTranslatedPluginDescription()
113119 {
114120 return Localize . flowlauncher_plugin_url_plugin_description ( ) ;
115121 }
122+
123+ public Control CreateSettingPanel ( )
124+ {
125+ return new URLSettings ( _settings ) ;
126+ }
116127 }
117128}
0 commit comments