mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Added build date to footer
This commit is contained in:
parent
d538fe62cf
commit
d3d937afcc
@ -6,6 +6,7 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Messaging;
|
using NzbDrone.Common.Messaging;
|
||||||
|
using NzbDrone.Common.Serializer;
|
||||||
using NzbDrone.Core.Lifecycle;
|
using NzbDrone.Core.Lifecycle;
|
||||||
|
|
||||||
namespace NzbDrone.Api.Client
|
namespace NzbDrone.Api.Client
|
||||||
@ -15,6 +16,7 @@ public class ClientSettings : IHandle<ApplicationStartedEvent>
|
|||||||
private readonly EnvironmentProvider _environmentProvider;
|
private readonly EnvironmentProvider _environmentProvider;
|
||||||
|
|
||||||
private static readonly Regex VersionRegex = new Regex(@"(?<=Version:\s')(.*)(?=')", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
private static readonly Regex VersionRegex = new Regex(@"(?<=Version:\s')(.*)(?=')", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
private static readonly Regex BuildDateRegex = new Regex(@"(?<=BuildDate:\s)('.*')", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
public ClientSettings(EnvironmentProvider environmentProvider)
|
public ClientSettings(EnvironmentProvider environmentProvider)
|
||||||
{
|
{
|
||||||
@ -28,8 +30,10 @@ public void Handle(ApplicationStartedEvent message)
|
|||||||
var appFile = Path.Combine(_environmentProvider.StartUpPath, "UI", "app.js");
|
var appFile = Path.Combine(_environmentProvider.StartUpPath, "UI", "app.js");
|
||||||
var contents = File.ReadAllText(appFile);
|
var contents = File.ReadAllText(appFile);
|
||||||
var version = _environmentProvider.Version;
|
var version = _environmentProvider.Version;
|
||||||
|
var date = _environmentProvider.BuildDateTime;
|
||||||
|
|
||||||
contents = VersionRegex.Replace(contents, version.ToString());
|
contents = VersionRegex.Replace(contents, version.ToString());
|
||||||
|
contents = BuildDateRegex.Replace(contents, date.ToUniversalTime().ToJson());
|
||||||
|
|
||||||
File.WriteAllText(appFile, contents);
|
File.WriteAllText(appFile, contents);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,16 @@ define(['app'], function () {
|
|||||||
|
|
||||||
NzbDrone.Shared.Footer.Model = Backbone.Model.extend({
|
NzbDrone.Shared.Footer.Model = Backbone.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
'version' : '0.0.0.0'
|
'version' : '0.0.0.0',
|
||||||
|
'buildDate' : Date.create()
|
||||||
|
},
|
||||||
|
|
||||||
|
mutators: {
|
||||||
|
humanizedBuildDate: function () {
|
||||||
|
var date = Date.create(this.get('buildDate'));
|
||||||
|
|
||||||
|
return date.short();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
<p>© Copyright 2013 NzbDrone</p>
|
<p>© Copyright 2013 NzbDrone</p>
|
||||||
<p>v{{version}}</p>
|
<p>v{{version}} ({{humanizedBuildDate}})</p>
|
@ -8,6 +8,7 @@ define(['app',
|
|||||||
initialize: function () {
|
initialize: function () {
|
||||||
this.model = new NzbDrone.Shared.Footer.Model();
|
this.model = new NzbDrone.Shared.Footer.Model();
|
||||||
this.model.set('version', NzbDrone.Constants.Version);
|
this.model.set('version', NzbDrone.Constants.Version);
|
||||||
|
this.model.set('buildDate', NzbDrone.Constants.BuildDate);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
footer {
|
|
||||||
font-size: 12.6px;
|
|
||||||
}
|
|
@ -172,7 +172,8 @@ define([
|
|||||||
|
|
||||||
window.NzbDrone.Constants = {
|
window.NzbDrone.Constants = {
|
||||||
ApiRoot: '/api',
|
ApiRoot: '/api',
|
||||||
Version: '0.0.0.0'
|
Version: '0.0.0.0',
|
||||||
|
BuildDate: '2013-01-01T00:00:00Z'
|
||||||
};
|
};
|
||||||
|
|
||||||
window.NzbDrone.addInitializer(function () {
|
window.NzbDrone.addInitializer(function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user