From 851a4d30e1ab2b20d8883f729a38a40df8ffcb4b Mon Sep 17 00:00:00 2001 From: garfield69 Date: Fri, 6 Oct 2017 21:36:04 +1300 Subject: [PATCH] DanishBits: add Passkey info to hopefully prevent #1892 #1873 #1850 (#1925) * DanishBits: add Passkey info to hopefully prevent #1892 #1873 #1850 **WARNING** this is a completely untested code change, as I don't have VS or a c# compiler. I simply made my best guess based on similar code I found in TorrentBytes.cs Please review carefully, and hopefully I haven't left anything out ;-) If you don't want me to make future changes like this without the required tools, then please let me know. Thanks. * Update DanishBits.cs * Update DanishBits.cs * Update DanishBits.cs * Update DanishBits.cs * Update DanishBits.cs * Update DanishBits.cs * Update ConfigurationDataUserPasskey.cs add display item instructions * Update DanishBits.cs switch to ConfigurationDataUserPasskey and drop unused using statements * Update CouchPotatoTracker.cs add ConfigurationDataUserPasskey ConfigData1 * Update CouchPotatoTracker.cs fix optional configData parm override * revert oops no, that wipes preloaded data :( * Update CouchPotatoTracker.cs add configurationDataUserPasskey as parameter --- .../Indexers/Abstract/CouchPotatoTracker.cs | 7 ++++--- src/Jackett/Indexers/DanishBits.cs | 14 +++++++++++--- .../IndexerConfig/ConfigurationDataUserPasskey.cs | 4 +++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/Jackett/Indexers/Abstract/CouchPotatoTracker.cs b/src/Jackett/Indexers/Abstract/CouchPotatoTracker.cs index 9b8123d2a..f1f53ff5c 100644 --- a/src/Jackett/Indexers/Abstract/CouchPotatoTracker.cs +++ b/src/Jackett/Indexers/Abstract/CouchPotatoTracker.cs @@ -1,4 +1,4 @@ -using Jackett.Models; +using Jackett.Models; using Jackett.Models.IndexerConfig; using Jackett.Services; using Jackett.Utils; @@ -23,7 +23,7 @@ namespace Jackett.Indexers.Abstract set { base.configData = value; } } - public CouchPotatoTracker(IIndexerConfigurationService configService, IWebClient client, Logger logger, IProtectionService p, string name, string description, string link, string endpoint) + public CouchPotatoTracker(IIndexerConfigurationService configService, IWebClient client, Logger logger, IProtectionService p, ConfigurationDataUserPasskey configData, string name, string description, string link, string endpoint) : base(name: name, description: description, link: link, @@ -32,7 +32,8 @@ namespace Jackett.Indexers.Abstract client: client, logger: logger, p: p, - configData: new ConfigurationDataUserPasskey()) + configData: configData + ) { this.endpoint = endpoint; TorznabCaps.SupportsImdbSearch = true; diff --git a/src/Jackett/Indexers/DanishBits.cs b/src/Jackett/Indexers/DanishBits.cs index ae7021bf2..fc3487ae6 100644 --- a/src/Jackett/Indexers/DanishBits.cs +++ b/src/Jackett/Indexers/DanishBits.cs @@ -1,4 +1,4 @@ -using Jackett.Models; +using Jackett.Models; using Jackett.Services; using Jackett.Utils.Clients; using NLog; @@ -7,11 +7,18 @@ using Jackett.Indexers.Abstract; using System.Collections.Generic; using System.Threading.Tasks; using System.Text.RegularExpressions; +using Jackett.Models.IndexerConfig; namespace Jackett.Indexers { public class DanishBits : CouchPotatoTracker { + new ConfigurationDataUserPasskey configData + { + get { return (ConfigurationDataUserPasskey)base.configData; } + set { base.configData = value; } + } + public DanishBits(IIndexerConfigurationService configService, IWebClient c, Logger l, IProtectionService ps) : base(name: "DanishBits", description: "A danish closed torrent tracker", @@ -20,8 +27,9 @@ namespace Jackett.Indexers configService: configService, client: c, logger: l, - p: ps - ) + p: ps, + configData: new ConfigurationDataUserPasskey("Note about Passkey: This is not your login Password. Find the Passkey by logging into DanishBits with your Browser, and under your account page you'll see your passkey under the 'Personal' section on the left side.") + ) { Encoding = Encoding.GetEncoding("UTF-8"); Language = "da-dk"; diff --git a/src/Jackett/Models/IndexerConfig/ConfigurationDataUserPasskey.cs b/src/Jackett/Models/IndexerConfig/ConfigurationDataUserPasskey.cs index 7f41230f1..38511ea3f 100644 --- a/src/Jackett/Models/IndexerConfig/ConfigurationDataUserPasskey.cs +++ b/src/Jackett/Models/IndexerConfig/ConfigurationDataUserPasskey.cs @@ -1,14 +1,16 @@ -namespace Jackett.Models.IndexerConfig +namespace Jackett.Models.IndexerConfig { public class ConfigurationDataUserPasskey : ConfigurationData { public StringItem Username { get; private set; } public StringItem Passkey { get; private set; } + public DisplayItem Instructions { get; private set; } public ConfigurationDataUserPasskey(string instructionMessageOptional = null) { Username = new StringItem { Name = "Username" }; Passkey = new StringItem { Name = "Passkey" }; + Instructions = new DisplayItem(instructionMessageOptional) { Name = "" }; } } }