mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-08 05:51:47 -07:00
Fixed: Filter mapped drives when running from service
This commit is contained in:
parent
70dc4d86dc
commit
68aaa49e9f
6 changed files with 51 additions and 4 deletions
|
@ -5,6 +5,18 @@
|
|||
flex-direction: column;
|
||||
}
|
||||
|
||||
.mappedDrivesWarning {
|
||||
composes: alert from 'Components/Alert.css';
|
||||
|
||||
margin: 0;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.faqLink {
|
||||
color: $alertWarningColor;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.pathInput {
|
||||
composes: pathInputWrapper from 'Components/Form/PathInput.css';
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { scrollDirections } from 'Helpers/Props';
|
||||
import { kinds, scrollDirections } from 'Helpers/Props';
|
||||
import Alert from 'Components/Alert';
|
||||
import Button from 'Components/Link/Button';
|
||||
import Link from 'Components/Link/Link';
|
||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||
import ModalContent from 'Components/Modal/ModalContent';
|
||||
import ModalHeader from 'Components/Modal/ModalHeader';
|
||||
|
@ -101,6 +103,7 @@ class FileBrowserModalContent extends Component {
|
|||
parent,
|
||||
directories,
|
||||
files,
|
||||
isWindowsService,
|
||||
onModalClose,
|
||||
...otherProps
|
||||
} = this.props;
|
||||
|
@ -119,6 +122,16 @@ class FileBrowserModalContent extends Component {
|
|||
className={styles.modalBody}
|
||||
scrollDirection={scrollDirections.NONE}
|
||||
>
|
||||
{
|
||||
isWindowsService &&
|
||||
<Alert
|
||||
className={styles.mappedDrivesWarning}
|
||||
kind={kinds.WARNING}
|
||||
>
|
||||
Mapped network drives are not available when running as a Windows Service, see the <Link className={styles.faqLink} to="https://github.com/Lidarr/Lidarr/wiki/FAQ">FAQ</Link> for more information.
|
||||
</Alert>
|
||||
}
|
||||
|
||||
<PathInput
|
||||
className={styles.pathInput}
|
||||
placeholder="Start typing or select a path below"
|
||||
|
@ -230,6 +243,7 @@ FileBrowserModalContent.propTypes = {
|
|||
currentPath: PropTypes.string.isRequired,
|
||||
directories: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
files: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
isWindowsService: PropTypes.bool.isRequired,
|
||||
onFetchPaths: PropTypes.func.isRequired,
|
||||
onClearPaths: PropTypes.func.isRequired,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
|
|
|
@ -4,12 +4,14 @@ import React, { Component } from 'react';
|
|||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { fetchPaths, clearPaths } from 'Store/Actions/pathActions';
|
||||
import createSystemStatusSelector from 'Store/Selectors/createSystemStatusSelector';
|
||||
import FileBrowserModalContent from './FileBrowserModalContent';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state) => state.paths,
|
||||
(paths) => {
|
||||
createSystemStatusSelector(),
|
||||
(paths, systemStatus) => {
|
||||
const {
|
||||
isFetching,
|
||||
isPopulated,
|
||||
|
@ -32,7 +34,8 @@ function createMapStateToProps() {
|
|||
currentPath,
|
||||
directories,
|
||||
files,
|
||||
paths: filteredPaths
|
||||
paths: filteredPaths,
|
||||
isWindowsService: true || systemStatus.isWindows && systemStatus.mode === 'service'
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace Lidarr.Api.V1.Artist
|
|||
IManageCommandQueue commandQueueManager,
|
||||
IRootFolderService rootFolderService,
|
||||
RootFolderValidator rootFolderValidator,
|
||||
MappedNetworkDriveValidator mappedNetworkDriveValidator,
|
||||
ArtistPathValidator artistPathValidator,
|
||||
ArtistExistsValidator artistExistsValidator,
|
||||
ArtistAncestorValidator artistAncestorValidator,
|
||||
|
@ -83,6 +84,7 @@ namespace Lidarr.Api.V1.Artist
|
|||
.Cascade(CascadeMode.StopOnFirstFailure)
|
||||
.IsValidPath()
|
||||
.SetValidator(rootFolderValidator)
|
||||
.SetValidator(mappedNetworkDriveValidator)
|
||||
.SetValidator(artistPathValidator)
|
||||
.SetValidator(artistAncestorValidator)
|
||||
.SetValidator(systemFolderValidator)
|
||||
|
|
|
@ -111,6 +111,10 @@
|
|||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Lidarr.Api.V1\Lidarr.Api.V1.csproj">
|
||||
<Project>{7140ff1f-79be-492f-9188-b21a050bf708}</Project>
|
||||
<Name>Lidarr.Api.V1</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\NzbDrone.Common\NzbDrone.Common.csproj">
|
||||
<Project>{F2BE0FDF-6E47-4827-A420-DD4EF82407F8}</Project>
|
||||
<Name>NzbDrone.Common</Name>
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace NzbDrone.Common.Disk
|
|||
public class FileSystemLookupService : IFileSystemLookupService
|
||||
{
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IRuntimeInfo _runtimeInfo;
|
||||
|
||||
private readonly HashSet<string> _setToRemove = new HashSet<string>
|
||||
{
|
||||
|
@ -46,9 +47,10 @@ namespace NzbDrone.Common.Disk
|
|||
"@eadir"
|
||||
};
|
||||
|
||||
public FileSystemLookupService(IDiskProvider diskProvider)
|
||||
public FileSystemLookupService(IDiskProvider diskProvider, IRuntimeInfo runtimeInfo)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_runtimeInfo = runtimeInfo;
|
||||
}
|
||||
|
||||
public FileSystemResult LookupContents(string query, bool includeFiles, bool allowFoldersWithoutTrailingSlashes)
|
||||
|
@ -88,6 +90,16 @@ namespace NzbDrone.Common.Disk
|
|||
private List<FileSystemModel> GetDrives()
|
||||
{
|
||||
return _diskProvider.GetMounts()
|
||||
.Where(d =>
|
||||
{
|
||||
// Fow Windows Services, exclude mapped network drives.
|
||||
if (_runtimeInfo.IsWindowsService)
|
||||
{
|
||||
return d.DriveType != DriveType.Network;
|
||||
}
|
||||
|
||||
return true;
|
||||
})
|
||||
.Select(d => new FileSystemModel
|
||||
{
|
||||
Type = FileSystemEntityType.Drive,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue