From 95e60ed77564ffeddf367a176bff9ed897cb9104 Mon Sep 17 00:00:00 2001 From: inorichi Date: Thu, 5 Apr 2018 10:36:29 +0200 Subject: [PATCH] Update cloudflare interceptor and android studio --- app/build.gradle | 2 +- .../kanade/tachiyomi/network/CloudflareInterceptor.kt | 11 +++++------ build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4197abdc4..60cda489d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -30,7 +30,7 @@ ext { android { compileSdkVersion 27 - buildToolsVersion "27.0.2" + buildToolsVersion '27.0.3' publishNonDefault true defaultConfig { diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt index bc55342ab..dae1252c2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/CloudflareInterceptor.kt @@ -47,19 +47,18 @@ class CloudflareInterceptor : Interceptor { } val js = operation - .replace(Regex("""a\.value =(.+?) \+.*"""), "$1") + .replace(Regex("""a\.value = (.+ \+ t\.length).+"""), "$1") .replace(Regex("""\s{3,}[a-z](?: = |\.).+"""), "") + .replace("t.length", "${domain.length}") .replace("\n", "") - val result = (duktape.evaluate(js) as Double).toInt() - - val answer = "${result + domain.length}" + val result = (duktape.evaluate(js) as Double) val cloudflareUrl = HttpUrl.parse("${url.scheme()}://$domain/cdn-cgi/l/chk_jschl")!! .newBuilder() .addQueryParameter("jschl_vc", challenge) .addQueryParameter("pass", pass) - .addQueryParameter("jschl_answer", answer) + .addQueryParameter("jschl_answer", "$result") .toString() val cloudflareHeaders = originalRequest.headers() @@ -71,4 +70,4 @@ class CloudflareInterceptor : Interceptor { } } -} \ No newline at end of file +} diff --git a/build.gradle b/build.gradle index 3378a689f..2a39702a8 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.1.0' classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0' classpath 'com.github.zellius:android-shortcut-gradle-plugin:0.1.2' // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c6a753671..620a96dc3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Oct 25 23:17:30 CEST 2017 +#Thu Apr 05 09:21:32 CEST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip