aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/HttpHandlers/ServerConfigurationHandler.cs
blob: a26a6daf7952d6098f4d08b28413dde7d17cc1ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.IO;
using System.Threading.Tasks;
using MediaBrowser.Common.Net.Handlers;
using MediaBrowser.Controller;
using MediaBrowser.Model.Configuration;

namespace MediaBrowser.Api.HttpHandlers
{
    class ServerConfigurationHandler : BaseSerializationHandler<ServerConfiguration>
    {
        protected override Task<ServerConfiguration> GetObjectToSerialize()
        {
            return Task.FromResult<ServerConfiguration>(Kernel.Instance.Configuration);
        }

        public override TimeSpan CacheDuration
        {
            get
            {
                return TimeSpan.FromDays(7);
            }
        }

        protected override Task<DateTime?> GetLastDateModified()
        {
            return Task.FromResult<DateTime?>(File.GetLastWriteTimeUtc(Kernel.Instance.ApplicationPaths.SystemConfigurationFilePath));
        }
    }
}