From d4706dd8f5fa3a1ec08b02b7d9973a42a29d1392 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 10 Aug 2013 13:13:31 -0700 Subject: [PATCH] branch is now part of status api and shows up in the footer if not on master. --- NzbDrone.Api/System/SystemModule.cs | 7 ++++++- UI/Series/Index/FooterView.js | 2 +- UI/ServerStatus.js | 10 +++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/NzbDrone.Api/System/SystemModule.cs b/NzbDrone.Api/System/SystemModule.cs index b8e90262b..e0e9b9177 100644 --- a/NzbDrone.Api/System/SystemModule.cs +++ b/NzbDrone.Api/System/SystemModule.cs @@ -3,6 +3,7 @@ using Nancy.Routing; using NzbDrone.Common; using NzbDrone.Api.Extensions; using NzbDrone.Common.EnvironmentInfo; +using NzbDrone.Core.Configuration; namespace NzbDrone.Api.System { @@ -11,13 +12,15 @@ namespace NzbDrone.Api.System private readonly IAppFolderInfo _appFolderInfo; private readonly IRuntimeInfo _runtimeInfo; private readonly IRouteCacheProvider _routeCacheProvider; + private readonly IConfigFileProvider _configFileProvider; - public SystemModule(IAppFolderInfo appFolderInfo, IRuntimeInfo runtimeInfo, IRouteCacheProvider routeCacheProvider) + public SystemModule(IAppFolderInfo appFolderInfo, IRuntimeInfo runtimeInfo, IRouteCacheProvider routeCacheProvider, IConfigFileProvider configFileProvider) : base("system") { _appFolderInfo = appFolderInfo; _runtimeInfo = runtimeInfo; _routeCacheProvider = routeCacheProvider; + _configFileProvider = configFileProvider; Get["/status"] = x => GetStatus(); Get["/routes"] = x => GetRoutes(); } @@ -37,6 +40,8 @@ namespace NzbDrone.Api.System OsVersion = OsInfo.Version.ToString(), IsMono = OsInfo.IsMono, IsLinux = OsInfo.IsLinux, + Branch = _configFileProvider.Branch, + Authentication = _configFileProvider.AuthenticationEnabled }.AsResponse(); } diff --git a/UI/Series/Index/FooterView.js b/UI/Series/Index/FooterView.js index 0e569b70a..ab0a9380e 100644 --- a/UI/Series/Index/FooterView.js +++ b/UI/Series/Index/FooterView.js @@ -1,4 +1,4 @@ -'use strict'; +'use strict'; define( [ 'marionette' diff --git a/UI/ServerStatus.js b/UI/ServerStatus.js index 7b1924ec3..8895c49f4 100644 --- a/UI/ServerStatus.js +++ b/UI/ServerStatus.js @@ -8,4 +8,12 @@ var statusText = $.ajax({ window.ServerStatus = JSON.parse(statusText); -$('#footer-region .version').html(window.ServerStatus.version); +var footerText = window.ServerStatus.version; + +$(document).ready(function () { + if (window.ServerStatus.branch != 'master') { + footerText = '
' + window.ServerStatus.branch; + } + $('#footer-region .version').html(footerText); +}); +