get gz insead of big big json

This commit is contained in:
Aria Moradi 2021-03-30 20:41:20 +04:30
parent b808121f1d
commit 11000af718

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.extension.api
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.network.NetworkHelper
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonArray import kotlinx.serialization.json.JsonArray
import okhttp3.MediaType.Companion.toMediaType import okhttp3.MediaType.Companion.toMediaType
@ -23,13 +24,14 @@ interface ExtensionGithubService {
.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-Encoding", "gzip")
.header("Content-Type", "application/json") .header("Content-Type", "application/json")
.build() .build()
} }
.build() .build()
} }
@ExperimentalSerializationApi
fun create(): ExtensionGithubService { fun create(): ExtensionGithubService {
val adapter = Retrofit.Builder() val adapter = Retrofit.Builder()
.baseUrl(ExtensionGithubApi.BASE_URL) .baseUrl(ExtensionGithubApi.BASE_URL)
@ -41,7 +43,6 @@ interface ExtensionGithubService {
} }
} }
// @GET("${ExtensionGithubApi.REPO_URL_PREFIX}/index.json.gz") @GET("${ExtensionGithubApi.REPO_URL_PREFIX}/index.json.gz")
@GET("${ExtensionGithubApi.REPO_URL_PREFIX}/index.json")
suspend fun getRepo(): JsonArray suspend fun getRepo(): JsonArray
} }