mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
New: Show update settings on all platforms
(cherry picked from commit c023fc700896c7f0751c4ac63c4e1a89d6e1a9bb) Closes #4919
This commit is contained in:
parent
7f73a2e23a
commit
fb75b28cb1
6 changed files with 56 additions and 77 deletions
|
@ -18,7 +18,6 @@ function UpdateSettings(props) {
|
||||||
const {
|
const {
|
||||||
advancedSettings,
|
advancedSettings,
|
||||||
settings,
|
settings,
|
||||||
isWindows,
|
|
||||||
packageUpdateMechanism,
|
packageUpdateMechanism,
|
||||||
onInputChange
|
onInputChange
|
||||||
} = props;
|
} = props;
|
||||||
|
@ -44,10 +43,10 @@ function UpdateSettings(props) {
|
||||||
value: titleCase(packageUpdateMechanism)
|
value: titleCase(packageUpdateMechanism)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
updateOptions.push({ key: 'builtIn', value: 'Built-In' });
|
updateOptions.push({ key: 'builtIn', value: translate('BuiltIn') });
|
||||||
}
|
}
|
||||||
|
|
||||||
updateOptions.push({ key: 'script', value: 'Script' });
|
updateOptions.push({ key: 'script', value: translate('Script') });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FieldSet legend={translate('Updates')}>
|
<FieldSet legend={translate('Updates')}>
|
||||||
|
@ -69,62 +68,59 @@ function UpdateSettings(props) {
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
{
|
<div>
|
||||||
!isWindows &&
|
<FormGroup
|
||||||
<div>
|
advancedSettings={advancedSettings}
|
||||||
<FormGroup
|
isAdvanced={true}
|
||||||
advancedSettings={advancedSettings}
|
size={sizes.MEDIUM}
|
||||||
isAdvanced={true}
|
>
|
||||||
size={sizes.MEDIUM}
|
<FormLabel>{translate('Automatic')}</FormLabel>
|
||||||
>
|
|
||||||
<FormLabel>{translate('Automatic')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.CHECK}
|
type={inputTypes.CHECK}
|
||||||
name="updateAutomatically"
|
name="updateAutomatically"
|
||||||
helpText={translate('UpdateAutomaticallyHelpText')}
|
helpText={translate('UpdateAutomaticallyHelpText')}
|
||||||
helpTextWarning={updateMechanism.value === 'docker' ? translate('AutomaticUpdatesDisabledDocker') : undefined}
|
helpTextWarning={updateMechanism.value === 'docker' ? translate('AutomaticUpdatesDisabledDocker') : undefined}
|
||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
{...updateAutomatically}
|
{...updateAutomatically}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup
|
||||||
|
advancedSettings={advancedSettings}
|
||||||
|
isAdvanced={true}
|
||||||
|
>
|
||||||
|
<FormLabel>{translate('Mechanism')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.SELECT}
|
||||||
|
name="updateMechanism"
|
||||||
|
values={updateOptions}
|
||||||
|
helpText={translate('UpdateMechanismHelpText')}
|
||||||
|
helpLink="https://wiki.servarr.com/lidarr/faq#how-do-i-update-lidarr"
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...updateMechanism}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
|
{
|
||||||
|
updateMechanism.value === 'script' &&
|
||||||
<FormGroup
|
<FormGroup
|
||||||
advancedSettings={advancedSettings}
|
advancedSettings={advancedSettings}
|
||||||
isAdvanced={true}
|
isAdvanced={true}
|
||||||
>
|
>
|
||||||
<FormLabel>{translate('Mechanism')}</FormLabel>
|
<FormLabel>{translate('ScriptPath')}</FormLabel>
|
||||||
|
|
||||||
<FormInputGroup
|
<FormInputGroup
|
||||||
type={inputTypes.SELECT}
|
type={inputTypes.TEXT}
|
||||||
name="updateMechanism"
|
name="updateScriptPath"
|
||||||
values={updateOptions}
|
helpText={translate('UpdateScriptPathHelpText')}
|
||||||
helpText={translate('UpdateMechanismHelpText')}
|
|
||||||
helpLink="https://wiki.servarr.com/lidarr/faq#how-do-i-update-lidarr"
|
|
||||||
onChange={onInputChange}
|
onChange={onInputChange}
|
||||||
{...updateMechanism}
|
{...updateScriptPath}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
}
|
||||||
{
|
</div>
|
||||||
updateMechanism.value === 'script' &&
|
|
||||||
<FormGroup
|
|
||||||
advancedSettings={advancedSettings}
|
|
||||||
isAdvanced={true}
|
|
||||||
>
|
|
||||||
<FormLabel>{translate('ScriptPath')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.TEXT}
|
|
||||||
name="updateScriptPath"
|
|
||||||
helpText={translate('UpdateScriptPathHelpText')}
|
|
||||||
onChange={onInputChange}
|
|
||||||
{...updateScriptPath}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</FieldSet>
|
</FieldSet>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ using NzbDrone.Core.HealthCheck.Checks;
|
||||||
using NzbDrone.Core.Localization;
|
using NzbDrone.Core.Localization;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Core.Update;
|
using NzbDrone.Core.Update;
|
||||||
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
{
|
{
|
||||||
|
@ -21,28 +22,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Returns("Some Warning Message");
|
.Returns("Some Warning Message");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void should_return_error_when_app_folder_is_write_protected()
|
|
||||||
{
|
|
||||||
WindowsOnly();
|
|
||||||
|
|
||||||
Mocker.GetMock<IAppFolderInfo>()
|
|
||||||
.Setup(s => s.StartUpFolder)
|
|
||||||
.Returns(@"C:\NzbDrone");
|
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>()
|
|
||||||
.Setup(c => c.FolderWritable(It.IsAny<string>()))
|
|
||||||
.Returns(false);
|
|
||||||
|
|
||||||
Subject.Check().ShouldBeError();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_return_error_when_app_folder_is_write_protected_and_update_automatically_is_enabled()
|
public void should_return_error_when_app_folder_is_write_protected_and_update_automatically_is_enabled()
|
||||||
{
|
{
|
||||||
PosixOnly();
|
var startupFolder = @"C:\NzbDrone".AsOsAgnostic();
|
||||||
|
|
||||||
const string startupFolder = @"/opt/nzbdrone";
|
|
||||||
|
|
||||||
Mocker.GetMock<IConfigFileProvider>()
|
Mocker.GetMock<IConfigFileProvider>()
|
||||||
.Setup(s => s.UpdateAutomatically)
|
.Setup(s => s.UpdateAutomatically)
|
||||||
|
@ -62,10 +45,8 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
[Test]
|
[Test]
|
||||||
public void should_return_error_when_ui_folder_is_write_protected_and_update_automatically_is_enabled()
|
public void should_return_error_when_ui_folder_is_write_protected_and_update_automatically_is_enabled()
|
||||||
{
|
{
|
||||||
PosixOnly();
|
var startupFolder = @"C:\NzbDrone".AsOsAgnostic();
|
||||||
|
var uiFolder = @"C:\NzbDrone\UI".AsOsAgnostic();
|
||||||
const string startupFolder = @"/opt/nzbdrone";
|
|
||||||
const string uiFolder = @"/opt/nzbdrone/UI";
|
|
||||||
|
|
||||||
Mocker.GetMock<IConfigFileProvider>()
|
Mocker.GetMock<IConfigFileProvider>()
|
||||||
.Setup(s => s.UpdateAutomatically)
|
.Setup(s => s.UpdateAutomatically)
|
||||||
|
@ -89,7 +70,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
[Test]
|
[Test]
|
||||||
public void should_not_return_error_when_app_folder_is_write_protected_and_external_script_enabled()
|
public void should_not_return_error_when_app_folder_is_write_protected_and_external_script_enabled()
|
||||||
{
|
{
|
||||||
PosixOnly();
|
var startupFolder = @"C:\NzbDrone".AsOsAgnostic();
|
||||||
|
|
||||||
Mocker.GetMock<IConfigFileProvider>()
|
Mocker.GetMock<IConfigFileProvider>()
|
||||||
.Setup(s => s.UpdateAutomatically)
|
.Setup(s => s.UpdateAutomatically)
|
||||||
|
@ -101,7 +82,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
|
|
||||||
Mocker.GetMock<IAppFolderInfo>()
|
Mocker.GetMock<IAppFolderInfo>()
|
||||||
.Setup(s => s.StartUpFolder)
|
.Setup(s => s.StartUpFolder)
|
||||||
.Returns(@"/opt/nzbdrone");
|
.Returns(startupFolder);
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
.Verify(c => c.FolderWritable(It.IsAny<string>()), Times.Never());
|
.Verify(c => c.FolderWritable(It.IsAny<string>()), Times.Never());
|
||||||
|
|
|
@ -254,7 +254,7 @@ namespace NzbDrone.Core.Configuration
|
||||||
public string UiFolder => BuildInfo.IsDebug ? Path.Combine("..", "UI") : "UI";
|
public string UiFolder => BuildInfo.IsDebug ? Path.Combine("..", "UI") : "UI";
|
||||||
public string InstanceName => _appOptions.InstanceName ?? GetValue("InstanceName", BuildInfo.AppName);
|
public string InstanceName => _appOptions.InstanceName ?? GetValue("InstanceName", BuildInfo.AppName);
|
||||||
|
|
||||||
public bool UpdateAutomatically => _updateOptions.Automatically ?? GetValueBoolean("UpdateAutomatically", false, false);
|
public bool UpdateAutomatically => _updateOptions.Automatically ?? GetValueBoolean("UpdateAutomatically", OsInfo.IsWindows, false);
|
||||||
|
|
||||||
public UpdateMechanism UpdateMechanism =>
|
public UpdateMechanism UpdateMechanism =>
|
||||||
Enum.TryParse<UpdateMechanism>(_updateOptions.Mechanism, out var enumValue)
|
Enum.TryParse<UpdateMechanism>(_updateOptions.Mechanism, out var enumValue)
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
var startupFolder = _appFolderInfo.StartUpFolder;
|
var startupFolder = _appFolderInfo.StartUpFolder;
|
||||||
var uiFolder = Path.Combine(startupFolder, "UI");
|
var uiFolder = Path.Combine(startupFolder, "UI");
|
||||||
|
|
||||||
if ((OsInfo.IsWindows || _configFileProvider.UpdateAutomatically) &&
|
if (_configFileProvider.UpdateAutomatically &&
|
||||||
_configFileProvider.UpdateMechanism == UpdateMechanism.BuiltIn &&
|
_configFileProvider.UpdateMechanism == UpdateMechanism.BuiltIn &&
|
||||||
!_osInfo.IsDocker)
|
!_osInfo.IsDocker)
|
||||||
{
|
{
|
||||||
|
|
|
@ -177,6 +177,7 @@
|
||||||
"BlocklistReleaseHelpText": "Prevents {appName} from automatically grabbing these files again",
|
"BlocklistReleaseHelpText": "Prevents {appName} from automatically grabbing these files again",
|
||||||
"BlocklistReleases": "Blocklist Releases",
|
"BlocklistReleases": "Blocklist Releases",
|
||||||
"Branch": "Branch",
|
"Branch": "Branch",
|
||||||
|
"BuiltIn": "Built-In",
|
||||||
"BypassIfAboveCustomFormatScore": "Bypass if Above Custom Format Score",
|
"BypassIfAboveCustomFormatScore": "Bypass if Above Custom Format Score",
|
||||||
"BypassIfAboveCustomFormatScoreHelpText": "Enable bypass when release has a score higher than the configured minimum custom format score",
|
"BypassIfAboveCustomFormatScoreHelpText": "Enable bypass when release has a score higher than the configured minimum custom format score",
|
||||||
"BypassIfHighestQuality": "Bypass if Highest Quality",
|
"BypassIfHighestQuality": "Bypass if Highest Quality",
|
||||||
|
@ -1044,6 +1045,7 @@
|
||||||
"SceneInformation": "Scene Information",
|
"SceneInformation": "Scene Information",
|
||||||
"SceneNumberHasntBeenVerifiedYet": "Scene number hasn't been verified yet",
|
"SceneNumberHasntBeenVerifiedYet": "Scene number hasn't been verified yet",
|
||||||
"Scheduled": "Scheduled",
|
"Scheduled": "Scheduled",
|
||||||
|
"Script": "Script",
|
||||||
"ScriptPath": "Script Path",
|
"ScriptPath": "Script Path",
|
||||||
"ScrubAudioTagsHelpText": "Remove existing tags from files, leaving only those added by {appName}.",
|
"ScrubAudioTagsHelpText": "Remove existing tags from files, leaving only those added by {appName}.",
|
||||||
"ScrubExistingTags": "Scrub Existing Tags",
|
"ScrubExistingTags": "Scrub Existing Tags",
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace NzbDrone.Core.Update
|
||||||
{
|
{
|
||||||
EnsureAppDataSafety();
|
EnsureAppDataSafety();
|
||||||
|
|
||||||
if (OsInfo.IsWindows || _configFileProvider.UpdateMechanism != UpdateMechanism.Script)
|
if (_configFileProvider.UpdateMechanism != UpdateMechanism.Script)
|
||||||
{
|
{
|
||||||
var startupFolder = _appFolderInfo.StartUpFolder;
|
var startupFolder = _appFolderInfo.StartUpFolder;
|
||||||
var uiFolder = Path.Combine(startupFolder, "UI");
|
var uiFolder = Path.Combine(startupFolder, "UI");
|
||||||
|
@ -143,7 +143,7 @@ namespace NzbDrone.Core.Update
|
||||||
|
|
||||||
_backupService.Backup(BackupType.Update);
|
_backupService.Backup(BackupType.Update);
|
||||||
|
|
||||||
if (OsInfo.IsNotWindows && _configFileProvider.UpdateMechanism == UpdateMechanism.Script)
|
if (_configFileProvider.UpdateMechanism == UpdateMechanism.Script)
|
||||||
{
|
{
|
||||||
InstallUpdateWithScript(updateSandboxFolder);
|
InstallUpdateWithScript(updateSandboxFolder);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue