diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt index 68ed1c1a1..3b318803f 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt @@ -169,8 +169,8 @@ object CFClearance { FlareSolverRequest( "request.get", originalRequest.url.toString(), - session = "suwayomi", - sessionTtlMinutes = 15, + session = serverConfig.flareSolverrSessionName.value, + sessionTtlMinutes = serverConfig.flareSolverrSessionTtl.value, cookies = network.cookieStore.get(originalRequest.url).map { FlareSolverCookie(it.name, it.value) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/SettingsMutation.kt b/server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/SettingsMutation.kt index 3e495dc17..805f6b322 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/SettingsMutation.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/graphql/mutations/SettingsMutation.kt @@ -91,6 +91,8 @@ class SettingsMutation { updateSetting(settings.flareSolverrEnabled, serverConfig.flareSolverrEnabled) updateSetting(settings.flareSolverrUrl, serverConfig.flareSolverrUrl) updateSetting(settings.flareSolverrTimeout, serverConfig.flareSolverrTimeout) + updateSetting(settings.flareSolverrSessionName, serverConfig.flareSolverrSessionName) + updateSetting(settings.flareSolverrSessionTtl, serverConfig.flareSolverrSessionTtl) } fun setSettings(input: SetSettingsInput): SetSettingsPayload { diff --git a/server/src/main/kotlin/suwayomi/tachidesk/graphql/types/SettingsType.kt b/server/src/main/kotlin/suwayomi/tachidesk/graphql/types/SettingsType.kt index 46b8e9659..684b8c6b3 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/graphql/types/SettingsType.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/graphql/types/SettingsType.kt @@ -76,6 +76,8 @@ interface Settings : Node { val flareSolverrEnabled: Boolean? val flareSolverrUrl: String? val flareSolverrTimeout: Int? + val flareSolverrSessionName: String? + val flareSolverrSessionTtl: Int? } data class PartialSettingsType( @@ -127,6 +129,8 @@ data class PartialSettingsType( override val flareSolverrEnabled: Boolean?, override val flareSolverrUrl: String?, override val flareSolverrTimeout: Int?, + override val flareSolverrSessionName: String?, + override val flareSolverrSessionTtl: Int?, ) : Settings class SettingsType( @@ -178,6 +182,8 @@ class SettingsType( override val flareSolverrEnabled: Boolean, override val flareSolverrUrl: String, override val flareSolverrTimeout: Int, + override val flareSolverrSessionName: String, + override val flareSolverrSessionTtl: Int, ) : Settings { constructor(config: ServerConfig = serverConfig) : this( config.ip.value, @@ -228,5 +234,7 @@ class SettingsType( config.flareSolverrEnabled.value, config.flareSolverrUrl.value, config.flareSolverrTimeout.value, + config.flareSolverrSessionName.value, + config.flareSolverrSessionTtl.value, ) } diff --git a/server/src/main/kotlin/suwayomi/tachidesk/server/ServerConfig.kt b/server/src/main/kotlin/suwayomi/tachidesk/server/ServerConfig.kt index ac63ebc87..7763298a0 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/server/ServerConfig.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/server/ServerConfig.kt @@ -135,6 +135,8 @@ class ServerConfig(getConfig: () -> Config, val moduleName: String = SERVER_CONF val flareSolverrEnabled: MutableStateFlow by OverrideConfigValue(BooleanConfigAdapter) val flareSolverrUrl: MutableStateFlow by OverrideConfigValue(StringConfigAdapter) val flareSolverrTimeout: MutableStateFlow by OverrideConfigValue(IntConfigAdapter) + val flareSolverrSessionName: MutableStateFlow by OverrideConfigValue(StringConfigAdapter) + val flareSolverrSessionTtl: MutableStateFlow by OverrideConfigValue(IntConfigAdapter) @OptIn(ExperimentalCoroutinesApi::class) fun subscribeTo( diff --git a/server/src/main/resources/server-reference.conf b/server/src/main/resources/server-reference.conf index 0588defe1..85392daba 100644 --- a/server/src/main/resources/server-reference.conf +++ b/server/src/main/resources/server-reference.conf @@ -60,4 +60,6 @@ server.localSourcePath = "" # Cloudflare bypass server.flareSolverrEnabled = false server.flareSolverrUrl = "http://localhost:8191" -server.flareSolverrTimeout = 60 # time in seconds \ No newline at end of file +server.flareSolverrTimeout = 60 # time in seconds +server.flareSolverrSessionName = "suwayomi" +server.flareSolverrSessionTtl = 15 # time in minutes