mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
Use the plugin builder website instead of docker to fetch plugins (#4285)
This commit is contained in:
31
BTCPayServer/Plugins/PluginBuilderClient.cs
Normal file
31
BTCPayServer/Plugins/PluginBuilderClient.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace BTCPayServer.Plugins
|
||||
{
|
||||
public class PublishedVersion
|
||||
{
|
||||
public string ProjectSlug { get; set; }
|
||||
public long BuildId { get; set; }
|
||||
public JObject BuildInfo { get; set; }
|
||||
public JObject ManifestInfo { get; set; }
|
||||
}
|
||||
public class PluginBuilderClient
|
||||
{
|
||||
HttpClient httpClient;
|
||||
public HttpClient HttpClient => httpClient;
|
||||
public PluginBuilderClient(HttpClient httpClient)
|
||||
{
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
static JsonSerializerSettings serializerSettings = new JsonSerializerSettings() { ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() };
|
||||
public async Task<PublishedVersion[]> GetPublishedVersions(string btcpayVersion, bool includePreRelease)
|
||||
{
|
||||
var result = await httpClient.GetStringAsync($"api/v1/plugins?btcpayVersion={btcpayVersion}&includePreRelease={includePreRelease}");
|
||||
return JsonConvert.DeserializeObject<PublishedVersion[]>(result, serializerSettings) ?? throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user