mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-01 01:44:34 -05:00
Feature/automatic backup flags (#1702)
* Add backup flags to auto backups * Mark ServerConfig properties as deprecated --------- Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
package suwayomi.tachidesk.manga.impl.backup
|
||||
|
||||
import suwayomi.tachidesk.server.serverConfig
|
||||
|
||||
/*
|
||||
* Copyright (C) Contributors to the Suwayomi project
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
interface IBackupFlags {
|
||||
val includeManga: Boolean?
|
||||
val includeCategories: Boolean?
|
||||
val includeChapters: Boolean?
|
||||
val includeTracking: Boolean?
|
||||
val includeHistory: Boolean?
|
||||
val includeClientData: Boolean?
|
||||
val includeServerSettings: Boolean?
|
||||
}
|
||||
|
||||
data class BackupFlags(
|
||||
override val includeManga: Boolean,
|
||||
override val includeCategories: Boolean,
|
||||
override val includeChapters: Boolean,
|
||||
override val includeTracking: Boolean,
|
||||
override val includeHistory: Boolean,
|
||||
override val includeClientData: Boolean,
|
||||
override val includeServerSettings: Boolean,
|
||||
) : IBackupFlags {
|
||||
companion object {
|
||||
val DEFAULT =
|
||||
BackupFlags(
|
||||
includeManga = true,
|
||||
includeCategories = true,
|
||||
includeChapters = true,
|
||||
includeTracking = true,
|
||||
includeHistory = true,
|
||||
includeClientData = true,
|
||||
includeServerSettings = true,
|
||||
)
|
||||
|
||||
fun fromPartial(partialFlags: IBackupFlags?): BackupFlags =
|
||||
BackupFlags(
|
||||
includeManga = partialFlags?.includeManga ?: DEFAULT.includeManga,
|
||||
includeCategories = partialFlags?.includeCategories ?: DEFAULT.includeCategories,
|
||||
includeChapters = partialFlags?.includeChapters ?: DEFAULT.includeChapters,
|
||||
includeTracking = partialFlags?.includeTracking ?: DEFAULT.includeTracking,
|
||||
includeHistory = partialFlags?.includeHistory ?: DEFAULT.includeHistory,
|
||||
includeClientData = partialFlags?.includeClientData ?: DEFAULT.includeClientData,
|
||||
includeServerSettings = partialFlags?.includeServerSettings ?: DEFAULT.includeServerSettings,
|
||||
)
|
||||
|
||||
fun fromServerConfig(): BackupFlags =
|
||||
BackupFlags(
|
||||
includeManga = serverConfig.autoBackupIncludeManga.value,
|
||||
includeCategories = serverConfig.autoBackupIncludeCategories.value,
|
||||
includeChapters = serverConfig.autoBackupIncludeChapters.value,
|
||||
includeTracking = serverConfig.autoBackupIncludeTracking.value,
|
||||
includeHistory = serverConfig.autoBackupIncludeHistory.value,
|
||||
includeClientData = serverConfig.autoBackupIncludeClientData.value,
|
||||
includeServerSettings = serverConfig.autoBackupIncludeServerSettings.value,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import suwayomi.tachidesk.graphql.types.SettingsDownloadConversionType
|
||||
import suwayomi.tachidesk.graphql.types.WebUIChannel
|
||||
import suwayomi.tachidesk.graphql.types.WebUIFlavor
|
||||
import suwayomi.tachidesk.graphql.types.WebUIInterface
|
||||
import suwayomi.tachidesk.manga.impl.backup.BackupFlags
|
||||
import suwayomi.tachidesk.manga.impl.backup.proto.models.BackupSettingsDownloadConversionType
|
||||
import suwayomi.tachidesk.manga.impl.extension.repoMatchRegex
|
||||
import suwayomi.tachidesk.server.settings.BooleanSetting
|
||||
@@ -204,6 +205,7 @@ class ServerConfig(
|
||||
description = "Exclude entries with unread chapters from auto-download",
|
||||
)
|
||||
|
||||
@Deprecated("Will get removed", replaceWith = ReplaceWith("autoDownloadNewChaptersLimit"))
|
||||
val autoDownloadAheadLimit: MutableStateFlow<Int> by MigratedConfigValue(
|
||||
protoNumber = 19,
|
||||
defaultValue = 0,
|
||||
@@ -302,6 +304,7 @@ class ServerConfig(
|
||||
description = "Update manga metadata and thumbnail along with the chapter list update during the library update.",
|
||||
)
|
||||
|
||||
@Deprecated("Will get removed", replaceWith = ReplaceWith("authMode"))
|
||||
val basicAuthEnabled: MutableStateFlow<Boolean> by MigratedConfigValue(
|
||||
protoNumber = 29,
|
||||
defaultValue = false,
|
||||
@@ -348,6 +351,7 @@ class ServerConfig(
|
||||
group = SettingGroup.MISC,
|
||||
)
|
||||
|
||||
@Deprecated("Removed - does not do anything")
|
||||
val gqlDebugLogsEnabled: MutableStateFlow<Boolean> by MigratedConfigValue(
|
||||
protoNumber = 33,
|
||||
defaultValue = false,
|
||||
@@ -790,13 +794,56 @@ class ServerConfig(
|
||||
excludeFromBackup = true,
|
||||
)
|
||||
|
||||
val autoBackupIncludeManga: MutableStateFlow<Boolean> by BooleanSetting(
|
||||
protoNumber = 76,
|
||||
group = SettingGroup.BACKUP,
|
||||
defaultValue = BackupFlags.DEFAULT.includeManga,
|
||||
)
|
||||
|
||||
val autoBackupIncludeCategories: MutableStateFlow<Boolean> by BooleanSetting(
|
||||
protoNumber = 77,
|
||||
group = SettingGroup.BACKUP,
|
||||
defaultValue = BackupFlags.DEFAULT.includeCategories,
|
||||
)
|
||||
|
||||
val autoBackupIncludeChapters: MutableStateFlow<Boolean> by BooleanSetting(
|
||||
protoNumber = 78,
|
||||
group = SettingGroup.BACKUP,
|
||||
defaultValue = BackupFlags.DEFAULT.includeChapters,
|
||||
)
|
||||
|
||||
val autoBackupIncludeTracking: MutableStateFlow<Boolean> by BooleanSetting(
|
||||
protoNumber = 79,
|
||||
group = SettingGroup.BACKUP,
|
||||
defaultValue = BackupFlags.DEFAULT.includeTracking,
|
||||
)
|
||||
|
||||
val autoBackupIncludeHistory: MutableStateFlow<Boolean> by BooleanSetting(
|
||||
protoNumber = 80,
|
||||
group = SettingGroup.BACKUP,
|
||||
defaultValue = BackupFlags.DEFAULT.includeHistory,
|
||||
)
|
||||
|
||||
val autoBackupIncludeClientData: MutableStateFlow<Boolean> by BooleanSetting(
|
||||
protoNumber = 81,
|
||||
group = SettingGroup.BACKUP,
|
||||
defaultValue = BackupFlags.DEFAULT.includeClientData,
|
||||
)
|
||||
|
||||
val autoBackupIncludeServerSettings: MutableStateFlow<Boolean> by BooleanSetting(
|
||||
protoNumber = 82,
|
||||
group = SettingGroup.BACKUP,
|
||||
defaultValue = BackupFlags.DEFAULT.includeServerSettings,
|
||||
)
|
||||
|
||||
|
||||
/** ****************************************************************** **/
|
||||
/** **/
|
||||
/** Renamed settings **/
|
||||
/** **/
|
||||
|
||||
/** ****************************************************************** **/
|
||||
|
||||
@Deprecated("Removed - prefer authUsername", replaceWith = ReplaceWith("authUsername"))
|
||||
val basicAuthUsername: MutableStateFlow<String> by MigratedConfigValue(
|
||||
protoNumber = 99991,
|
||||
defaultValue = "",
|
||||
@@ -811,6 +858,7 @@ class ServerConfig(
|
||||
setMigrated = { authUsername.value = it },
|
||||
)
|
||||
|
||||
@Deprecated("Removed - prefer authPassword", replaceWith = ReplaceWith("authPassword"))
|
||||
val basicAuthPassword: MutableStateFlow<String> by MigratedConfigValue(
|
||||
protoNumber = 99992,
|
||||
defaultValue = "",
|
||||
|
||||
Reference in New Issue
Block a user