mirror of https://github.com/Corewala/Buran
Removed broken PREF_KEY_CLIENT_CERT_ACTIVE value
This commit is contained in:
parent
b954e94d3b
commit
5210d8484e
|
@ -10,7 +10,6 @@ class Buran: Application() {
|
|||
|
||||
const val PREF_KEY_CLIENT_CERT_URI = "client_cert_uri"
|
||||
const val PREF_KEY_CLIENT_CERT_HUMAN_READABLE = "client_cert_uri_human_readable"
|
||||
const val PREF_KEY_CLIENT_CERT_ACTIVE = "client_cert_active"
|
||||
const val PREF_KEY_CLIENT_CERT_PASSWORD = "client_cert_password"
|
||||
const val CLIENT_CERT_PASSWORD_SECRET_KEY_NAME = "client_cert_secret_key_name"
|
||||
const val PREF_KEY_USE_CUSTOM_TAB = "use_custom_tabs"
|
||||
|
|
|
@ -2,10 +2,8 @@ package corewala.buran.io.gemini
|
|||
|
||||
import android.content.Context
|
||||
import androidx.core.net.toUri
|
||||
import androidx.preference.PreferenceManager
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import corewala.buran.Buran
|
||||
import corewala.buran.OppenURI
|
||||
import corewala.buran.io.GemState
|
||||
import corewala.buran.io.database.history.BuranHistory
|
||||
|
@ -21,7 +19,6 @@ import javax.net.ssl.*
|
|||
|
||||
class GeminiDatasource(private val context: Context, val history: BuranHistory): Datasource {
|
||||
|
||||
private val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
private val runtimeHistory = mutableListOf<URI>()
|
||||
private var forceDownload = false
|
||||
|
||||
|
@ -59,13 +56,10 @@ class GeminiDatasource(private val context: Context, val history: BuranHistory):
|
|||
|
||||
private fun geminiRequest(uri: URI, onUpdate: (state: GemState) -> Unit, clientCertPassword: String?){
|
||||
val protocol = "TLS"
|
||||
val useClientCert = prefs.getBoolean(Buran.PREF_KEY_CLIENT_CERT_ACTIVE, false)
|
||||
|
||||
//Update factory if operating mode has changed
|
||||
when {
|
||||
socketFactory == null -> initSSLFactory(protocol!!, clientCertPassword)
|
||||
useClientCert && !buranKeyManager.lastCallUsedKey -> initSSLFactory(protocol!!, clientCertPassword)
|
||||
!useClientCert && buranKeyManager.lastCallUsedKey -> initSSLFactory(protocol!!, clientCertPassword)
|
||||
when (socketFactory) {
|
||||
null -> initSSLFactory(protocol!!, clientCertPassword)
|
||||
}
|
||||
|
||||
val socket: SSLSocket?
|
||||
|
|
|
@ -337,10 +337,10 @@ class GemActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
when {
|
||||
prefs.getBoolean(
|
||||
Buran.PREF_KEY_CLIENT_CERT_ACTIVE,
|
||||
false
|
||||
) -> {
|
||||
!prefs.getString(
|
||||
Buran.PREF_KEY_CLIENT_CERT_URI,
|
||||
null
|
||||
).isNullOrEmpty() -> {
|
||||
binding.addressEdit.setCompoundDrawablesWithIntrinsicBounds(
|
||||
R.drawable.vector_client_cert,
|
||||
0,
|
||||
|
@ -414,7 +414,7 @@ class GemActivity : AppCompatActivity() {
|
|||
.setTitle(getString(R.string.client_certificate_required))
|
||||
.setMessage(state.header.meta)
|
||||
|
||||
if(prefs.getBoolean(Buran.PREF_KEY_CLIENT_CERT_ACTIVE, false)){
|
||||
if(!prefs.getString(Buran.PREF_KEY_CLIENT_CERT_URI, null).isNullOrEmpty()){
|
||||
builder
|
||||
.setPositiveButton(getString(R.string.use_client_certificate).toUpperCase()) { _, _ ->
|
||||
if(prefs.getBoolean("use_biometrics", false) and !decryptedCertPassword.isNullOrEmpty()){
|
||||
|
|
Loading…
Reference in New Issue