2020-12-06 08:58:27 +00:00
|
|
|
|
using Flow.Launcher.Infrastructure.Http;
|
|
|
|
|
|
using Flow.Launcher.Infrastructure.Logger;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2020-12-29 04:20:13 +00:00
|
|
|
|
using System.Text.Json;
|
2020-12-13 21:41:18 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2020-12-06 08:58:27 +00:00
|
|
|
|
|
2020-12-06 10:10:22 +00:00
|
|
|
|
namespace Flow.Launcher.Plugin.PluginsManager.Models
|
2020-12-06 08:58:27 +00:00
|
|
|
|
{
|
2020-12-06 20:40:42 +00:00
|
|
|
|
internal class PluginsManifest
|
2020-12-06 08:58:27 +00:00
|
|
|
|
{
|
2021-01-02 14:21:45 +00:00
|
|
|
|
internal List<UserPlugin> UserPlugins { get; private set; } = new List<UserPlugin>();
|
2020-12-13 21:41:18 +00:00
|
|
|
|
|
2020-12-28 15:06:47 +00:00
|
|
|
|
internal async Task DownloadManifest()
|
2020-12-06 08:58:27 +00:00
|
|
|
|
{
|
2020-12-13 21:41:18 +00:00
|
|
|
|
try
|
|
|
|
|
|
{
|
2020-12-29 04:23:15 +00:00
|
|
|
|
await using var jsonStream = await Http.GetStreamAsync("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json")
|
2020-12-29 04:20:13 +00:00
|
|
|
|
.ConfigureAwait(false);
|
2020-12-06 08:58:27 +00:00
|
|
|
|
|
2020-12-29 04:20:13 +00:00
|
|
|
|
UserPlugins = await JsonSerializer.DeserializeAsync<List<UserPlugin>>(jsonStream).ConfigureAwait(false);
|
2020-12-13 21:41:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
catch (Exception e)
|
2020-12-06 08:58:27 +00:00
|
|
|
|
{
|
2020-12-13 21:41:18 +00:00
|
|
|
|
Log.Exception("|PluginManagement.GetManifest|Encountered error trying to download plugins manifest", e);
|
2020-12-06 08:58:27 +00:00
|
|
|
|
|
2020-12-13 21:41:18 +00:00
|
|
|
|
UserPlugins = new List<UserPlugin>();
|
2020-12-06 08:58:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-12-21 11:42:50 +00:00
|
|
|
|
}
|