Don't allow setting blank user agent string
Cette révision appartient à :
Parent
47b56644de
révision
3760b310df
2 fichiers modifiés avec 16 ajouts et 10 suppressions
|
@ -229,19 +229,24 @@ class SettingsAdvancedController(
|
|||
summary = network.defaultUserAgent
|
||||
|
||||
onChange {
|
||||
activity?.toast(R.string.requires_app_restart)
|
||||
true
|
||||
if (it.toString().isBlank()) {
|
||||
activity?.toast(R.string.error_user_agent_string_blank)
|
||||
false
|
||||
} else {
|
||||
activity?.toast(R.string.requires_app_restart)
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
if (preferences.defaultUserAgent().isSet()) {
|
||||
preference {
|
||||
key = "pref_reset_user_agent"
|
||||
titleRes = R.string.pref_reset_user_agent_string
|
||||
preference {
|
||||
key = "pref_reset_user_agent"
|
||||
titleRes = R.string.pref_reset_user_agent_string
|
||||
|
||||
onClick {
|
||||
preferences.defaultUserAgent().delete()
|
||||
activity?.toast(R.string.requires_app_restart)
|
||||
}
|
||||
visibleIf(preferences.defaultUserAgent()) { it != preferences.defaultUserAgent().defaultValue }
|
||||
|
||||
onClick {
|
||||
preferences.defaultUserAgent().delete()
|
||||
activity?.toast(R.string.requires_app_restart)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -475,6 +475,7 @@
|
|||
<string name="pref_clear_cookies">Clear cookies</string>
|
||||
<string name="pref_dns_over_https">DNS over HTTPS (DoH)</string>
|
||||
<string name="pref_user_agent_string">Default user agent string</string>
|
||||
<string name="error_user_agent_string_blank">User agent string can not be blank</string>
|
||||
<string name="pref_reset_user_agent_string">Reset default user agent string</string>
|
||||
<string name="requires_app_restart">Requires app restart to take effect</string>
|
||||
<string name="cookies_cleared">Cookies cleared</string>
|
||||
|
|
Référencer dans un nouveau ticket