Remove referrer field

This commit is contained in:
Koitharu
2023-03-25 08:56:41 +02:00
parent 98453c34a7
commit 48ac417189
6 changed files with 3 additions and 13 deletions

View File

@@ -52,7 +52,6 @@ fun Parcel.readManga() = Manga(
fun MangaPage.writeToParcel(out: Parcel) {
out.writeLong(id)
out.writeString(url)
out.writeString(referer)
out.writeString(preview)
out.writeSerializable(source)
}
@@ -60,7 +59,6 @@ fun MangaPage.writeToParcel(out: Parcel) {
fun Parcel.readMangaPage() = MangaPage(
id = readLong(),
url = requireNotNull(readString()),
referer = requireNotNull(readString()),
preview = readString(),
source = checkNotNull(readSerializableCompat()),
)

View File

@@ -117,7 +117,7 @@ class DownloadManager @AssistedInject constructor(
val data = if (manga.chapters.isNullOrEmpty()) repo.getDetails(manga) else manga
output = CbzMangaOutput.get(destination, data)
val coverUrl = data.largeCoverUrl ?: data.coverUrl
downloadFile(coverUrl, data.publicUrl, destination, tempFileName, repo.source).let { file ->
downloadFile(coverUrl, destination, tempFileName, repo.source).let { file ->
output.addCover(file, MimeTypeMap.getFileExtensionFromUrl(coverUrl))
}
val chapters = checkNotNull(
@@ -139,7 +139,7 @@ class DownloadManager @AssistedInject constructor(
runFailsafe(outState, pausingHandle) {
val url = repo.getPageUrl(page)
val file = cache.get(url)
?: downloadFile(url, page.referer, destination, tempFileName, repo.source)
?: downloadFile(url, destination, tempFileName, repo.source)
output.addPage(
chapter = chapter,
file = file,
@@ -211,14 +211,12 @@ class DownloadManager @AssistedInject constructor(
private suspend fun downloadFile(
url: String,
referer: String,
destination: File,
tempFileName: String,
source: MangaSource,
): File {
val request = Request.Builder()
.url(url)
.header(CommonHeaders.REFERER, referer)
.tag(MangaSource::class.java, source)
.cacheControl(CommonHeaders.CACHE_CONTROL_DISABLED)
.get()

View File

@@ -118,7 +118,6 @@ class LocalMangaRepository @Inject constructor(private val storageManager: Local
id = entryUri.longHashCode(),
url = entryUri,
preview = null,
referer = chapter.url,
source = MangaSource.LOCAL,
)
}

View File

@@ -185,7 +185,6 @@ class PageLoader @Inject constructor(
val request = Request.Builder()
.url(pageUrl)
.get()
.header(CommonHeaders.REFERER, page.referer)
.header(CommonHeaders.ACCEPT, "image/webp,image/png;q=0.9,image/jpeg,*/*;q=0.8")
.cacheControl(CommonHeaders.CACHE_CONTROL_DISABLED)
.tag(MangaSource::class.java, page.source)

View File

@@ -38,7 +38,6 @@ class ColorFilterConfigViewModel @AssistedInject constructor(
preview.value = MangaPage(
id = page.id,
url = url,
referer = page.referer,
preview = page.preview,
source = page.source,
)

View File

@@ -9,7 +9,6 @@ import org.koitharu.kotatsu.parsers.model.MangaSource
data class ReaderPage(
val id: Long,
val url: String,
val referer: String,
val preview: String?,
val chapterId: Long,
val index: Int,
@@ -19,7 +18,6 @@ data class ReaderPage(
constructor(page: MangaPage, index: Int, chapterId: Long) : this(
id = page.id,
url = page.url,
referer = page.referer,
preview = page.preview,
chapterId = chapterId,
index = index,
@@ -29,8 +27,7 @@ data class ReaderPage(
fun toMangaPage() = MangaPage(
id = id,
url = url,
referer = referer,
preview = preview,
source = source,
)
}
}