33using System . Net ;
44using System . Threading ;
55using Leaf . xNet . Services . Captcha ;
6+
67// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
78// ReSharper disable MemberCanBePrivate.Global
89
@@ -17,6 +18,10 @@ namespace Leaf.xNet.Services.Cloudflare
1718 // ReSharper disable once UnusedType.Global
1819 public static class CloudflareBypass
1920 {
21+ private const string PublicVersionIsNotMaintained = "Not maintained in public Leaf.xNet anymore.\r \n " +
22+ "You can order private paid Leaf.xNet with support.\r \n " +
23+ "Telegram: @kelog" ;
24+
2025 #region Public / Private: Data
2126
2227 /// <summary>
@@ -58,6 +63,7 @@ public static class CloudflareBypass
5863 /// Check response for Cloudflare protection.
5964 /// </summary>
6065 /// <returns>Returns <keyword>true</keyword> if response has Cloudflare protection challenge.</returns>
66+ [ ObsoleteAttribute ( PublicVersionIsNotMaintained ) ]
6167 public static bool IsCloudflared ( this HttpResponse response )
6268 {
6369 bool serviceUnavailable = response . StatusCode == HttpStatusCode . ServiceUnavailable || response . StatusCode == HttpStatusCode . Forbidden ;
@@ -78,6 +84,7 @@ public static bool IsCloudflared(this HttpResponse response)
7884 /// <exception cref="CloudflareException">When unable to bypass Cloudflare</exception>
7985 /// <exception cref="CaptchaException">When unable to solve captcha using <see cref="ICaptchaSolver"/> provider.</exception>
8086 /// <returns>Returns original HttpResponse</returns>
87+ [ ObsoleteAttribute ( PublicVersionIsNotMaintained ) ]
8188 public static HttpResponse GetThroughCloudflare ( this HttpRequest request , Uri uri ,
8289 DLog log = null ,
8390 CancellationToken cancellationToken = default ,
@@ -144,6 +151,7 @@ public static HttpResponse GetThroughCloudflare(this HttpRequest request, Uri ur
144151
145152 /// <inheritdoc cref="GetThroughCloudflare(HttpRequest, string, DLog, CancellationToken, ICaptchaSolver)"/>
146153 /// <param name="url">URL address</param>
154+ [ ObsoleteAttribute ( PublicVersionIsNotMaintained ) ]
147155 // ReSharper disable once UnusedMember.Global
148156 public static HttpResponse GetThroughCloudflare ( this HttpRequest request , string url ,
149157 DLog log = null ,
@@ -183,7 +191,9 @@ private static bool IsChallengePassed(string tag, ref HttpResponse response, Htt
183191 response = request . Get ( response . RedirectAddress . AbsoluteUri ) ;
184192 request . IgnoreProtocolErrors = ignoreProtocolErrors ;
185193
194+ #pragma warning disable 618
186195 if ( IsCloudflared ( response ) )
196+ #pragma warning restore 618
187197 {
188198 log ? . Invoke ( $ "{ LogPrefix } ERROR [{ tag } ]. Unable to get he original response at: { uri . AbsoluteUri } ") ;
189199 return false ;
0 commit comments