Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37673f8a6c | ||
|
|
d2eaac7a6c |
@@ -18,7 +18,7 @@ namespace UmlautAdaptarr.Controllers
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Caps([FromRoute] string apiKey, [FromRoute] string domain, [FromQuery] string? apikey)
|
||||
{
|
||||
if (_options.ApiKey != null && !apiKey.Equals(apiKey))
|
||||
if (!string.IsNullOrEmpty(apikey) && !apiKey.Equals(apiKey))
|
||||
{
|
||||
_logger.LogWarning("Invalid or missing API key for request.");
|
||||
return Unauthorized("Unauthorized: Invalid or missing API key.");
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace UmlautAdaptarr.Controllers
|
||||
|
||||
internal bool AssureApiKey(string apiKey)
|
||||
{
|
||||
if (options.Value.ApiKey != null && !apiKey.Equals(options.Value.ApiKey))
|
||||
if (!string.IsNullOrEmpty(options.Value.ApiKey) && !apiKey.Equals(options.Value.ApiKey))
|
||||
{
|
||||
logger.LogWarning("Invalid or missing API key for request.");
|
||||
return false;
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace UmlautAdaptarr.Services
|
||||
var url = _configuration["Kestrel:Endpoints:Http:Url"];
|
||||
var port = new Uri(url).Port;
|
||||
|
||||
var apiKey = _options.ApiKey == null ? "_" : _options.ApiKey;
|
||||
var apiKey = string.IsNullOrEmpty(_options.ApiKey) ? "_" : _options.ApiKey;
|
||||
|
||||
var modifiedUri = $"http://localhost:{port}/{apiKey}/{uri.Host}{uri.PathAndQuery}";
|
||||
using var client = _clientFactory.CreateClient();
|
||||
|
||||
Reference in New Issue
Block a user