refactor CommunityPluginSource.FetchAsync

This commit is contained in:
Ioannis G 2023-07-05 00:37:31 +03:00
parent 194dbabbde
commit 64f0da456f
No known key found for this signature in database
GPG key ID: EAC0E4E5E36AC49E

View file

@ -4,7 +4,7 @@ using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text.Json;
using System.Net.Http.Json;
using System.Threading;
using System.Threading.Tasks;
@ -36,9 +36,7 @@ namespace Flow.Launcher.Core.ExternalPlugins
if (response.StatusCode == HttpStatusCode.OK)
{
await using var json = await response.Content.ReadAsStreamAsync(token).ConfigureAwait(false);
this.plugins = await JsonSerializer.DeserializeAsync<List<UserPlugin>>(json, cancellationToken: token).ConfigureAwait(false);
this.plugins = await response.Content.ReadFromJsonAsync<List<UserPlugin>>(cancellationToken: token).ConfigureAwait(false);
this.latestEtag = response.Headers.ETag.Tag;
Log.Info(nameof(CommunityPluginSource), $"Loaded {this.plugins.Count} plugins from {ManifestFileUrl}");