mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-10 14:24:34 -05:00
* [#1496] First conversion attempt * [#1496] Configurable conversion * Fix: allow nested configs (map) * [#1496] Support explicit `none` conversion * Use MimeUtils for provided download * [1496] Support image conversion on load for downloaded images * Lint * [#1496] Support conversion on fresh download as well Previous commit was only for already downloaded images, now also for fresh and cached * [#1496] Refactor: Move where conversion for download happens * Rewrite config handling, improve custom types * Lint * Add format to pages mutation * Lint * Standardize url encode * Lint * Config: Allow additional conversion parameters * Implement conversion quality parameter * Lint * Implement a conversion util to allow fallback readers * Add downloadConversions to api and backup, fix updateValue issues * Lint * Minor cleanup * Update libs.versions.toml --------- Co-authored-by: Syer10 <syer10@users.noreply.github.com>
This commit is contained in:
@@ -111,6 +111,18 @@ class SettingsMutation {
|
||||
configSetting.value = newSetting
|
||||
}
|
||||
|
||||
private fun <SettingType : Any, RealSettingType : Any> updateSetting(
|
||||
newSetting: RealSettingType?,
|
||||
configSetting: MutableStateFlow<SettingType>,
|
||||
mapper: (RealSettingType) -> SettingType,
|
||||
) {
|
||||
if (newSetting == null) {
|
||||
return
|
||||
}
|
||||
|
||||
configSetting.value = mapper(newSetting)
|
||||
}
|
||||
|
||||
@GraphQLIgnore
|
||||
fun updateSettings(settings: Settings) {
|
||||
updateSetting(settings.ip, serverConfig.ip)
|
||||
@@ -140,6 +152,15 @@ class SettingsMutation {
|
||||
updateSetting(settings.autoDownloadAheadLimit, serverConfig.autoDownloadNewChaptersLimit) // deprecated
|
||||
updateSetting(settings.autoDownloadNewChaptersLimit, serverConfig.autoDownloadNewChaptersLimit)
|
||||
updateSetting(settings.autoDownloadIgnoreReUploads, serverConfig.autoDownloadIgnoreReUploads)
|
||||
updateSetting(settings.downloadConversions, serverConfig.downloadConversions) { list ->
|
||||
list.associate {
|
||||
it.mimeType to
|
||||
ServerConfig.DownloadConversion(
|
||||
target = it.target,
|
||||
compressionLevel = it.compressionLevel,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// extension
|
||||
updateSetting(settings.extensionRepos, serverConfig.extensionRepos)
|
||||
@@ -218,7 +239,12 @@ class SettingsMutation {
|
||||
val (clientMutationId) = input
|
||||
|
||||
GlobalConfigManager.resetUserConfig()
|
||||
val defaultServerConfig = ServerConfig({ GlobalConfigManager.config.getConfig(SERVER_CONFIG_MODULE_NAME) })
|
||||
val defaultServerConfig =
|
||||
ServerConfig {
|
||||
GlobalConfigManager.config.getConfig(
|
||||
SERVER_CONFIG_MODULE_NAME,
|
||||
)
|
||||
}
|
||||
|
||||
val settings = SettingsType(defaultServerConfig)
|
||||
updateSettings(settings)
|
||||
|
||||
Reference in New Issue
Block a user