Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion API/Controller/Public/GetStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using OpenShock.Common.Models;
using OpenShock.Common.Redis;
using StackExchange.Redis;
using System.Net.Mime;

namespace OpenShock.API.Controller.Public;

Expand All @@ -12,8 +13,9 @@ public sealed partial class PublicController
/// Gets online devices statistics
/// </summary>
/// <response code="200">The statistics were successfully retrieved.</response>
[HttpGet("stats")]
[Tags("Meta")]
[HttpGet("stats")]
[ResponseCache(Duration = 60, Location = ResponseCacheLocation.Any)]
public async Task<LegacyDataResponse<StatsResponse>> GetOnlineDevicesStatistics([FromServices] IConnectionMultiplexer redisConnectionMultiplexer)
{
var ft = redisConnectionMultiplexer.GetDatabase().FT();
Expand Down
2 changes: 2 additions & 0 deletions API/Controller/Version/_ApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using OpenShock.Common.Models;
using OpenShock.Common.Options;
using OpenShock.Common.Utils;
using System.Net.Mime;
using System.Reflection;

namespace OpenShock.API.Controller.Version;
Expand All @@ -25,6 +26,7 @@ public sealed partial class VersionController : OpenShockControllerBase
/// </summary>
/// <response code="200">The version was successfully retrieved.</response>
[HttpGet]
[ResponseCache(Duration = 60, Location = ResponseCacheLocation.Any)]
public LegacyDataResponse<ApiVersionResponse> GetBackendVersion(
[FromServices] IOptions<FrontendOptions> frontendOptions,
[FromServices] IOptions<CloudflareTurnstileOptions> turnstileOptions
Expand Down
1 change: 1 addition & 0 deletions Common/OpenShockMiddlewareHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static async Task<IApplicationBuilder> UseCommonOpenShockMiddleware(this
KeepAliveInterval = TimeSpan.FromMinutes(1)
});
app.UseRouting();
app.UseResponseCaching();
app.UseAuthentication();
app.UseAuthorization();

Expand Down
1 change: 1 addition & 0 deletions Common/OpenShockServiceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public static IServiceCollection AddOpenShockServices(this IServiceCollection se

// generic ASP.NET stuff
services.AddMemoryCache();
services.AddResponseCaching();
services.AddHttpContextAccessor();
services.AddWebEncoders();
services.AddProblemDetails();
Expand Down