fix manga extensions not loading

This commit is contained in:
Aria Moradi 2021-06-17 00:26:34 +04:30
parent 7fc33ba8db
commit 14072bb5a0
2 changed files with 7 additions and 10 deletions

View File

@ -20,8 +20,8 @@ import suwayomi.tachidesk.manga.impl.util.network.UnzippingInterceptor
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
object ExtensionGithubApi { object ExtensionGithubApi {
const val BASE_URL = "https://raw.githubusercontent.com" private const val BASE_URL = "https://raw.githubusercontent.com"
const val REPO_URL_PREFIX = "$BASE_URL/jmir1/tachiyomi-extensions/repo" private const val REPO_URL_PREFIX = "$BASE_URL/jmir1/tachiyomi-extensions/repo"
private fun parseResponse(json: JsonArray): List<OnlineExtension> { private fun parseResponse(json: JsonArray): List<OnlineExtension> {
return json return json
@ -68,7 +68,7 @@ object ExtensionGithubApi {
.build() .build()
} }
private fun getRepo(): com.google.gson.JsonArray { private fun getRepo(): JsonArray {
val request = Request.Builder() val request = Request.Builder()
.url("$REPO_URL_PREFIX/index.json.gz") .url("$REPO_URL_PREFIX/index.json.gz")
.build() .build()

View File

@ -15,13 +15,12 @@ import eu.kanade.tachiyomi.network.NetworkHelper
import okhttp3.Request import okhttp3.Request
import suwayomi.tachidesk.manga.impl.util.PackageTools.LIB_VERSION_MAX import suwayomi.tachidesk.manga.impl.util.PackageTools.LIB_VERSION_MAX
import suwayomi.tachidesk.manga.impl.util.PackageTools.LIB_VERSION_MIN import suwayomi.tachidesk.manga.impl.util.PackageTools.LIB_VERSION_MIN
import suwayomi.tachidesk.manga.impl.util.network.UnzippingInterceptor
import suwayomi.tachidesk.manga.model.dataclass.ExtensionDataClass import suwayomi.tachidesk.manga.model.dataclass.ExtensionDataClass
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
object ExtensionGithubApi { object ExtensionGithubApi {
const val BASE_URL = "https://raw.githubusercontent.com" private const val BASE_URL = "https://raw.githubusercontent.com"
const val REPO_URL_PREFIX = "$BASE_URL/tachiyomiorg/tachiyomi-extensions/repo" private const val REPO_URL_PREFIX = "$BASE_URL/tachiyomiorg/tachiyomi-extensions/repo"
private fun parseResponse(json: JsonArray): List<OnlineExtension> { private fun parseResponse(json: JsonArray): List<OnlineExtension> {
return json return json
@ -60,17 +59,15 @@ object ExtensionGithubApi {
.addNetworkInterceptor { chain -> .addNetworkInterceptor { chain ->
val originalResponse = chain.proceed(chain.request()) val originalResponse = chain.proceed(chain.request())
originalResponse.newBuilder() originalResponse.newBuilder()
.header("Content-Encoding", "gzip")
.header("Content-Type", "application/json") .header("Content-Type", "application/json")
.build() .build()
} }
.addInterceptor(UnzippingInterceptor())
.build() .build()
} }
private fun getRepo(): com.google.gson.JsonArray { private fun getRepo(): JsonArray {
val request = Request.Builder() val request = Request.Builder()
.url("$REPO_URL_PREFIX/index.json.gz") .url("$REPO_URL_PREFIX/index.min.json")
.build() .build()
val response = client.newCall(request).execute().use { response -> response.body!!.string() } val response = client.newCall(request).execute().use { response -> response.body!!.string() }