mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 23:46:30 +00:00
add resource folder to config for proper folder auto upload
This commit is contained in:
@@ -12,26 +12,26 @@ public class AzaionApiClient(HttpClient httpClient) : IDisposable
|
||||
{
|
||||
const string JSON_MEDIA = "application/json";
|
||||
|
||||
private static ApiConfig _apiConfig = null!;
|
||||
|
||||
private string Email { get; set; } = null!;
|
||||
private SecureString Password { get; set; } = new();
|
||||
|
||||
private string JwtToken { get; set; } = null!;
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
public static AzaionApiClient Create(ApiCredentials credentials)
|
||||
{
|
||||
ApiConfig apiConfig;
|
||||
try
|
||||
{
|
||||
if (!File.Exists(SecurityConstants.CONFIG_PATH))
|
||||
throw new FileNotFoundException(SecurityConstants.CONFIG_PATH);
|
||||
var configStr = File.ReadAllText(SecurityConstants.CONFIG_PATH);
|
||||
apiConfig = JsonConvert.DeserializeObject<SecureAppConfig>(configStr)!.ApiConfig;
|
||||
_apiConfig = JsonConvert.DeserializeObject<SecureAppConfig>(configStr)!.ApiConfig;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
apiConfig = new ApiConfig
|
||||
_apiConfig = new ApiConfig
|
||||
{
|
||||
Url = SecurityConstants.DEFAULT_API_URL,
|
||||
RetryCount = SecurityConstants.DEFAULT_API_RETRY_COUNT ,
|
||||
@@ -41,8 +41,8 @@ public class AzaionApiClient(HttpClient httpClient) : IDisposable
|
||||
|
||||
var api = new AzaionApiClient(new HttpClient
|
||||
{
|
||||
BaseAddress = new Uri(apiConfig.Url),
|
||||
Timeout = TimeSpan.FromSeconds(apiConfig.TimeoutSeconds)
|
||||
BaseAddress = new Uri(_apiConfig.Url),
|
||||
Timeout = TimeSpan.FromSeconds(_apiConfig.TimeoutSeconds)
|
||||
});
|
||||
|
||||
api.EnterCredentials(credentials);
|
||||
@@ -60,7 +60,7 @@ public class AzaionApiClient(HttpClient httpClient) : IDisposable
|
||||
|
||||
public async Task<Stream> GetResource(string fileName, string password, HardwareInfo hardware)
|
||||
{
|
||||
var response = await Send(httpClient, new HttpRequestMessage(HttpMethod.Post, "/resources/get")
|
||||
var response = await Send(httpClient, new HttpRequestMessage(HttpMethod.Post, $"/resources/get/{_apiConfig.ResourcesFolder}")
|
||||
{
|
||||
Content = new StringContent(JsonConvert.SerializeObject(new { fileName, password, hardware }), Encoding.UTF8, JSON_MEDIA)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user