diff --git a/appveyor.yml b/appveyor.yml index 42764e4a8..09e84d9eb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -27,6 +27,7 @@ deploy: description: $(release_description) auth_token: secure: hOg+16YTIbq4kO9u4D1YVOTbWDqgCX6mAQYMbnmBBSw2CiUsZh7OKbupoUb3FtWa + artifact: /^(?:(?![Ee]xperimental).)*$/ draft: true on: branch: master diff --git a/src/Jackett.Common/Indexers/BaseIndexer.cs b/src/Jackett.Common/Indexers/BaseIndexer.cs index 5de942fc3..f471a99ad 100644 --- a/src/Jackett.Common/Indexers/BaseIndexer.cs +++ b/src/Jackett.Common/Indexers/BaseIndexer.cs @@ -174,14 +174,7 @@ namespace Jackett.Common.Indexers //TODO: Remove this section once users have moved off DPAPI private bool MigratedFromDPAPI(JToken jsonConfig) { - var currentAssembly = Assembly.GetExecutingAssembly(); - bool runningLegacyOwin = new StackTrace().GetFrames() - .Select(x => x.GetMethod().ReflectedType.Assembly).Distinct() - .Where(x => x.GetReferencedAssemblies().Any(y => y.FullName == currentAssembly.FullName)) - .Where(x => x.ManifestModule.Name == "Jackett.dll" || x.ManifestModule.Name == "JackettConsole.exe") - .Count() == 2; - - if (runningLegacyOwin) + if (EnvironmentUtil.IsRunningLegacyOwin) { //Still running legacy Owin and using the DPAPI, we don't want to migrate logger.Debug(ID + " - Running Owin, no need to migrate from DPAPI"); diff --git a/src/Jackett.Common/Indexers/Demonoid.cs b/src/Jackett.Common/Indexers/Demonoid.cs index a612cacc6..c6e0a9ddb 100644 --- a/src/Jackett.Common/Indexers/Demonoid.cs +++ b/src/Jackett.Common/Indexers/Demonoid.cs @@ -40,7 +40,7 @@ namespace Jackett.Common.Indexers { Encoding = Encoding.UTF8; Language = "en-us"; - Type = "private"; + Type = "public"; AddCategoryMapping(5, TorznabCatType.PC0day, "Applications"); AddCategoryMapping(17, TorznabCatType.AudioAudiobook, "Audio Books"); diff --git a/src/Jackett.Common/Indexers/EliteTracker.cs b/src/Jackett.Common/Indexers/EliteTracker.cs index 9af2ca9cf..9b7b6f3c6 100644 --- a/src/Jackett.Common/Indexers/EliteTracker.cs +++ b/src/Jackett.Common/Indexers/EliteTracker.cs @@ -6,6 +6,7 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using AngleSharp.Parser.Html; +using Jackett.Common.Models.IndexerConfig.Bespoke; using Jackett.Common.Models; using Jackett.Common.Models.IndexerConfig; using Jackett.Common.Services.Interfaces; @@ -22,10 +23,11 @@ namespace Jackett.Common.Indexers { get { return SiteLink + "takelogin.php"; } } private string BrowseUrl { get { return SiteLink + "browse.php"; } } + private bool TorrentHTTPSMode => configData.TorrentHTTPSMode.Value; - private new ConfigurationDataBasicLogin configData + private new ConfigurationDataEliteTracker configData { - get { return (ConfigurationDataBasicLogin)base.configData; } + get { return (ConfigurationDataEliteTracker)base.configData; } set { base.configData = value; } } @@ -37,10 +39,10 @@ namespace Jackett.Common.Indexers logger: logger, p: protectionService, client: webClient, - configData: new ConfigurationDataBasicLogin() + configData: new ConfigurationDataEliteTracker() ) { -Encoding = Encoding.UTF8; + Encoding = Encoding.UTF8; Language = "fr-fr"; Type = "private"; @@ -206,6 +208,13 @@ Encoding = Encoding.UTF8; release.Peers = ParseUtil.CoerceInt(Leechers.TextContent) + release.Seeders; release.Grabs = ParseUtil.CoerceLong(Grabs.TextContent); + if (TorrentHTTPSMode) + { + var linkHttps = Row.QuerySelector("td:nth-child(4)").QuerySelector("a").GetAttribute("href"); + var idTorrent = ParseUtil.GetArgumentFromQueryString(linkHttps, "id"); + release.Link = new Uri($"{SiteLink}download.php?id={idTorrent}&type=ssl"); + } + if (added.QuerySelector("img[alt^=\"TORRENT GRATUIT\"]") != null) release.DownloadVolumeFactor = 0; else if (added.QuerySelector("img[alt^=\"TORRENT SILVER\"]") != null) diff --git a/src/Jackett.Common/Models/Config/ConsoleOptions.cs b/src/Jackett.Common/Models/Config/ConsoleOptions.cs index 744695a27..9415b4997 100644 --- a/src/Jackett.Common/Models/Config/ConsoleOptions.cs +++ b/src/Jackett.Common/Models/Config/ConsoleOptions.cs @@ -1,4 +1,5 @@ using CommandLine; +using Jackett.Common.Utils; using System; namespace Jackett.Common.Models.Config @@ -83,7 +84,16 @@ namespace Jackett.Common.Models.Config if (options.ListenPublic && options.ListenPrivate) { Console.WriteLine("You can only use listen private OR listen publicly."); - Engine.Exit(1); + + //TODO: Remove once off Owin + if (EnvironmentUtil.IsRunningLegacyOwin) + { + Engine.Exit(1); + } + else + { + Environment.Exit(1); + } } // SSL Fix diff --git a/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataEliteTracker.cs b/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataEliteTracker.cs new file mode 100644 index 000000000..f8451f71a --- /dev/null +++ b/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataEliteTracker.cs @@ -0,0 +1,13 @@ +namespace Jackett.Common.Models.IndexerConfig.Bespoke +{ + class ConfigurationDataEliteTracker : ConfigurationDataBasicLogin + { + public BoolItem TorrentHTTPSMode { get; private set; } + + public ConfigurationDataEliteTracker() + : base() + { + TorrentHTTPSMode = new BoolItem { Name = "Use https for tracker URL (Experimental)", Value = false }; + } + } +} diff --git a/src/Jackett.Common/Plumbing/JackettModule.cs b/src/Jackett.Common/Plumbing/JackettModule.cs index f84e31b7a..f795a86f3 100644 --- a/src/Jackett.Common/Plumbing/JackettModule.cs +++ b/src/Jackett.Common/Plumbing/JackettModule.cs @@ -83,7 +83,11 @@ namespace Jackett.Common.Plumbing private void RegisterWebClient(ContainerBuilder builder) { - Engine.WebClientType = typeof(WebClientType); + //TODO: Remove once off Owin + if (EnvironmentUtil.IsRunningLegacyOwin) + { + Engine.WebClientType = typeof(WebClientType); + } builder.RegisterType().As(); } diff --git a/src/Jackett.Common/Services/UpdateService.cs b/src/Jackett.Common/Services/UpdateService.cs index 12824859c..36b1a0baa 100644 --- a/src/Jackett.Common/Services/UpdateService.cs +++ b/src/Jackett.Common/Services/UpdateService.cs @@ -12,8 +12,10 @@ using System.Threading.Tasks; using ICSharpCode.SharpZipLib.GZip; using ICSharpCode.SharpZipLib.Tar; using ICSharpCode.SharpZipLib.Zip; +using Jackett.Common.Models.Config; using Jackett.Common.Models.GitHub; using Jackett.Common.Services.Interfaces; +using Jackett.Common.Utils; using Jackett.Common.Utils.Clients; using Newtonsoft.Json; using NLog; @@ -28,14 +30,16 @@ namespace Jackett.Common.Services IConfigurationService configService; ManualResetEvent locker = new ManualResetEvent(false); ITrayLockService lockService; + private ServerConfig serverConfig; bool forceupdatecheck = false; - public UpdateService(Logger l, WebClient c, IConfigurationService cfg, ITrayLockService ls) + public UpdateService(Logger l, WebClient c, IConfigurationService cfg, ITrayLockService ls, ServerConfig sc) { logger = l; client = c; configService = cfg; lockService = ls; + serverConfig = sc; } private string ExePath() @@ -74,13 +78,12 @@ namespace Jackett.Common.Services private async Task CheckForUpdates() { - var config = Engine.ServerConfig; - if (config.RuntimeSettings.NoUpdates) + if (serverConfig.RuntimeSettings.NoUpdates) { logger.Info($"Updates are disabled via --NoUpdates."); return; } - if (config.UpdateDisabled && !forceupdatecheck) + if (serverConfig.UpdateDisabled && !forceupdatecheck) { logger.Info($"Skipping update check as it is disabled."); return; @@ -112,7 +115,7 @@ namespace Jackett.Common.Services var releases = JsonConvert.DeserializeObject>(response.Content); - if (!config.UpdatePrerelease) + if (!serverConfig.UpdatePrerelease) { releases = releases.Where(r => !r.Prerelease).ToList(); } @@ -132,7 +135,7 @@ namespace Jackett.Common.Services var installDir = Path.GetDirectoryName(ExePath()); var updaterPath = Path.Combine(tempDir, "Jackett", "JackettUpdater.exe"); if (updaterPath != null) - StartUpdate(updaterPath, installDir, isWindows, config.RuntimeSettings.NoRestart); + StartUpdate(updaterPath, installDir, isWindows, serverConfig.RuntimeSettings.NoRestart); } catch (Exception e) { @@ -304,7 +307,15 @@ namespace Jackett.Common.Services { logger.Info("Exiting Jackett.."); lockService.Signal(); - Engine.Exit(0); + //TODO: Remove once off Owin + if (EnvironmentUtil.IsRunningLegacyOwin) + { + Engine.Exit(0); + } + else + { + Environment.Exit(0); + } } } } diff --git a/src/Jackett.Common/Utils/EnvironmentUtil.cs b/src/Jackett.Common/Utils/EnvironmentUtil.cs index 63b801beb..a9b3e2880 100644 --- a/src/Jackett.Common/Utils/EnvironmentUtil.cs +++ b/src/Jackett.Common/Utils/EnvironmentUtil.cs @@ -1,4 +1,6 @@ using System; +using System.Diagnostics; +using System.Linq; using System.Reflection; namespace Jackett.Common.Utils @@ -22,6 +24,33 @@ namespace Jackett.Common.Utils } } + public static bool IsRunningLegacyOwin + { + get + { + bool runningOwin; + try + { + var currentAssembly = Assembly.GetExecutingAssembly(); + + bool aspNetCorePresent = new StackTrace().GetFrames() + .Select(x => x.GetMethod().ReflectedType.Assembly).Distinct() + .Where(x => x.GetReferencedAssemblies().Any(y => y.FullName == currentAssembly.FullName)) + .Where(x => x.ManifestModule.Name == "JackettConsole.exe").Select(x => x.CustomAttributes) + .FirstOrDefault() + .Where(x => x.AttributeType.Assembly.FullName.StartsWith("Microsoft.AspNetCore", StringComparison.OrdinalIgnoreCase)) + .Any(); + + runningOwin = !aspNetCorePresent; + } + catch + { + runningOwin = true; + } + + return runningOwin; + } + } } }