From c9e6a0339e743be5e6cf523959524cbe8a506f21 Mon Sep 17 00:00:00 2001 From: Qstick Date: Wed, 29 Dec 2021 18:18:09 -0600 Subject: [PATCH] Fixed: (Cardigann) Indexer privacy tweaks, Semi-Public fixes Fixes #744 --- .../src/Indexer/Add/AddIndexerModalContent.js | 19 +++++++++++++++---- frontend/src/Indexer/Add/SelectIndexerRow.js | 4 +++- .../Definitions/Cardigann/Cardigann.cs | 7 ++++++- src/NzbDrone.Core/Indexers/IndexerFactory.cs | 7 ++++++- src/NzbDrone.Core/Localization/Core/en.json | 3 +++ 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/frontend/src/Indexer/Add/AddIndexerModalContent.js b/frontend/src/Indexer/Add/AddIndexerModalContent.js index 78b0469c0..ddc7e4a3a 100644 --- a/frontend/src/Indexer/Add/AddIndexerModalContent.js +++ b/frontend/src/Indexer/Add/AddIndexerModalContent.js @@ -56,6 +56,21 @@ const protocols = [ } ]; +const privacyLevels = [ + { + key: 'private', + value: translate('Private') + }, + { + key: 'semiPublic', + value: translate('SemiPublic') + }, + { + key: 'public', + value: translate('Public') + } +]; + class AddIndexerModalContent extends Component { // @@ -99,10 +114,6 @@ class AddIndexerModalContent extends Component { .sort((a, b) => a.localeCompare(b)) .map((language) => ({ key: language, value: language })); - const privacyLevels = Array.from(new Set(indexers.map(({ privacy }) => privacy))) - .sort((a, b) => a.localeCompare(b)) - .map((privacy) => ({ key: privacy, value: privacy })); - const filteredIndexers = indexers.filter((indexer) => { const { filter, filterProtocols, filterLanguages, filterPrivacyLevels } = this.state; diff --git a/frontend/src/Indexer/Add/SelectIndexerRow.js b/frontend/src/Indexer/Add/SelectIndexerRow.js index 24acb2650..fbf05e927 100644 --- a/frontend/src/Indexer/Add/SelectIndexerRow.js +++ b/frontend/src/Indexer/Add/SelectIndexerRow.js @@ -3,6 +3,8 @@ import React, { Component } from 'react'; import TableRowCell from 'Components/Table/Cells/TableRowCell'; import TableRowButton from 'Components/Table/TableRowButton'; import ProtocolLabel from 'Indexer/Index/Table/ProtocolLabel'; +import firstCharToUpper from 'Utilities/String/firstCharToUpper'; +import translate from 'Utilities/String/translate'; import styles from './SelectIndexerRow.css'; class SelectIndexerRow extends Component { @@ -47,7 +49,7 @@ class SelectIndexerRow extends Component { - {privacy} + {translate(firstCharToUpper(privacy))} ); diff --git a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/Cardigann.cs b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/Cardigann.cs index f2759f848..75435c570 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Cardigann/Cardigann.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Cardigann/Cardigann.cs @@ -128,7 +128,12 @@ namespace NzbDrone.Core.Indexers.Cardigann IndexerUrls = definition.Links.ToArray(), Settings = new CardigannSettings { DefinitionFile = definition.File }, Protocol = DownloadProtocol.Torrent, - Privacy = definition.Type == "private" ? IndexerPrivacy.Private : IndexerPrivacy.Public, + Privacy = definition.Type switch + { + "private" => IndexerPrivacy.Private, + "public" => IndexerPrivacy.Public, + _ => IndexerPrivacy.SemiPublic + }, SupportsRss = SupportsRss, SupportsSearch = SupportsSearch, SupportsRedirect = SupportsRedirect, diff --git a/src/NzbDrone.Core/Indexers/IndexerFactory.cs b/src/NzbDrone.Core/Indexers/IndexerFactory.cs index d23306583..7a583c6a6 100644 --- a/src/NzbDrone.Core/Indexers/IndexerFactory.cs +++ b/src/NzbDrone.Core/Indexers/IndexerFactory.cs @@ -94,7 +94,12 @@ namespace NzbDrone.Core.Indexers definition.Description = defFile.Description; definition.Language = defFile.Language; definition.Encoding = Encoding.GetEncoding(defFile.Encoding); - definition.Privacy = defFile.Type == "private" ? IndexerPrivacy.Private : IndexerPrivacy.Public; + definition.Privacy = defFile.Type switch + { + "private" => IndexerPrivacy.Private, + "public" => IndexerPrivacy.Public, + _ => IndexerPrivacy.SemiPublic + }; definition.Capabilities = new IndexerCapabilities(); definition.Capabilities.ParseCardigannSearchModes(defFile.Caps.Modes); definition.Capabilities.SupportsRawSearch = defFile.Caps.Allowrawsearch; diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 312b07bc5..1f07a2501 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -286,6 +286,7 @@ "PriorityHelpText": "Prioritize multiple Download Clients. Round-Robin is used for clients with the same priority.", "PrioritySettings": "Priority", "Privacy": "Privacy", + "Private": "Private", "Protocol": "Protocol", "ProwlarrSupportsAnyDownloadClient": "Prowlarr supports any of the download clients listed below.", "ProwlarrSupportsAnyIndexer": "Prowlarr supports many indexers in addition to any indexer that uses the Newznab/Torznab standard using 'Generic Newznab' (for usenet) or 'Generic Torznab' (for torrents). Search & Select your indexer from below.", @@ -298,6 +299,7 @@ "ProxyType": "Proxy Type", "ProxyUsernameHelpText": "You only need to enter a username and password if one is required. Leave them blank otherwise.", "PtpOldSettingsCheckMessage": "The following PassThePopcorn indexers have deprecated settings and should be updated: {0}", + "Public": "Public", "QualityDefinitions": "Quality Definitions", "QualitySettings": "Quality Settings", "Query": "Query", @@ -340,6 +342,7 @@ "Security": "Security", "Seeders": "Seeders", "SelectAll": "Select All", + "SemiPublic": "Semi-Public", "SendAnonymousUsageData": "Send Anonymous Usage Data", "SetTags": "Set Tags", "Settings": "Settings",