File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed
Flow.Launcher.Core/ExternalPlugins
Flow.Launcher.Infrastructure/Http Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public record CommunityPluginSource(string ManifestFileUrl)
19
19
20
20
private List < UserPlugin > plugins = new ( ) ;
21
21
22
- private static JsonSerializerOptions PluginStoreItemSerializationOption = new JsonSerializerOptions ( )
22
+ private static readonly JsonSerializerOptions PluginStoreItemSerializationOption = new ( )
23
23
{
24
24
DefaultIgnoreCondition = JsonIgnoreCondition . WhenWritingDefault
25
25
} ;
@@ -45,18 +45,18 @@ public async Task<List<UserPlugin>> FetchAsync(CancellationToken token)
45
45
46
46
if ( response . StatusCode == HttpStatusCode . OK )
47
47
{
48
- this . plugins = await response . Content
48
+ plugins = await response . Content
49
49
. ReadFromJsonAsync < List < UserPlugin > > ( PluginStoreItemSerializationOption , cancellationToken : token )
50
50
. ConfigureAwait ( false ) ;
51
- this . latestEtag = response . Headers . ETag ? . Tag ;
51
+ latestEtag = response . Headers . ETag ? . Tag ;
52
52
53
- Log . Info ( nameof ( CommunityPluginSource ) , $ "Loaded { this . plugins . Count } plugins from { ManifestFileUrl } ") ;
54
- return this . plugins ;
53
+ Log . Info ( nameof ( CommunityPluginSource ) , $ "Loaded { plugins . Count } plugins from { ManifestFileUrl } ") ;
54
+ return plugins ;
55
55
}
56
56
else if ( response . StatusCode == HttpStatusCode . NotModified )
57
57
{
58
58
Log . Info ( nameof ( CommunityPluginSource ) , $ "Resource { ManifestFileUrl } has not been modified.") ;
59
- return this . plugins ;
59
+ return plugins ;
60
60
}
61
61
else
62
62
{
Original file line number Diff line number Diff line change @@ -16,15 +16,14 @@ public static class Http
16
16
{
17
17
private const string UserAgent = @"Mozilla/5.0 (Trident/7.0; rv:11.0) like Gecko" ;
18
18
19
- private static HttpClient client = new HttpClient ( ) ;
19
+ private static readonly HttpClient client = new ( ) ;
20
20
21
21
static Http ( )
22
22
{
23
23
// need to be added so it would work on a win10 machine
24
24
ServicePointManager . Expect100Continue = true ;
25
25
ServicePointManager . SecurityProtocol |= SecurityProtocolType . Tls
26
- | SecurityProtocolType . Tls11
27
- | SecurityProtocolType . Tls12 ;
26
+ | SecurityProtocolType . Tls11 | SecurityProtocolType . Tls12 ;
28
27
29
28
client . DefaultRequestHeaders . Add ( "User-Agent" , UserAgent ) ;
30
29
HttpClient . DefaultProxy = WebProxy ;
@@ -72,7 +71,7 @@ var userName when string.IsNullOrEmpty(userName) =>
72
71
ProxyProperty . Port => ( new Uri ( $ "http://{ Proxy . Server } :{ Proxy . Port } ") , WebProxy . Credentials ) ,
73
72
ProxyProperty . UserName => ( WebProxy . Address , new NetworkCredential ( Proxy . UserName , Proxy . Password ) ) ,
74
73
ProxyProperty . Password => ( WebProxy . Address , new NetworkCredential ( Proxy . UserName , Proxy . Password ) ) ,
75
- _ => throw new ArgumentOutOfRangeException ( )
74
+ _ => throw new ArgumentOutOfRangeException ( null )
76
75
} ;
77
76
}
78
77
catch ( UriFormatException e )
You can’t perform that action at this time.
0 commit comments