mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Stats API Url Fixed (#338)
* Fixed the API call by removing baseAddress and performing concatination in real time
This commit is contained in:
parent
be56b33baf
commit
6b645737fa
@ -16,7 +16,6 @@ namespace API.Extensions
|
||||
{
|
||||
services.AddHttpClient<StatsApiClient>(client =>
|
||||
{
|
||||
client.BaseAddress = new Uri("https://stats.kavitareader.com");
|
||||
client.DefaultRequestHeaders.Add("api-key", "MsnvA2DfQqxSK5jh");
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using API.Configurations.CustomOptions;
|
||||
@ -15,6 +16,7 @@ namespace API.Services.Clients
|
||||
private readonly HttpClient _client;
|
||||
private readonly StatsOptions _options;
|
||||
private readonly ILogger<StatsApiClient> _logger;
|
||||
private const string ApiUrl = "http://stats.kavitareader.com";
|
||||
|
||||
public StatsApiClient(HttpClient client, IOptions<StatsOptions> options, ILogger<StatsApiClient> logger)
|
||||
{
|
||||
@ -29,7 +31,7 @@ namespace API.Services.Clients
|
||||
|
||||
try
|
||||
{
|
||||
var response = await _client.PostAsJsonAsync("/api/InstallationStats", data);
|
||||
using var response = await _client.PostAsJsonAsync(ApiUrl + "/api/InstallationStats", data);
|
||||
|
||||
responseContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user