mirror of
https://github.com/Corewala/Buran
synced 2024-12-21 23:32:40 +00:00
Fixed issue with local redirects from links on another host
This commit is contained in:
parent
73afc7c684
commit
0a47f391e5
3 changed files with 6 additions and 3 deletions
|
@ -10,7 +10,7 @@ sealed class GemState {
|
|||
data class NotGeminiRequest(val uri: URI) : GemState()
|
||||
data class ResponseGemtext(val uri: URI, val header: GeminiResponse.Header, val lines: List<String>) : GemState()
|
||||
data class ResponseInput(val uri: URI, val header: GeminiResponse.Header) : GemState()
|
||||
class Redirect(val uri: String) : GemState()
|
||||
data class Redirect(val uri: URI, val header: GeminiResponse.Header) : GemState()
|
||||
data class ResponseText(val uri: URI, val header: GeminiResponse.Header, val content: String) : 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()
|
||||
|
|
|
@ -148,7 +148,7 @@ class GeminiDatasource(private val context: Context, val history: BuranHistory):
|
|||
currentRequestAddress = null
|
||||
when {
|
||||
header.code == GeminiResponse.INPUT -> onUpdate(GemState.ResponseInput(uri, header))
|
||||
header.code == GeminiResponse.REDIRECT -> onUpdate(GemState.Redirect(header.meta))
|
||||
header.code == GeminiResponse.REDIRECT -> onUpdate(GemState.Redirect(uri, header))
|
||||
header.code == GeminiResponse.CLIENT_CERTIFICATE_REQUIRED -> onUpdate(GemState.ClientCertRequired(uri, header))
|
||||
header.code != GeminiResponse.SUCCESS -> onUpdate(GemState.ResponseError(header))
|
||||
header.meta.startsWith("text/gemini") -> getGemtext(bufferedReader, requestEntity.trim().toURI(), header, onUpdate)
|
||||
|
|
|
@ -458,7 +458,10 @@ class GemActivity : AppCompatActivity() {
|
|||
.show()
|
||||
}
|
||||
|
||||
is GemState.Redirect -> gemRequest(omniTerm.getGlobalUri(state.uri))
|
||||
is GemState.Redirect -> {
|
||||
omniTerm.set(proxiedAddress ?: state.uri.toString())
|
||||
gemRequest(omniTerm.getGlobalUri(state.header.meta))
|
||||
}
|
||||
|
||||
is GemState.ClientCertRequired -> runOnUiThread {
|
||||
loadingView(false)
|
||||
|
|
Loading…
Reference in a new issue