mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-03 10:54:38 -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:
@@ -1,6 +1,6 @@
|
|||||||
package suwayomi.tachidesk.manga.impl.backup
|
package suwayomi.tachidesk.manga.impl.backup
|
||||||
|
|
||||||
import suwayomi.tachidesk.manga.impl.backup.proto.models.Backup
|
import suwayomi.tachidesk.server.serverConfig
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) Contributors to the Suwayomi project
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
@@ -50,5 +50,16 @@ data class BackupFlags(
|
|||||||
includeClientData = partialFlags?.includeClientData ?: DEFAULT.includeClientData,
|
includeClientData = partialFlags?.includeClientData ?: DEFAULT.includeClientData,
|
||||||
includeServerSettings = partialFlags?.includeServerSettings ?: DEFAULT.includeServerSettings,
|
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.WebUIChannel
|
||||||
import suwayomi.tachidesk.graphql.types.WebUIFlavor
|
import suwayomi.tachidesk.graphql.types.WebUIFlavor
|
||||||
import suwayomi.tachidesk.graphql.types.WebUIInterface
|
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.backup.proto.models.BackupSettingsDownloadConversionType
|
||||||
import suwayomi.tachidesk.manga.impl.extension.repoMatchRegex
|
import suwayomi.tachidesk.manga.impl.extension.repoMatchRegex
|
||||||
import suwayomi.tachidesk.server.settings.BooleanSetting
|
import suwayomi.tachidesk.server.settings.BooleanSetting
|
||||||
@@ -204,6 +205,7 @@ class ServerConfig(
|
|||||||
description = "Exclude entries with unread chapters from auto-download",
|
description = "Exclude entries with unread chapters from auto-download",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Deprecated("Will get removed", replaceWith = ReplaceWith("autoDownloadNewChaptersLimit"))
|
||||||
val autoDownloadAheadLimit: MutableStateFlow<Int> by MigratedConfigValue(
|
val autoDownloadAheadLimit: MutableStateFlow<Int> by MigratedConfigValue(
|
||||||
protoNumber = 19,
|
protoNumber = 19,
|
||||||
defaultValue = 0,
|
defaultValue = 0,
|
||||||
@@ -302,6 +304,7 @@ class ServerConfig(
|
|||||||
description = "Update manga metadata and thumbnail along with the chapter list update during the library update.",
|
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(
|
val basicAuthEnabled: MutableStateFlow<Boolean> by MigratedConfigValue(
|
||||||
protoNumber = 29,
|
protoNumber = 29,
|
||||||
defaultValue = false,
|
defaultValue = false,
|
||||||
@@ -348,6 +351,7 @@ class ServerConfig(
|
|||||||
group = SettingGroup.MISC,
|
group = SettingGroup.MISC,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Deprecated("Removed - does not do anything")
|
||||||
val gqlDebugLogsEnabled: MutableStateFlow<Boolean> by MigratedConfigValue(
|
val gqlDebugLogsEnabled: MutableStateFlow<Boolean> by MigratedConfigValue(
|
||||||
protoNumber = 33,
|
protoNumber = 33,
|
||||||
defaultValue = false,
|
defaultValue = false,
|
||||||
@@ -790,13 +794,56 @@ class ServerConfig(
|
|||||||
excludeFromBackup = true,
|
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 **/
|
/** Renamed settings **/
|
||||||
/** **/
|
/** **/
|
||||||
|
|
||||||
/** ****************************************************************** **/
|
/** ****************************************************************** **/
|
||||||
|
|
||||||
|
@Deprecated("Removed - prefer authUsername", replaceWith = ReplaceWith("authUsername"))
|
||||||
val basicAuthUsername: MutableStateFlow<String> by MigratedConfigValue(
|
val basicAuthUsername: MutableStateFlow<String> by MigratedConfigValue(
|
||||||
protoNumber = 99991,
|
protoNumber = 99991,
|
||||||
defaultValue = "",
|
defaultValue = "",
|
||||||
@@ -811,6 +858,7 @@ class ServerConfig(
|
|||||||
setMigrated = { authUsername.value = it },
|
setMigrated = { authUsername.value = it },
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Deprecated("Removed - prefer authPassword", replaceWith = ReplaceWith("authPassword"))
|
||||||
val basicAuthPassword: MutableStateFlow<String> by MigratedConfigValue(
|
val basicAuthPassword: MutableStateFlow<String> by MigratedConfigValue(
|
||||||
protoNumber = 99992,
|
protoNumber = 99992,
|
||||||
defaultValue = "",
|
defaultValue = "",
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ object ProtoBackupExport : ProtoBackupBase() {
|
|||||||
private fun createAutomatedBackup() {
|
private fun createAutomatedBackup() {
|
||||||
logger.info { "Creating automated backup..." }
|
logger.info { "Creating automated backup..." }
|
||||||
|
|
||||||
createBackup(BackupFlags.DEFAULT).use { input ->
|
createBackup(BackupFlags.fromServerConfig()).use { input ->
|
||||||
val automatedBackupDir = File(applicationDirs.automatedBackupRoot)
|
val automatedBackupDir = File(applicationDirs.automatedBackupRoot)
|
||||||
automatedBackupDir.mkdirs()
|
automatedBackupDir.mkdirs()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user