OPDS: Offer CBZ in older mimetype (#1731)

* OPDS: Offer CBZ in older mimetype

* OPDS: Include length when offering CBZ download

* Disable compression on CBZ endpoint

Zipping a zip

* CBZ download match content type of OPDS

* Move compression disable

* Introduce setting for configuring CBZ mimetype

* Document new option

[no-ci]

* Update server/src/main/kotlin/suwayomi/tachidesk/opds/impl/OpdsEntryBuilder.kt

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>

---------

Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
This commit is contained in:
Constantin Piber
2025-10-25 00:36:59 +02:00
committed by GitHub
parent 68492bf591
commit bc6e28cabe
8 changed files with 47 additions and 16 deletions
@@ -0,0 +1,14 @@
package suwayomi.tachidesk.graphql.types
enum class CbzMediaType(
val mediaType: String,
) {
MODERN("application/vnd.comicbook+zip"),
LEGACY("application/x-cbz"),
COMPATIBLE("application/x-cbr"),
;
companion object {
fun from(channel: String): CbzMediaType = entries.find { it.name.lowercase() == channel.lowercase() } ?: MODERN
}
}
@@ -25,6 +25,7 @@ import kotlinx.coroutines.flow.mapLatest
import kotlinx.coroutines.flow.onEach
import org.jetbrains.exposed.sql.SortOrder
import suwayomi.tachidesk.graphql.types.AuthMode
import suwayomi.tachidesk.graphql.types.CbzMediaType
import suwayomi.tachidesk.graphql.types.DatabaseType
import suwayomi.tachidesk.graphql.types.DownloadConversion
import suwayomi.tachidesk.graphql.types.KoreaderSyncChecksumMethod
@@ -836,6 +837,17 @@ class ServerConfig(
defaultValue = BackupFlags.DEFAULT.includeServerSettings,
)
val opdsCbzMimetype: MutableStateFlow<CbzMediaType> by EnumSetting(
protoNumber = 83,
group = SettingGroup.OPDS,
defaultValue = CbzMediaType.MODERN,
enumClass = CbzMediaType::class,
typeInfo = SettingsRegistry.PartialTypeInfo(imports = listOf("suwayomi.tachidesk.graphql.types.CbzMediaType")),
excludeFromBackup = true,
description = "Controls the MimeType that Suwayomi sends in OPDS entries for CBZ archives. Also affects global CBZ download. Modern follows recent IANA standard (2017), while LEGACY (deprecated mimetype for .cbz) and COMPATIBLE (deprecated mimetype for all comic archives) might be more compatible with older clients.",
)
/** ****************************************************************** **/
/** **/