1
0
mirror of https://github.com/YGGverse/Yoda.git synced 2025-03-13 06:01:21 +00:00

fix redirect status detection

This commit is contained in:
yggverse 2024-10-28 14:27:19 +02:00
parent c6eb639b88
commit bafd1ea316
2 changed files with 10 additions and 5 deletions
Cargo.toml
src/app/browser/window/tab/item

@ -1,6 +1,6 @@
[package]
name = "Yoda"
version = "0.7.0"
version = "0.6.1"
edition = "2021"
license = "MIT"
readme = "README.md"
@ -17,7 +17,7 @@ features = ["v1_6"]
[dependencies.gemini]
package = "ggemini"
version = "0.5.0"
version = "0.5.1"
[dependencies.gemtext]
package = "ggemtext"

@ -430,6 +430,7 @@ impl Page {
Ok(header) => {
// Route by status
match header.status() {
// https://geminiprotocol.net/docs/protocol-specification.gmi#input-expected
ClientStatus::Input | ClientStatus::SensitiveInput => {
// Format response
let status = Status::Input;
@ -604,7 +605,11 @@ impl Page {
},
}
},
ClientStatus::Redirect => {
// https://geminiprotocol.net/docs/protocol-specification.gmi#redirection
ClientStatus::Redirect | ClientStatus::PermanentRedirect => {
// @TODO ClientStatus::TemporaryRedirect
// Update meta
meta.borrow_mut().status = Some(Status::Redirect);
meta.borrow_mut().title = Some(gformat!("Redirect"));
@ -616,10 +621,10 @@ impl Page {
&uri,
&match meta.to_gstring() {
Ok(url) => gformat!(
"# Redirect\n\nAuto-follow disabled, click on link below to continue\n\n=> {url}"
"# Redirect\n\nAuto-follow not implemented, click on link below to continue\n\n=> {url}"
),
Err(_) => gformat!(
"# Redirect\n\nProvider request redirect but have not provided any target."
"# Redirect\n\nProvider request redirect but not provided any target."
)
}
);