jellyfin/MediaBrowser.Api/HttpHandlers/ServerConfigurationHandler.cs

39 lines
1.2 KiB
C#
Raw Normal View History

using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Controller;
using MediaBrowser.Model.Configuration;
using System;
using System.ComponentModel.Composition;
using System.IO;
using System.Net;
using System.Threading.Tasks;
namespace MediaBrowser.Api.HttpHandlers
{
[Export(typeof(BaseHandler))]
class ServerConfigurationHandler : BaseSerializationHandler<ServerConfiguration>
{
public override bool HandlesRequest(HttpListenerRequest request)
{
return ApiService.IsApiUrlMatch("serverconfiguration", request);
}
protected override Task<ServerConfiguration> GetObjectToSerialize()
{
return Task.FromResult<ServerConfiguration>(Kernel.Instance.Configuration);
}
2012-09-04 19:23:15 +00:00
public override TimeSpan CacheDuration
{
get
{
return TimeSpan.FromDays(7);
}
}
protected override Task<DateTime?> GetLastDateModified()
{
return Task.FromResult<DateTime?>(File.GetLastWriteTimeUtc(Kernel.Instance.ApplicationPaths.SystemConfigurationFilePath));
}
}
}