diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt index 936f20689..c1f6f0f31 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt @@ -97,6 +97,15 @@ object SettingsAdvancedScreen : SearchableSettings { true }, ), + Preference.PreferenceItem.SwitchPreference( + preference = networkPreferences.redactSensitiveHeaders, + title = stringResource(MR.strings.pref_redact_sensitive_headers), + subtitle = stringResource(MR.strings.pref_redact_sensitive_headers_summary), + onValueChanged = { + context.toast(MR.strings.requires_app_restart) + true + }, + ), Preference.PreferenceItem.TextPreference( title = stringResource(MR.strings.pref_debug_info), onClick = { navigator.push(DebugInfoScreen()) }, diff --git a/core/common/src/main/kotlin/eu/kanade/tachiyomi/network/NetworkHelper.kt b/core/common/src/main/kotlin/eu/kanade/tachiyomi/network/NetworkHelper.kt index e4357f268..212dc155e 100644 --- a/core/common/src/main/kotlin/eu/kanade/tachiyomi/network/NetworkHelper.kt +++ b/core/common/src/main/kotlin/eu/kanade/tachiyomi/network/NetworkHelper.kt @@ -44,6 +44,10 @@ class NetworkHelper( if (preferences.verboseLogging.get()) { val httpLoggingInterceptor = HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.HEADERS + if (preferences.redactSensitiveHeaders.get()) { + redactHeader("Authorization") + redactHeader("Auth") + } } builder.addNetworkInterceptor(httpLoggingInterceptor) } diff --git a/core/common/src/main/kotlin/eu/kanade/tachiyomi/network/NetworkPreferences.kt b/core/common/src/main/kotlin/eu/kanade/tachiyomi/network/NetworkPreferences.kt index 43a195a99..db8faae9c 100644 --- a/core/common/src/main/kotlin/eu/kanade/tachiyomi/network/NetworkPreferences.kt +++ b/core/common/src/main/kotlin/eu/kanade/tachiyomi/network/NetworkPreferences.kt @@ -14,6 +14,11 @@ class NetworkPreferences( @IsDebugBuild isDebugBuild: Boolean, ) { + val redactSensitiveHeaders: Preference = preferenceStore.getBoolean( + "redact_sensitive_headers", + true, + ) + val verboseLogging: Preference = preferenceStore.getBoolean( "verbose_logging", isDebugBuild, diff --git a/i18n/src/commonMain/moko-resources/base/strings.xml b/i18n/src/commonMain/moko-resources/base/strings.xml index 112615b02..7c1380709 100644 --- a/i18n/src/commonMain/moko-resources/base/strings.xml +++ b/i18n/src/commonMain/moko-resources/base/strings.xml @@ -696,6 +696,8 @@ Tablet UI Verbose logging Print verbose logs to system log (reduces app performance) + Redact sensitive headers + Redacts certain sensitive values in the logs. Keep enabled for your security when sharing logs with other people. Debug info Update library manga titles to match source Warning: if a manga is renamed, it will be removed from the download queue (if present).