|
|
|
|
@ -3,6 +3,7 @@ package org.koitharu.kotatsu.core.image
|
|
|
|
|
import coil3.intercept.Interceptor
|
|
|
|
|
import coil3.network.httpHeaders
|
|
|
|
|
import coil3.request.ImageResult
|
|
|
|
|
import org.koitharu.kotatsu.core.model.unwrap
|
|
|
|
|
import org.koitharu.kotatsu.core.network.CommonHeaders
|
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.mangaSourceKey
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
|
|
|
|
@ -10,7 +11,7 @@ import org.koitharu.kotatsu.parsers.model.MangaParserSource
|
|
|
|
|
class MangaSourceHeaderInterceptor : Interceptor {
|
|
|
|
|
|
|
|
|
|
override suspend fun intercept(chain: Interceptor.Chain): ImageResult {
|
|
|
|
|
val mangaSource = chain.request.extras[mangaSourceKey] as? MangaParserSource ?: return chain.proceed()
|
|
|
|
|
val mangaSource = chain.request.extras[mangaSourceKey]?.unwrap() as? MangaParserSource ?: return chain.proceed()
|
|
|
|
|
val request = chain.request
|
|
|
|
|
val newHeaders = request.httpHeaders.newBuilder()
|
|
|
|
|
.set(CommonHeaders.MANGA_SOURCE, mangaSource.name)
|
|
|
|
|
|