diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt index 9a22457da..21525086e 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt @@ -434,11 +434,21 @@ fun PurgeConfirmationDialog( @Composable private fun getSelfHostPreferences(syncPreferences: SyncPreferences): List { + val scope = rememberCoroutineScope() return listOf( Preference.PreferenceItem.EditTextPreference( title = stringResource(R.string.pref_sync_host), subtitle = stringResource(R.string.pref_sync_host_summ), pref = syncPreferences.syncHost(), + onValueChanged = { newValue -> + scope.launch { + // Trim spaces at the beginning and end, then remove trailing slash if present + val trimmedValue = newValue.trim() + val modifiedValue = trimmedValue.trimEnd { it == '/' } + syncPreferences.syncHost().set(modifiedValue) + } + true + }, ), Preference.PreferenceItem.EditTextPreference( title = stringResource(R.string.pref_sync_api_key),