mirror of
https://github.com/Corewala/Buran
synced 2025-01-03 05:34:28 +00:00
Removed mystery error fix
The fix would've broken legitimate response errors if opened with intents. Also for some reason the bug isn't happening on any of my devices anymore, even though I still have v1.8 installed on my phone. Very mysterious.
This commit is contained in:
parent
30dcb45661
commit
8bb8c4f8f1
3 changed files with 8 additions and 10 deletions
|
@ -15,7 +15,7 @@ sealed class GemState {
|
|||
data class ResponseImage(val uri: URI, val header: GeminiResponse.Header, val cacheUri: Uri) : GemState()
|
||||
data class ResponseBinary(val uri: URI, val header: GeminiResponse.Header, val cacheUri: Uri) : GemState()
|
||||
data class ResponseUnknownMime(val uri: URI, val header: GeminiResponse.Header) : GemState()
|
||||
data class ResponseError(val uri: URI, val header: GeminiResponse.Header): GemState()
|
||||
data class ResponseError(val header: GeminiResponse.Header): GemState()
|
||||
data class ResponseUnknownHost(val uri: URI): GemState()
|
||||
data class ClientCertRequired(val uri: URI, val header: GeminiResponse.Header): GemState()
|
||||
data class ClientCertError(val header: GeminiResponse.Header): GemState()
|
||||
|
|
|
@ -71,11 +71,11 @@ class GeminiDatasource(private val context: Context, val history: BuranHistory):
|
|||
return
|
||||
}catch (ce: ConnectException){
|
||||
println("Buran socket error, connect exception: $ce")
|
||||
onUpdate(GemState.ResponseError(uri, GeminiResponse.Header(-1, ce.message ?: ce.toString())))
|
||||
onUpdate(GemState.ResponseError(GeminiResponse.Header(-1, ce.message ?: ce.toString())))
|
||||
return
|
||||
}catch (she: SSLHandshakeException){
|
||||
println("Buran socket error, ssl handshake exception: $she")
|
||||
onUpdate(GemState.ResponseError(uri, GeminiResponse.Header(-2, she.message ?: she.toString())))
|
||||
onUpdate(GemState.ResponseError(GeminiResponse.Header(-2, she.message ?: she.toString())))
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ class GeminiDatasource(private val context: Context, val history: BuranHistory):
|
|||
outWriter.flush()
|
||||
|
||||
if (outWriter.checkError()) {
|
||||
onUpdate(GemState.ResponseError(uri, GeminiResponse.Header(-1, "Print Writer Error")))
|
||||
onUpdate(GemState.ResponseError(GeminiResponse.Header(-1, "Print Writer Error")))
|
||||
outWriter.close()
|
||||
return
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ class GeminiDatasource(private val context: Context, val history: BuranHistory):
|
|||
println("Buran: response header: $headerLine")
|
||||
|
||||
if(headerLine == null){
|
||||
onUpdate(GemState.ResponseError(uri, GeminiResponse.Header(-2, "Server did not respond with a Gemini header: $uri")))
|
||||
onUpdate(GemState.ResponseError(GeminiResponse.Header(-2, "Server did not respond with a Gemini header: $uri")))
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ class GeminiDatasource(private val context: Context, val history: BuranHistory):
|
|||
header.code == GeminiResponse.INPUT -> onUpdate(GemState.ResponseInput(uri, header))
|
||||
header.code == GeminiResponse.REDIRECT -> onUpdate(GemState.Redirect(resolve(uri.host, header.meta)))
|
||||
header.code == GeminiResponse.CLIENT_CERTIFICATE_REQUIRED -> onUpdate(GemState.ClientCertRequired(uri, header))
|
||||
header.code != GeminiResponse.SUCCESS -> onUpdate(GemState.ResponseError(uri, header))
|
||||
header.code != GeminiResponse.SUCCESS -> onUpdate(GemState.ResponseError(header))
|
||||
header.meta.startsWith("text/gemini") -> getGemtext(bufferedReader, uri, header, onUpdate)
|
||||
header.meta.startsWith("text/") -> getString(socket, uri, header, onUpdate)
|
||||
header.meta.startsWith("image/") -> getBinary(socket, uri, header, onUpdate)
|
||||
|
|
|
@ -483,11 +483,9 @@ class GemActivity : AppCompatActivity() {
|
|||
is GemState.Requesting -> loadingView(true)
|
||||
is GemState.NotGeminiRequest -> externalProtocol(state)
|
||||
is GemState.ResponseError -> {
|
||||
if(omniTerm.canGoBack() or (prefs.getString("home_capsule", Buran.DEFAULT_HOME_CAPSULE) == state.uri.toString())){
|
||||
omniTerm.reset()
|
||||
showAlert("${GeminiResponse.getCodeString(state.header.code)}:\n\n${state.header.meta}")
|
||||
}
|
||||
}
|
||||
is GemState.ClientCertError -> {
|
||||
certPassword = null
|
||||
updateClientCertIcon()
|
||||
|
|
Loading…
Reference in a new issue