From 9531bec8c2d5737704394772d58cea18748d4dc2 Mon Sep 17 00:00:00 2001 From: ta264 Date: Tue, 19 Jul 2022 21:08:53 +0100 Subject: [PATCH] New: Plugin support --- .../Blocklist/BlocklistDetailsModal.js | 2 +- frontend/src/Activity/Queue/ProtocolLabel.js | 3 +- frontend/src/App/AppRoutes.js | 6 + frontend/src/Commands/commandNames.js | 2 + .../Builder/FilterBuilderModalContent.js | 10 + .../FilterBuilderModalContentConnector.js | 17 +- .../Filter/Builder/FilterBuilderRow.js | 2 +- .../Builder/ProtocolFilterBuilderRowValue.js | 18 -- .../ProtocolFilterBuilderRowValueConnector.js | 30 +++ .../Components/Page/Sidebar/PageSidebar.js | 4 + frontend/src/Components/SignalRConnector.js | 7 +- frontend/src/Components/TagList.js | 9 +- frontend/src/Helpers/dragTypes.js | 1 + .../InteractiveSearch/InteractiveSearchRow.js | 2 +- .../AddDownloadClientModalContent.js | 49 +++-- .../AddDownloadClientModalContentConnector.js | 9 +- .../Indexers/AddIndexerModalContent.js | 49 +++-- .../AddIndexerModalContentConnector.js | 9 +- .../Settings/Profiles/Delay/DelayProfile.css | 6 +- .../Profiles/Delay/DelayProfile.css.d.ts | 3 +- .../Settings/Profiles/Delay/DelayProfile.js | 62 +++--- .../Profiles/Delay/DelayProfileItem.js | 43 ++++ .../Settings/Profiles/Delay/DelayProfiles.css | 8 +- .../Profiles/Delay/DelayProfiles.css.d.ts | 5 +- .../Settings/Profiles/Delay/DelayProfiles.js | 16 +- .../Profiles/Delay/DownloadProtocolItem.css | 82 ++++++++ .../Delay/DownloadProtocolItem.css.d.ts | 19 ++ .../Profiles/Delay/DownloadProtocolItem.js | 113 +++++++++++ .../Delay/DownloadProtocolItemDragPreview.css | 4 + .../DownloadProtocolItemDragPreview.css.d.ts | 7 + .../Delay/DownloadProtocolItemDragPreview.js | 89 +++++++++ .../Delay/DownloadProtocolItemDragSource.css | 18 ++ .../DownloadProtocolItemDragSource.css.d.ts | 10 + .../Delay/DownloadProtocolItemDragSource.js | 188 +++++++++++++++++ .../Profiles/Delay/DownloadProtocolItems.css | 24 +++ .../Delay/DownloadProtocolItems.css.d.ts | 10 + .../Profiles/Delay/DownloadProtocolItems.js | 150 ++++++++++++++ .../Delay/EditDelayProfileModalContent.js | 119 +++-------- .../EditDelayProfileModalContentConnector.js | 189 +++++++++--------- .../Tags/Details/TagDetailsDelayProfile.css | 15 ++ .../Details/TagDetailsDelayProfile.css.d.ts | 9 + .../Tags/Details/TagDetailsDelayProfile.js | 53 ++--- .../Settings/Tags/Details/TagDetailsModal.js | 2 +- .../Tags/Details/TagDetailsModalContent.js | 14 +- .../Store/Actions/Settings/delayProfiles.js | 4 + frontend/src/Store/Actions/appActions.js | 10 + frontend/src/Store/Actions/systemActions.js | 12 ++ frontend/src/System/Plugins/PluginRow.css | 11 + .../src/System/Plugins/PluginRow.css.d.ts | 8 + frontend/src/System/Plugins/PluginRow.js | 79 ++++++++ frontend/src/System/Plugins/Plugins.css | 6 + frontend/src/System/Plugins/Plugins.js | 168 ++++++++++++++++ .../src/System/Plugins/PluginsConnector.js | 95 +++++++++ .../Blocklist/BlocklistResource.cs | 3 +- .../Commands/CommandController.cs | 3 +- .../DownloadClient/DownloadClientResource.cs | 3 +- src/Lidarr.Api.V1/Indexers/IndexerResource.cs | 2 +- src/Lidarr.Api.V1/Indexers/ReleaseResource.cs | 4 +- .../Profiles/Delay/DelayProfileController.cs | 13 +- .../Delay/DelayProfileProtocolItemResource.cs | 47 +++++ .../Profiles/Delay/DelayProfileResource.cs | 24 +-- .../Delay/DelayProfileSchemaController.cs | 22 ++ src/Lidarr.Api.V1/ProviderResource.cs | 2 +- src/Lidarr.Api.V1/Queue/QueueController.cs | 9 +- src/Lidarr.Api.V1/Queue/QueueResource.cs | 3 +- .../System/Plugins/PluginController.cs | 24 +++ .../System/Plugins/PluginResource.cs | 38 ++++ .../ReflectionExtensionFixture.cs | 5 +- .../ServiceFactoryFixture.cs | 5 +- .../Composition/AssemblyLoader.cs | 27 ++- src/NzbDrone.Common/Composition/Extensions.cs | 17 +- .../Composition/PluginLoadContext.cs | 41 ++++ .../Composition/PluginLoader.cs | 81 ++++++++ .../Composition/PluginStatus.cs | 7 + .../Extensions/PathExtensions.cs | 21 ++ .../Reflection/ReflectionExtensions.cs | 32 ++- .../Blocklisting/BlocklistServiceFixture.cs | 7 +- .../AlreadyImportedSpecificationFixture.cs | 8 +- .../MinimumAgeSpecificationFixture.cs | 2 +- .../PrioritizeDownloadDecisionFixture.cs | 40 ++-- .../ProtocolSpecificationFixture.cs | 18 +- .../RawDiskSpecificationFixture.cs | 2 +- .../RetentionSpecificationFixture.cs | 4 +- .../RssSync/DelaySpecificationFixture.cs | 30 ++- .../DownloadApprovedFixture.cs | 12 +- .../Download/DownloadClientProviderFixture.cs | 100 ++++----- .../Download/DownloadServiceFixture.cs | 12 +- .../TrackedDownloadServiceFixture.cs | 10 +- .../Checks/RemotePathMappingCheckFixture.cs | 8 +- .../HistoryTests/HistoryServiceFixture.cs | 2 +- .../FileListTests/FileListFixture.cs | 2 +- .../GazelleTests/GazelleFixture.cs | 2 +- .../HeadphonesTests/HeadphonesFixture.cs | 2 +- .../IPTorrentsTests/IPTorrentsFixture.cs | 2 +- .../IndexerIntegrationTests.cs | 2 +- .../NewznabTests/NewznabFixture.cs | 2 +- .../IndexerTests/NyaaTests/NyaaFixture.cs | 4 +- .../RedactedTests/RedactedFixture.cs | 2 +- .../IndexerTests/SeedConfigProviderFixture.cs | 4 +- .../IndexerTests/TestIndexer.cs | 2 +- .../TorrentRssIndexerFixture.cs | 20 +- .../TorrentleechTests/TorrentleechFixture.cs | 2 +- .../TorznabTests/TorznabFixture.cs | 4 +- src/NzbDrone.Core/Blocklisting/Blocklist.cs | 3 +- .../Blocklisting/BlocklistService.cs | 124 ++---------- .../Blocklisting/IBlocklistForProtocol.cs | 12 ++ .../Blocklisting/TorrentBlocklist.cs | 69 +++++++ .../Blocklisting/UsenetBlocklist.cs | 96 +++++++++ .../Migration/043_flexible_delay_profiles.cs | 146 ++++++++++++++ .../046_convert_blacklist_protocol.cs | 21 ++ .../Migration/052_download_history.cs | 26 ++- src/NzbDrone.Core/Datastore/TableMapping.cs | 4 +- .../DownloadDecisionComparer.cs | 15 +- .../AlreadyImportedSpecification.cs | 2 +- .../Specifications/MinimumAgeSpecification.cs | 3 +- .../Specifications/ProtocolSpecification.cs | 14 +- .../Specifications/RetentionSpecification.cs | 3 +- .../RssSync/DelaySpecification.cs | 2 +- .../Download/Clients/Pneumatic/Pneumatic.cs | 2 +- .../Download/DownloadClientBase.cs | 2 +- .../Download/DownloadClientDefinition.cs | 3 +- .../Download/DownloadClientItem.cs | 3 +- .../Download/DownloadClientProvider.cs | 4 +- .../Download/DownloadClientRepository.cs | 9 +- .../Download/History/DownloadHistory.cs | 3 +- src/NzbDrone.Core/Download/IDownloadClient.cs | 2 +- .../Download/Pending/PendingReleaseService.cs | 9 +- .../Download/ProcessDownloadDecisions.cs | 8 +- .../Download/TorrentClientBase.cs | 2 +- .../TrackedDownloads/TrackedDownload.cs | 3 +- .../Download/UsenetClientBase.cs | 2 +- .../Extras/Metadata/MetadataRepository.cs | 9 +- .../HealthCheck/Checks/PluginCheck.cs | 26 +++ .../History/EntityHistoryService.cs | 2 +- .../ImportLists/ImportListRepository.cs | 7 +- .../Indexers/DownloadProtocol.cs | 13 +- .../Indexers/FileList/FileList.cs | 2 +- src/NzbDrone.Core/Indexers/Gazelle/Gazelle.cs | 4 +- .../Indexers/Headphones/Headphones.cs | 2 +- src/NzbDrone.Core/Indexers/IIndexer.cs | 2 +- .../Indexers/IPTorrents/IPTorrents.cs | 2 +- src/NzbDrone.Core/Indexers/IndexerBase.cs | 2 +- .../Indexers/IndexerDefinition.cs | 2 +- .../Indexers/IndexerRepository.cs | 9 +- src/NzbDrone.Core/Indexers/Newznab/Newznab.cs | 4 +- src/NzbDrone.Core/Indexers/Nyaa/Nyaa.cs | 2 +- .../Indexers/Redacted/Redacted.cs | 2 +- .../Indexers/SeedConfigProvider.cs | 2 +- .../Indexers/TorrentRss/TorrentRssIndexer.cs | 2 +- .../Indexers/Torrentleech/Torrentleech.cs | 2 +- src/NzbDrone.Core/Indexers/Torznab/Torznab.cs | 4 +- src/NzbDrone.Core/Lidarr.Core.csproj | 5 +- .../Notifications/NotificationRepository.cs | 7 +- src/NzbDrone.Core/Parser/Model/ReleaseInfo.cs | 3 +- .../Plugins/Commands/InstallPluginCommand.cs | 13 ++ .../Commands/UninstallPluginCommand.cs | 13 ++ .../Plugins/InstallPluginService.cs | 105 ++++++++++ src/NzbDrone.Core/Plugins/Plugin.cs | 32 +++ src/NzbDrone.Core/Plugins/PluginService.cs | 117 +++++++++++ .../Plugins/Resources/GithubRelease.cs | 58 ++++++ .../Profiles/Delay/DelayProfile.cs | 38 +++- .../Delay/DelayProfileProtocolItem.cs | 12 ++ .../Profiles/Delay/DelayProfileService.cs | 46 ++++- src/NzbDrone.Core/Queue/Queue.cs | 3 +- .../ThingiProvider/ProviderRepository.cs | 17 +- src/NzbDrone.Host.Test/ContainerFixture.cs | 5 +- src/NzbDrone.Host/Bootstrap.cs | 179 ++++++++++++----- .../ApiTests/PluginFixture.cs | 121 +++++++++++ .../IntegrationTest.cs | 2 +- .../IntegrationTestBase.cs | 3 + src/NzbDrone.Update/UpdateApp.cs | 5 +- 171 files changed, 3264 insertions(+), 830 deletions(-) delete mode 100644 frontend/src/Components/Filter/Builder/ProtocolFilterBuilderRowValue.js create mode 100644 frontend/src/Components/Filter/Builder/ProtocolFilterBuilderRowValueConnector.js create mode 100644 frontend/src/Settings/Profiles/Delay/DelayProfileItem.js create mode 100644 frontend/src/Settings/Profiles/Delay/DownloadProtocolItem.css create mode 100644 frontend/src/Settings/Profiles/Delay/DownloadProtocolItem.css.d.ts create mode 100644 frontend/src/Settings/Profiles/Delay/DownloadProtocolItem.js create mode 100644 frontend/src/Settings/Profiles/Delay/DownloadProtocolItemDragPreview.css create mode 100644 frontend/src/Settings/Profiles/Delay/DownloadProtocolItemDragPreview.css.d.ts create mode 100644 frontend/src/Settings/Profiles/Delay/DownloadProtocolItemDragPreview.js create mode 100644 frontend/src/Settings/Profiles/Delay/DownloadProtocolItemDragSource.css create mode 100644 frontend/src/Settings/Profiles/Delay/DownloadProtocolItemDragSource.css.d.ts create mode 100644 frontend/src/Settings/Profiles/Delay/DownloadProtocolItemDragSource.js create mode 100644 frontend/src/Settings/Profiles/Delay/DownloadProtocolItems.css create mode 100644 frontend/src/Settings/Profiles/Delay/DownloadProtocolItems.css.d.ts create mode 100644 frontend/src/Settings/Profiles/Delay/DownloadProtocolItems.js create mode 100644 frontend/src/Settings/Tags/Details/TagDetailsDelayProfile.css create mode 100644 frontend/src/Settings/Tags/Details/TagDetailsDelayProfile.css.d.ts create mode 100644 frontend/src/System/Plugins/PluginRow.css create mode 100644 frontend/src/System/Plugins/PluginRow.css.d.ts create mode 100644 frontend/src/System/Plugins/PluginRow.js create mode 100644 frontend/src/System/Plugins/Plugins.css create mode 100644 frontend/src/System/Plugins/Plugins.js create mode 100644 frontend/src/System/Plugins/PluginsConnector.js create mode 100644 src/Lidarr.Api.V1/Profiles/Delay/DelayProfileProtocolItemResource.cs create mode 100644 src/Lidarr.Api.V1/Profiles/Delay/DelayProfileSchemaController.cs create mode 100644 src/Lidarr.Api.V1/System/Plugins/PluginController.cs create mode 100644 src/Lidarr.Api.V1/System/Plugins/PluginResource.cs create mode 100644 src/NzbDrone.Common/Composition/PluginLoadContext.cs create mode 100644 src/NzbDrone.Common/Composition/PluginLoader.cs create mode 100644 src/NzbDrone.Common/Composition/PluginStatus.cs create mode 100644 src/NzbDrone.Core/Blocklisting/IBlocklistForProtocol.cs create mode 100644 src/NzbDrone.Core/Blocklisting/TorrentBlocklist.cs create mode 100644 src/NzbDrone.Core/Blocklisting/UsenetBlocklist.cs create mode 100644 src/NzbDrone.Core/Datastore/Migration/043_flexible_delay_profiles.cs create mode 100644 src/NzbDrone.Core/Datastore/Migration/046_convert_blacklist_protocol.cs create mode 100644 src/NzbDrone.Core/HealthCheck/Checks/PluginCheck.cs create mode 100644 src/NzbDrone.Core/Plugins/Commands/InstallPluginCommand.cs create mode 100644 src/NzbDrone.Core/Plugins/Commands/UninstallPluginCommand.cs create mode 100644 src/NzbDrone.Core/Plugins/InstallPluginService.cs create mode 100644 src/NzbDrone.Core/Plugins/Plugin.cs create mode 100644 src/NzbDrone.Core/Plugins/PluginService.cs create mode 100644 src/NzbDrone.Core/Plugins/Resources/GithubRelease.cs create mode 100644 src/NzbDrone.Core/Profiles/Delay/DelayProfileProtocolItem.cs create mode 100644 src/NzbDrone.Integration.Test/ApiTests/PluginFixture.cs diff --git a/frontend/src/Activity/Blocklist/BlocklistDetailsModal.js b/frontend/src/Activity/Blocklist/BlocklistDetailsModal.js index 506fa0129..a1d3131d4 100644 --- a/frontend/src/Activity/Blocklist/BlocklistDetailsModal.js +++ b/frontend/src/Activity/Blocklist/BlocklistDetailsModal.js @@ -46,7 +46,7 @@ class BlocklistDetailsModal extends Component { { diff --git a/frontend/src/Activity/Queue/ProtocolLabel.js b/frontend/src/Activity/Queue/ProtocolLabel.js index e8a08943c..ae0534f7a 100644 --- a/frontend/src/Activity/Queue/ProtocolLabel.js +++ b/frontend/src/Activity/Queue/ProtocolLabel.js @@ -4,7 +4,8 @@ import Label from 'Components/Label'; import styles from './ProtocolLabel.css'; function ProtocolLabel({ protocol }) { - const protocolName = protocol === 'usenet' ? 'nzb' : protocol; + const strippedName = protocol.replace('DownloadProtocol', '').toLowerCase(); + const protocolName = strippedName === 'usenet' ? 'nzb' : strippedName; return (