From a3a7b78c9684fcfa4d9456b65e1fb7d30ef81cad Mon Sep 17 00:00:00 2001 From: Amine Bou Date: Wed, 23 May 2018 20:00:46 +0200 Subject: [PATCH] Removed direct call to mercury api. --- .github/CONTRIBUTING.md | 4 +--- app/build.gradle | 3 +-- .../amine/bou/readerforselfoss/api/mercury/MercuryApi.kt | 6 +++--- .../bou/readerforselfoss/api/mercury/MercuryService.kt | 4 ++-- .../amine/bou/readerforselfoss/fragments/ArticleFragment.kt | 1 - 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 1a44615..a6003e3 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -49,7 +49,6 @@ You'll have to: - Define some parameters either in `~/.gradle/gradle.properties` or as gradle parameters (see the examples) - - mercuryApiKey: A [Mercury](https://mercury.postlight.com/web-parser/) web parser api key for the internal browser - feedbackEmail: An email to receive users feedback. - sourceUrl: an url to the source code, used in the settings. **It can be empty.** - trackerUrl: an url to the tracker, used in the settings. **It can be empty.** @@ -63,7 +62,6 @@ You'll have to: appLoginUrl="URL" # It can be empty. appLoginUsername="LOGIN" # It can be empty. appLoginPassword="PASS" # It can be empty. -mercuryApiKey="LONGAPIKEY" feedbackEmail="EMAIL" sourceUrl="URLSOURCE" # It can be empty. trackerUrl="URLTRACKER" # It can be empty. @@ -73,5 +71,5 @@ githubToken="GITHUBTOKEN" # It can be empty or use https://github.com/heinrichre #### As gradle parameters ``` -./gradlew .... -P appLoginUrl="URL" -P appLoginUsername="LOGIN" -P appLoginPassword="PASS" -P mercuryApiKey="LONGAPIKEY" -P feedbackEmail="EMAIL" -P sourceUrl="URLSOURCE" -P trackerUrl="URLTRACKER" -P githubToken="GITHUBTOKEN" +./gradlew .... -P appLoginUrl="URL" -P appLoginUsername="LOGIN" -P appLoginPassword="PASS" -P feedbackEmail="EMAIL" -P sourceUrl="URLSOURCE" -P trackerUrl="URLTRACKER" -P githubToken="GITHUBTOKEN" ``` diff --git a/app/build.gradle b/app/build.gradle index 5a6f73e..87043f1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -62,7 +62,6 @@ android { // tests testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - buildConfigField "String", "MERCURY_KEY", mercuryApiKey buildConfigField "String", "FEEDBACK_EMAIL", feedbackEmail buildConfigField "String", "SOURCE_URL", sourceUrl buildConfigField "String", "TRACKER_URL", trackerUrl @@ -172,6 +171,7 @@ dependencies { implementation "ch.acra:acra-http:5.1.3" implementation "ch.acra:acra-dialog:5.1.3" + } @@ -197,7 +197,6 @@ def initAppForSecretPropertiesIfNeeded() { if (!propertiesFile.exists()) { def commentMessage = "This is autogenerated local property from system environment to prevent key to be committed to source control." ant.propertyfile(file: System.getProperty("user.home") + "/.gradle/gradle.properties", comment: commentMessage) { - entry(key: "mercuryApiKey", value: System.getProperty("mercuryApiKey")) entry(key: "feedbackEmail", value: System.getProperty("feedbackEmail")) entry(key: "sourceUrl", value: System.getProperty("sourceUrl")) entry(key: "trackerUrl", value: System.getProperty("trackerUrl")) diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/api/mercury/MercuryApi.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/api/mercury/MercuryApi.kt index 1d5c8ae..d681368 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/api/mercury/MercuryApi.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/api/mercury/MercuryApi.kt @@ -7,7 +7,7 @@ import retrofit2.Call import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory -class MercuryApi(private val key: String, shouldLog: Boolean) { +class MercuryApi(shouldLog: Boolean) { private val service: MercuryService init { @@ -26,7 +26,7 @@ class MercuryApi(private val key: String, shouldLog: Boolean) { val retrofit = Retrofit .Builder() - .baseUrl("https://mercury.postlight.com") + .baseUrl("https://www.amine-bou.fr") .client(client) .addConverterFactory(GsonConverterFactory.create(gson)) .build() @@ -34,6 +34,6 @@ class MercuryApi(private val key: String, shouldLog: Boolean) { } fun parseUrl(url: String): Call { - return service.parseUrl(url, this.key) + return service.parseUrl(url) } } diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/api/mercury/MercuryService.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/api/mercury/MercuryService.kt index 37386b0..5d8a7b2 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/api/mercury/MercuryService.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/api/mercury/MercuryService.kt @@ -6,6 +6,6 @@ import retrofit2.http.Header import retrofit2.http.Query interface MercuryService { - @GET("parser") - fun parseUrl(@Query("url") url: String, @Header("x-api-key") key: String): Call + @GET("parser.php") + fun parseUrl(@Query("link") link: String): Call } diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt index eb95064..293106b 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/fragments/ArticleFragment.kt @@ -180,7 +180,6 @@ class ArticleFragment : Fragment() { ) { rootView.progressBar.visibility = View.VISIBLE val parser = MercuryApi( - BuildConfig.MERCURY_KEY, prefs.getBoolean("should_log_everything", false) )