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