diff --git a/.editorconfig b/.editorconfig index e99fe5d60..afb2723bf 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,7 +5,7 @@ charset = utf-8 end_of_line = lf indent_size = 4 indent_style = tab -insert_final_newline = false +insert_final_newline = true max_line_length = 120 tab_width = 4 # noinspection EditorConfigKeyCorrectness diff --git a/app/src/main/java/org/koitharu/kotatsu/core/network/GZipInterceptor.kt b/app/src/main/java/org/koitharu/kotatsu/core/network/GZipInterceptor.kt new file mode 100644 index 000000000..d923b0cec --- /dev/null +++ b/app/src/main/java/org/koitharu/kotatsu/core/network/GZipInterceptor.kt @@ -0,0 +1,14 @@ +package org.koitharu.kotatsu.core.network + +import okhttp3.Interceptor +import okhttp3.Response +import org.jsoup.helper.HttpConnection.CONTENT_ENCODING + +class GZipInterceptor : Interceptor { + + override fun intercept(chain: Interceptor.Chain): Response { + val newRequest = chain.request().newBuilder() + newRequest.addHeader(CONTENT_ENCODING, "gzip") + return chain.proceed(newRequest.build()) + } +} diff --git a/app/src/main/java/org/koitharu/kotatsu/core/network/NetworkModule.kt b/app/src/main/java/org/koitharu/kotatsu/core/network/NetworkModule.kt index 2af4c215e..1eb6a1021 100644 --- a/app/src/main/java/org/koitharu/kotatsu/core/network/NetworkModule.kt +++ b/app/src/main/java/org/koitharu/kotatsu/core/network/NetworkModule.kt @@ -21,9 +21,10 @@ val networkModule cookieJar(get()) dns(DoHManager(cache, get())) cache(cache) + addInterceptor(GZipInterceptor()) addInterceptor(UserAgentInterceptor()) addInterceptor(CloudFlareInterceptor()) }.build() } single { MangaLoaderContextImpl(get(), get(), get()) } - } \ No newline at end of file + }