working upload both local and cloud-9 node
This commit is contained in:
parent
8af91ea74b
commit
768bfcc8eb
@ -1,4 +1,5 @@
|
||||
using CodexOpenApi;
|
||||
using IdentityModel.Client;
|
||||
using System.Net.Http;
|
||||
using System.Windows;
|
||||
using Utils;
|
||||
@ -23,12 +24,12 @@ namespace DevconBoothImages
|
||||
{
|
||||
var config = new Configuration();
|
||||
return new Codexes(
|
||||
await GetCodex(config.CodexLocalEndpoint),
|
||||
await GetCodex(config.CodexPublicEndpoint)
|
||||
await GetCodexWithPort(config.CodexLocalEndpoint),
|
||||
await GetCodexWithoutPort(config.CodexPublicEndpoint, config.AuthUser, config.AuthPw)
|
||||
);
|
||||
}
|
||||
|
||||
private async Task<CodexApi> GetCodex(string endpoint)
|
||||
private async Task<CodexApi> GetCodexWithPort(string endpoint)
|
||||
{
|
||||
var splitIndex = endpoint.LastIndexOf(':');
|
||||
var host = endpoint.Substring(0, splitIndex);
|
||||
@ -47,6 +48,17 @@ namespace DevconBoothImages
|
||||
return codex;
|
||||
}
|
||||
|
||||
private async Task<CodexApi> GetCodexWithoutPort(string endpoint, string user, string pw)
|
||||
{
|
||||
var client = new HttpClient();
|
||||
client.SetBasicAuthentication(user, pw);
|
||||
var codex = new CodexApi(client);
|
||||
codex.BaseUrl = $"{endpoint}/api/codex/v1";
|
||||
|
||||
await CheckCodex(codex, endpoint);
|
||||
return codex;
|
||||
}
|
||||
|
||||
private async Task CheckCodex(CodexApi codex, string endpoint)
|
||||
{
|
||||
try
|
||||
|
@ -3,7 +3,7 @@
|
||||
public class Configuration
|
||||
{
|
||||
public string CodexLocalEndpoint { get; } = "http://localhost:8080";
|
||||
public string CodexPublicEndpoint { get; } = "";
|
||||
public string CodexPublicEndpoint { get; } = "https://api.testnet.codex.storage/storage/node-9";
|
||||
|
||||
public string AuthUser { get; } = "";
|
||||
public string AuthPw { get; } = "";
|
||||
|
Loading…
x
Reference in New Issue
Block a user