fix hardware service

This commit is contained in:
Alex Bezdieniezhnykh
2025-05-02 13:25:33 +03:00
parent 7842fe1067
commit 472ed6533e
15 changed files with 118 additions and 142 deletions
+2 -13
View File
@@ -11,10 +11,10 @@ public interface IAzaionApi
ApiCredentials Credentials { get; }
User CurrentUser { get; }
void UpdateOffsets(UserQueueOffsets offsets);
Stream GetResource(string filename, string folder);
//Stream GetResource(string filename, string folder);
}
public class AzaionApi(HttpClient client, ICache cache, ApiCredentials credentials, IHardwareService hardwareService) : IAzaionApi
public class AzaionApi(HttpClient client, ICache cache, ApiCredentials credentials) : IAzaionApi
{
private string _jwtToken = null!;
const string APP_JSON = "application/json";
@@ -32,17 +32,6 @@ public class AzaionApi(HttpClient client, ICache cache, ApiCredentials credentia
}
}
public Stream GetResource(string filename, string folder)
{
var hardware = cache.GetFromCache(SecurityConstants.HARDWARE_INFO_KEY, hardwareService.GetHardware);
var response = Send(new HttpRequestMessage(HttpMethod.Post, $"/resources/get/{folder}")
{
Content = new StringContent(JsonConvert.SerializeObject(new { filename, credentials.Password, hardware }), Encoding.UTF8, APP_JSON)
});
return response.Content.ReadAsStream();
}
public void UpdateOffsets(UserQueueOffsets offsets)
{
Put($"/users/queue-offsets/{CurrentUser.Email}", offsets);