Fixed: Ping endpoint no longer requires authentication

(cherry picked from commit ad42d4a14c814d5911dafb5e78e97ec09b4b13a5)
This commit is contained in:
Mark McDowall 2023-01-31 23:39:59 -08:00 committed by Qstick
parent c3665e9fea
commit affedd7f9d
1 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NzbDrone.Common.Cache;
using NzbDrone.Core.Configuration;
namespace Radarr.Http.Ping
@ -8,19 +11,22 @@ namespace Radarr.Http.Ping
public class PingController : Controller
{
private readonly IConfigRepository _configRepository;
private readonly ICached<IEnumerable<Config>> _cache;
public PingController(IConfigRepository configRepository)
public PingController(IConfigRepository configRepository, ICacheManager cacheManager)
{
_configRepository = configRepository;
_cache = cacheManager.GetCache<IEnumerable<Config>>(GetType());
}
[AllowAnonymous]
[HttpGet("/ping")]
[Produces("application/json")]
public ActionResult<PingResource> GetStatus()
{
try
{
_configRepository.All();
_cache.Get("ping", _configRepository.All, TimeSpan.FromSeconds(5));
}
catch (Exception)
{