Skip to content

Commit

Permalink
fixed dependency download
Browse files Browse the repository at this point in the history
  • Loading branch information
diogotr7 committed Mar 2, 2024
1 parent 8aa5c20 commit 8a71772
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ private async Task<string> GetDownloadUrlAsync(HttpClient httpClient)
//a bunch of nullable overrides here but i don't care
const string ENDPOINT = "prod";
var endpointsJson = await httpClient.GetStringAsync("https://discovery.razerapi.com/user/endpoints");
var endpoints = JsonSerializer.Deserialize<RazerRoot>(endpointsJson);
var prodEndpoint = endpoints!.Endpoints.Find(ep => ep.Name == ENDPOINT);
var endpoints = JsonSerializer.Deserialize<RazerRoot>(endpointsJson, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
var prodEndpoint = endpoints!.endpoints.Find(ep => ep.name == ENDPOINT);

const string PLATFORM_DATA = """
<PlatformRoot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
Expand All @@ -59,7 +59,7 @@ private async Task<string> GetDownloadUrlAsync(HttpClient httpClient)
</PlatformRoot>
""";
using var response2 = await httpClient.PostAsync(
$"https://manifest.razerapi.com/api/legacy/{prodEndpoint!.Hash}/{ENDPOINT}/productlist/get",
$"https://manifest.razerapi.com/api/legacy/{prodEndpoint!.hash}/{ENDPOINT}/productlist/get",
new StringContent(PLATFORM_DATA, Encoding.UTF8, "application/xml"));
var a = await response2.Content.ReadAsStringAsync();

Expand All @@ -75,7 +75,7 @@ private async Task<string> GetDownloadUrlAsync(HttpClient httpClient)
throw new ArtemisPluginException("Failed to retrieve Razer API download URL");
}

private record RazerEndpoint(string Name, string Hash);
private record RazerEndpoint(string name, string hash);

private record RazerRoot(List<RazerEndpoint> Endpoints);
private record RazerRoot(List<RazerEndpoint> endpoints);
}
2 changes: 1 addition & 1 deletion src/Artemis.Plugins.LayerBrushes.Chroma/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Author": "diogotr7",
"Icon": "Snake",
"Description": "Provides a layer that displays lighting from Razer Chroma supported games on all devices Artemis supports.",
"Version": "1.2.0.0",
"Version": "1.2.0.1",
"Main": "Artemis.Plugins.LayerBrushes.Chroma.dll",
"Platforms": "Windows"
}

0 comments on commit 8a71772

Please sign in to comment.