diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-09-04 15:34:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-04 15:34:53 -0400 |
| commit | 637795aaf5e203d3a5a98cf9caa742663d0ee14e (patch) | |
| tree | 732342d058b10e49a73fe6863bc722bde56806d0 /MediaBrowser.Api/System/SystemService.cs | |
| parent | 9cf5cd1e5b504619875be6c5b9e4d76a990686e7 (diff) | |
| parent | 3b318a3add352a72b6b0430300fddbf61edac216 (diff) | |
Merge pull request #2864 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Api/System/SystemService.cs')
| -rw-r--r-- | MediaBrowser.Api/System/SystemService.cs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/MediaBrowser.Api/System/SystemService.cs b/MediaBrowser.Api/System/SystemService.cs index edb9f063d..37613c1c8 100644 --- a/MediaBrowser.Api/System/SystemService.cs +++ b/MediaBrowser.Api/System/SystemService.cs @@ -43,7 +43,7 @@ namespace MediaBrowser.Api.System /// Class RestartApplication /// </summary> [Route("/System/Restart", "POST", Summary = "Restarts the application, if needed")] - [Authenticated(Roles = "Admin")] + [Authenticated(Roles = "Admin", AllowLocal = true)] public class RestartApplication { } @@ -52,10 +52,9 @@ namespace MediaBrowser.Api.System /// This is currently not authenticated because the uninstaller needs to be able to shutdown the server. /// </summary> [Route("/System/Shutdown", "POST", Summary = "Shuts down the application")] + [Authenticated(Roles = "Admin", AllowLocal = true)] public class ShutdownApplication { - // TODO: This is not currently authenticated due to uninstaller - // Improve later } [Route("/System/Logs", "GET", Summary = "Gets a list of available server log files")] @@ -126,7 +125,7 @@ namespace MediaBrowser.Api.System } catch (IOException) { - files = new FileSystemMetadata[]{}; + files = new FileSystemMetadata[] { }; } var result = files.Select(i => new LogFile @@ -149,6 +148,12 @@ namespace MediaBrowser.Api.System var file = _fileSystem.GetFiles(_appPaths.LogDirectoryPath) .First(i => string.Equals(i.Name, request.Name, StringComparison.OrdinalIgnoreCase)); + // For older files, assume fully static + if (file.LastWriteTimeUtc < DateTime.UtcNow.AddHours(-1)) + { + return ResultFactory.GetStaticFileResult(Request, file.FullName, FileShareMode.Read); + } + return ResultFactory.GetStaticFileResult(Request, file.FullName, FileShareMode.ReadWrite); } |
