Allow -suffix in PackageVersion and added that and PackageAuthor to the About page.
This commit is contained in:
parent
86c74b3ee0
commit
070cbeebbe
|
@ -15,6 +15,8 @@ class About extends Component {
|
|||
render() {
|
||||
const {
|
||||
version,
|
||||
packageVersion,
|
||||
packageAuthor,
|
||||
isMonoRuntime,
|
||||
runtimeVersion,
|
||||
appData,
|
||||
|
@ -33,6 +35,14 @@ class About extends Component {
|
|||
data={version}
|
||||
/>
|
||||
|
||||
{
|
||||
packageVersion &&
|
||||
<DescriptionListItem
|
||||
title="Package Version"
|
||||
data={(packageAuthor ? `${packageVersion} by ${packageAuthor}` : packageVersion)}
|
||||
/>
|
||||
}
|
||||
|
||||
{
|
||||
isMonoRuntime &&
|
||||
<DescriptionListItem
|
||||
|
@ -75,6 +85,8 @@ class About extends Component {
|
|||
|
||||
About.propTypes = {
|
||||
version: PropTypes.string.isRequired,
|
||||
packageVersion: PropTypes.string,
|
||||
packageAuthor: PropTypes.string,
|
||||
isMonoRuntime: PropTypes.bool.isRequired,
|
||||
runtimeVersion: PropTypes.string.isRequired,
|
||||
appData: PropTypes.string.isRequired,
|
||||
|
|
|
@ -14,11 +14,12 @@ namespace NzbDrone.Core.Configuration
|
|||
{
|
||||
public interface IDeploymentInfoProvider
|
||||
{
|
||||
Version PackageVersion { get; }
|
||||
string PackageVersion { get; }
|
||||
string PackageAuthor { get; }
|
||||
string PackageBranch { get; }
|
||||
UpdateMechanism PackageUpdateMechanism { get; }
|
||||
|
||||
Version ReleaseVersion { get; }
|
||||
string ReleaseVersion { get; }
|
||||
string ReleaseBranch { get; }
|
||||
|
||||
bool IsExternalUpdateMechanism { get; }
|
||||
|
@ -41,11 +42,12 @@ namespace NzbDrone.Core.Configuration
|
|||
{
|
||||
var data = diskProvider.ReadAllText(packageInfoPath);
|
||||
|
||||
PackageVersion = ReadVersion(data, "PackageVersion");
|
||||
PackageVersion = ReadValue(data, "PackageVersion");
|
||||
PackageAuthor = ReadValue(data, "PackageAuthor");
|
||||
PackageUpdateMechanism = ReadEnumValue(data, "UpdateMethod", UpdateMechanism.BuiltIn);
|
||||
PackageBranch = ReadValue(data, "Branch", null);
|
||||
PackageBranch = ReadValue(data, "Branch");
|
||||
|
||||
ReleaseVersion = ReadVersion(data, "ReleaseVersion");
|
||||
ReleaseVersion = ReadValue(data, "ReleaseVersion");
|
||||
|
||||
if (PackageBranch.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
|
@ -57,8 +59,8 @@ namespace NzbDrone.Core.Configuration
|
|||
{
|
||||
var data = diskProvider.ReadAllText(releaseInfoPath);
|
||||
|
||||
ReleaseVersion = ReadVersion(data, "ReleaseVersion", ReleaseVersion);
|
||||
ReleaseBranch = ReadValue(data, "Branch", null);
|
||||
ReleaseVersion = ReadValue(data, "ReleaseVersion", ReleaseVersion);
|
||||
ReleaseBranch = ReadValue(data, "Branch");
|
||||
|
||||
if (ReleaseBranch.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
|
@ -69,7 +71,7 @@ namespace NzbDrone.Core.Configuration
|
|||
DefaultUpdateMechanism = PackageUpdateMechanism;
|
||||
}
|
||||
|
||||
private static string ReadValue(string fileData, string key, string defaultValue)
|
||||
private static string ReadValue(string fileData, string key, string defaultValue = null)
|
||||
{
|
||||
var match = Regex.Match(fileData, "^" + key + "=(.*)$", RegexOptions.Multiline);
|
||||
if (match.Success)
|
||||
|
@ -83,7 +85,7 @@ namespace NzbDrone.Core.Configuration
|
|||
private static T ReadEnumValue<T>(string fileData, string key, T defaultValue)
|
||||
where T : struct
|
||||
{
|
||||
var value = ReadValue(fileData, key, null);
|
||||
var value = ReadValue(fileData, key);
|
||||
if (value != null && Enum.TryParse<T>(value, true, out var result))
|
||||
{
|
||||
return result;
|
||||
|
@ -92,22 +94,12 @@ namespace NzbDrone.Core.Configuration
|
|||
return defaultValue;
|
||||
}
|
||||
|
||||
private static Version ReadVersion(string fileData, string key, Version defaultValue = null)
|
||||
{
|
||||
var value = ReadValue(fileData, key, null);
|
||||
if (value != null && Version.TryParse(value, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public Version PackageVersion { get; private set; }
|
||||
public string PackageVersion { get; private set; }
|
||||
public string PackageAuthor { get; private set; }
|
||||
public string PackageBranch { get; private set; }
|
||||
public UpdateMechanism PackageUpdateMechanism { get; private set; }
|
||||
|
||||
public Version ReleaseVersion { get; set; }
|
||||
public string ReleaseVersion { get; private set; }
|
||||
public string ReleaseBranch { get; set; }
|
||||
|
||||
|
||||
|
|
|
@ -75,6 +75,8 @@ namespace Sonarr.Api.V3.System
|
|||
RuntimeVersion = _platformInfo.Version,
|
||||
RuntimeName = PlatformInfo.Platform,
|
||||
StartTime = _runtimeInfo.StartTime,
|
||||
PackageVersion = _deploymentInfoProvider.PackageVersion,
|
||||
PackageAuthor = _deploymentInfoProvider.PackageAuthor,
|
||||
PackageUpdateMechanism = _deploymentInfoProvider.PackageUpdateMechanism
|
||||
}.AsResponse();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue