mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
broke up EnvironmentProvider into different services
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Messaging;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
@@ -13,24 +14,24 @@ namespace NzbDrone.Api.Client
|
||||
{
|
||||
public class ClientSettings : IHandle<ApplicationStartedEvent>
|
||||
{
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private readonly IAppDirectoryInfo _appDirectoryInfo;
|
||||
|
||||
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(IAppDirectoryInfo appDirectoryInfo)
|
||||
{
|
||||
_environmentProvider = environmentProvider;
|
||||
_appDirectoryInfo = appDirectoryInfo;
|
||||
}
|
||||
|
||||
public void Handle(ApplicationStartedEvent message)
|
||||
{
|
||||
//TODO: Update the APIKey (when we have it)
|
||||
|
||||
var appFile = Path.Combine(_environmentProvider.StartUpPath, "UI", "app.js");
|
||||
var appFile = Path.Combine(_appDirectoryInfo.StartUpPath, "UI", "app.js");
|
||||
var contents = File.ReadAllText(appFile);
|
||||
var version = _environmentProvider.Version;
|
||||
var date = _environmentProvider.BuildDateTime;
|
||||
var version = BuildInfo.Version;
|
||||
var date = BuildInfo.BuildDateTime;
|
||||
|
||||
contents = VersionRegex.Replace(contents, version.ToString());
|
||||
contents = BuildDateRegex.Replace(contents, date.ToUniversalTime().ToJson());
|
||||
|
Reference in New Issue
Block a user