From 50b26ba9553329bfaa198a7df894e0ee8c0d09a3 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 31 Jan 2023 23:39:59 -0800 Subject: [PATCH] Fixed: Ping endpoint no longer requires authentication (cherry picked from commit ad42d4a14c814d5911dafb5e78e97ec09b4b13a5) --- src/Lidarr.Http/Ping/PingController.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Lidarr.Http/Ping/PingController.cs b/src/Lidarr.Http/Ping/PingController.cs index 59147d1d8..7f4a23939 100644 --- a/src/Lidarr.Http/Ping/PingController.cs +++ b/src/Lidarr.Http/Ping/PingController.cs @@ -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 Lidarr.Http.Ping @@ -8,19 +11,22 @@ namespace Lidarr.Http.Ping public class PingController : Controller { private readonly IConfigRepository _configRepository; + private readonly ICached> _cache; - public PingController(IConfigRepository configRepository) + public PingController(IConfigRepository configRepository, ICacheManager cacheManager) { _configRepository = configRepository; + _cache = cacheManager.GetCache>(GetType()); } + [AllowAnonymous] [HttpGet("/ping")] [Produces("application/json")] public ActionResult GetStatus() { try { - _configRepository.All(); + _cache.Get("ping", _configRepository.All, TimeSpan.FromSeconds(5)); } catch (Exception) {