mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 11:24:35 -05:00
Feature/backup suwayomi data (#1430)
* Export meta data * Import meta data * Add missing "opdsUseBinaryFileSize" setting to gql * Export server settings * Import server settings * Streamline server config enum handling * Use "restore amount" in backup import progress
This commit is contained in:
@@ -64,6 +64,8 @@ class BackupMutation {
|
||||
includeChapters = input?.includeChapters ?: true,
|
||||
includeTracking = true,
|
||||
includeHistory = true,
|
||||
includeClientData = true,
|
||||
includeServerSettings = true,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package suwayomi.tachidesk.graphql.mutations
|
||||
|
||||
import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import suwayomi.tachidesk.graphql.types.PartialSettingsType
|
||||
import suwayomi.tachidesk.graphql.types.Settings
|
||||
@@ -110,7 +111,8 @@ class SettingsMutation {
|
||||
configSetting.value = newSetting
|
||||
}
|
||||
|
||||
private fun updateSettings(settings: Settings) {
|
||||
@GraphQLIgnore
|
||||
fun updateSettings(settings: Settings) {
|
||||
updateSetting(settings.ip, serverConfig.ip)
|
||||
updateSetting(settings.port, serverConfig.port)
|
||||
|
||||
@@ -123,11 +125,11 @@ class SettingsMutation {
|
||||
updateSetting(settings.socksProxyPassword, serverConfig.socksProxyPassword)
|
||||
|
||||
// webUI
|
||||
updateSetting(settings.webUIFlavor?.uiName, serverConfig.webUIFlavor)
|
||||
updateSetting(settings.webUIFlavor, serverConfig.webUIFlavor)
|
||||
updateSetting(settings.initialOpenInBrowserEnabled, serverConfig.initialOpenInBrowserEnabled)
|
||||
updateSetting(settings.webUIInterface?.name?.lowercase(), serverConfig.webUIInterface)
|
||||
updateSetting(settings.webUIInterface, serverConfig.webUIInterface)
|
||||
updateSetting(settings.electronPath, serverConfig.electronPath)
|
||||
updateSetting(settings.webUIChannel?.name?.lowercase(), serverConfig.webUIChannel)
|
||||
updateSetting(settings.webUIChannel, serverConfig.webUIChannel)
|
||||
updateSetting(settings.webUIUpdateCheckInterval, serverConfig.webUIUpdateCheckInterval)
|
||||
|
||||
// downloader
|
||||
@@ -182,6 +184,7 @@ class SettingsMutation {
|
||||
updateSetting(settings.flareSolverrAsResponseFallback, serverConfig.flareSolverrAsResponseFallback)
|
||||
|
||||
// opds
|
||||
updateSetting(settings.opdsUseBinaryFileSizes, serverConfig.opdsUseBinaryFileSizes)
|
||||
updateSetting(settings.opdsItemsPerPage, serverConfig.opdsItemsPerPage)
|
||||
updateSetting(settings.opdsEnablePageReadProgress, serverConfig.opdsEnablePageReadProgress)
|
||||
updateSetting(settings.opdsMarkAsReadOnDownload, serverConfig.opdsMarkAsReadOnDownload)
|
||||
|
||||
@@ -3,7 +3,6 @@ package suwayomi.tachidesk.graphql.queries
|
||||
import com.expediagroup.graphql.generator.annotations.GraphQLDeprecated
|
||||
import suwayomi.tachidesk.global.impl.AppUpdate
|
||||
import suwayomi.tachidesk.graphql.types.AboutWebUI
|
||||
import suwayomi.tachidesk.graphql.types.WebUIChannel
|
||||
import suwayomi.tachidesk.graphql.types.WebUIFlavor
|
||||
import suwayomi.tachidesk.graphql.types.WebUIUpdateCheck
|
||||
import suwayomi.tachidesk.graphql.types.WebUIUpdateStatus
|
||||
@@ -63,7 +62,7 @@ class InfoQuery {
|
||||
future {
|
||||
val (version, updateAvailable) = WebInterfaceManager.isUpdateAvailable(WebUIFlavor.current, raiseError = true)
|
||||
WebUIUpdateCheck(
|
||||
channel = WebUIChannel.from(serverConfig.webUIChannel.value),
|
||||
channel = serverConfig.webUIChannel.value,
|
||||
tag = version,
|
||||
updateAvailable,
|
||||
)
|
||||
|
||||
@@ -8,6 +8,8 @@ enum class BackupRestoreState {
|
||||
FAILURE,
|
||||
RESTORING_CATEGORIES,
|
||||
RESTORING_MANGA,
|
||||
RESTORING_META,
|
||||
RESTORING_SETTINGS,
|
||||
}
|
||||
|
||||
data class BackupRestoreStatus(
|
||||
@@ -40,7 +42,19 @@ fun ProtoBackupImport.BackupRestoreState.toStatus(): BackupRestoreStatus =
|
||||
BackupRestoreStatus(
|
||||
state = BackupRestoreState.RESTORING_CATEGORIES,
|
||||
totalManga = totalManga,
|
||||
mangaProgress = 0,
|
||||
mangaProgress = current,
|
||||
)
|
||||
is ProtoBackupImport.BackupRestoreState.RestoringMeta ->
|
||||
BackupRestoreStatus(
|
||||
state = BackupRestoreState.RESTORING_META,
|
||||
totalManga = totalManga,
|
||||
mangaProgress = current,
|
||||
)
|
||||
is ProtoBackupImport.BackupRestoreState.RestoringSettings ->
|
||||
BackupRestoreStatus(
|
||||
state = BackupRestoreState.RESTORING_SETTINGS,
|
||||
totalManga = totalManga,
|
||||
mangaProgress = current,
|
||||
)
|
||||
is ProtoBackupImport.BackupRestoreState.RestoringManga ->
|
||||
BackupRestoreStatus(
|
||||
|
||||
@@ -95,6 +95,7 @@ interface Settings : Node {
|
||||
val flareSolverrAsResponseFallback: Boolean?
|
||||
|
||||
// opds
|
||||
val opdsUseBinaryFileSizes: Boolean?
|
||||
val opdsItemsPerPage: Int?
|
||||
val opdsEnablePageReadProgress: Boolean?
|
||||
val opdsMarkAsReadOnDownload: Boolean?
|
||||
@@ -169,6 +170,7 @@ data class PartialSettingsType(
|
||||
override val flareSolverrSessionTtl: Int?,
|
||||
override val flareSolverrAsResponseFallback: Boolean?,
|
||||
// opds
|
||||
override val opdsUseBinaryFileSizes: Boolean?,
|
||||
override val opdsItemsPerPage: Int?,
|
||||
override val opdsEnablePageReadProgress: Boolean?,
|
||||
override val opdsMarkAsReadOnDownload: Boolean?,
|
||||
@@ -243,6 +245,7 @@ class SettingsType(
|
||||
override val flareSolverrSessionTtl: Int,
|
||||
override val flareSolverrAsResponseFallback: Boolean,
|
||||
// opds
|
||||
override val opdsUseBinaryFileSizes: Boolean,
|
||||
override val opdsItemsPerPage: Int,
|
||||
override val opdsEnablePageReadProgress: Boolean,
|
||||
override val opdsMarkAsReadOnDownload: Boolean,
|
||||
@@ -261,11 +264,11 @@ class SettingsType(
|
||||
config.socksProxyUsername.value,
|
||||
config.socksProxyPassword.value,
|
||||
// webUI
|
||||
WebUIFlavor.from(config.webUIFlavor.value),
|
||||
config.webUIFlavor.value,
|
||||
config.initialOpenInBrowserEnabled.value,
|
||||
WebUIInterface.from(config.webUIInterface.value),
|
||||
config.webUIInterface.value,
|
||||
config.electronPath.value,
|
||||
WebUIChannel.from(config.webUIChannel.value),
|
||||
config.webUIChannel.value,
|
||||
config.webUIUpdateCheckInterval.value,
|
||||
// downloader
|
||||
config.downloadAsCbz.value,
|
||||
@@ -311,6 +314,7 @@ class SettingsType(
|
||||
config.flareSolverrSessionTtl.value,
|
||||
config.flareSolverrAsResponseFallback.value,
|
||||
// opds
|
||||
config.opdsUseBinaryFileSizes.value,
|
||||
config.opdsItemsPerPage.value,
|
||||
config.opdsEnablePageReadProgress.value,
|
||||
config.opdsMarkAsReadOnDownload.value,
|
||||
|
||||
@@ -34,11 +34,6 @@ data class WebUIUpdateStatus(
|
||||
enum class WebUIInterface {
|
||||
BROWSER,
|
||||
ELECTRON,
|
||||
;
|
||||
|
||||
companion object {
|
||||
fun from(value: String): WebUIInterface = entries.find { it.name.lowercase() == value.lowercase() } ?: BROWSER
|
||||
}
|
||||
}
|
||||
|
||||
enum class WebUIChannel {
|
||||
@@ -49,8 +44,6 @@ enum class WebUIChannel {
|
||||
|
||||
companion object {
|
||||
fun from(channel: String): WebUIChannel = entries.find { it.name.lowercase() == channel.lowercase() } ?: STABLE
|
||||
|
||||
fun doesConfigChannelEqual(channel: WebUIChannel): Boolean = serverConfig.webUIChannel.value.equals(channel.name, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +85,6 @@ enum class WebUIFlavor(
|
||||
fun from(value: String): WebUIFlavor = entries.find { it.uiName == value } ?: default
|
||||
|
||||
val current: WebUIFlavor
|
||||
get() = from(serverConfig.webUIFlavor.value)
|
||||
get() = serverConfig.webUIFlavor.value
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user