Fix/server config duplicated types (#1672)

* Move "serverConfig" to "server-config" module

* Remove duplicated types

Unintentionally introduced with 8ef2877040
This commit is contained in:
schroda
2025-09-29 17:24:26 +02:00
committed by GitHub
parent 5c79672d84
commit 9062252939
8 changed files with 34 additions and 93 deletions

View File

@@ -1,5 +1,7 @@
package suwayomi.tachidesk.graphql.types
import suwayomi.tachidesk.server.serverConfig
enum class WebUIInterface {
BROWSER,
ELECTRON,
@@ -30,17 +32,30 @@ enum class WebUIFlavor(
"https://api.github.com/repos/Suwayomi/Suwayomi-WebUI-preview/releases/latest",
"Suwayomi-WebUI",
),
VUI(
"VUI",
"https://github.com/Suwayomi/Suwayomi-VUI",
"https://raw.githubusercontent.com/Suwayomi/Suwayomi-VUI/master/versionToServerVersionMapping.json",
"https://raw.githubusercontent.com/Suwayomi/Suwayomi-VUI/main/versionToServerVersionMapping.json",
"https://api.github.com/repos/Suwayomi/Suwayomi-VUI/releases/latest",
"Suwayomi-VUI",
"Suwayomi-VUI-Web",
),
CUSTOM(
"Custom",
"repoURL",
"versionMappingUrl",
"latestReleaseInfoURL",
"baseFileName",
),
CUSTOM("Custom", "", "", "", ""),
;
companion object {
fun from(flavor: String): WebUIFlavor = entries.find { it.name.lowercase() == flavor.lowercase() } ?: WEBUI
val default: WebUIFlavor = WEBUI
fun from(value: String): WebUIFlavor = entries.find { it.uiName == value } ?: default
val current: WebUIFlavor
get() = serverConfig.webUIFlavor.value
}
}

View File

@@ -1,9 +1,7 @@
package suwayomi.tachidesk.manga.impl.extension
object ExtensionsList {
val repoMatchRegex =
(
"https:\\/\\/(?>www\\.|raw\\.)?(github|githubusercontent)\\.com" +
"\\/([^\\/]+)\\/([^\\/]+)(?>(?>\\/tree|\\/blob)?\\/([^\\/\\n]*))?(?>\\/([^\\/\\n]*\\.json)?)?"
).toRegex()
}
val repoMatchRegex =
(
"https:\\/\\/(?>www\\.|raw\\.)?(github|githubusercontent)\\.com" +
"\\/([^\\/]+)\\/([^\\/]+)(?>(?>\\/tree|\\/blob)?\\/([^\\/\\n]*))?(?>\\/([^\\/\\n]*\\.json)?)?"
).toRegex()

View File

@@ -35,7 +35,7 @@ import suwayomi.tachidesk.graphql.types.WebUIChannel
import suwayomi.tachidesk.graphql.types.WebUIFlavor
import suwayomi.tachidesk.graphql.types.WebUIInterface
import suwayomi.tachidesk.manga.impl.backup.proto.models.BackupSettingsDownloadConversionType
import suwayomi.tachidesk.manga.impl.extension.ExtensionsList.repoMatchRegex
import suwayomi.tachidesk.manga.impl.extension.repoMatchRegex
import suwayomi.tachidesk.server.settings.BooleanSetting
import suwayomi.tachidesk.server.settings.DisableableDoubleSetting
import suwayomi.tachidesk.server.settings.DisableableIntSetting
@@ -50,6 +50,7 @@ import suwayomi.tachidesk.server.settings.PathSetting
import suwayomi.tachidesk.server.settings.SettingGroup
import suwayomi.tachidesk.server.settings.SettingsRegistry
import suwayomi.tachidesk.server.settings.StringSetting
import xyz.nulldev.ts.config.GlobalConfigManager
import xyz.nulldev.ts.config.SystemPropertyOverridableConfigModule
import kotlin.collections.associate
import kotlin.time.Duration
@@ -62,6 +63,8 @@ val mutableConfigValueScope = CoroutineScope(SupervisorJob() + Dispatchers.Defau
const val SERVER_CONFIG_MODULE_NAME = "server"
val serverConfig: ServerConfig by lazy { GlobalConfigManager.module() }
// Settings are ordered by "protoNumber".
class ServerConfig(
getConfig: () -> Config,