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:
parent
c6eb639b88
commit
bafd1ea316
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "Yoda"
|
name = "Yoda"
|
||||||
version = "0.7.0"
|
version = "0.6.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@ -17,7 +17,7 @@ features = ["v1_6"]
|
|||||||
|
|
||||||
[dependencies.gemini]
|
[dependencies.gemini]
|
||||||
package = "ggemini"
|
package = "ggemini"
|
||||||
version = "0.5.0"
|
version = "0.5.1"
|
||||||
|
|
||||||
[dependencies.gemtext]
|
[dependencies.gemtext]
|
||||||
package = "ggemtext"
|
package = "ggemtext"
|
||||||
|
@ -430,6 +430,7 @@ impl Page {
|
|||||||
Ok(header) => {
|
Ok(header) => {
|
||||||
// Route by status
|
// Route by status
|
||||||
match header.status() {
|
match header.status() {
|
||||||
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#input-expected
|
||||||
ClientStatus::Input | ClientStatus::SensitiveInput => {
|
ClientStatus::Input | ClientStatus::SensitiveInput => {
|
||||||
// Format response
|
// Format response
|
||||||
let status = Status::Input;
|
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
|
// Update meta
|
||||||
meta.borrow_mut().status = Some(Status::Redirect);
|
meta.borrow_mut().status = Some(Status::Redirect);
|
||||||
meta.borrow_mut().title = Some(gformat!("Redirect"));
|
meta.borrow_mut().title = Some(gformat!("Redirect"));
|
||||||
@ -616,10 +621,10 @@ impl Page {
|
|||||||
&uri,
|
&uri,
|
||||||
&match meta.to_gstring() {
|
&match meta.to_gstring() {
|
||||||
Ok(url) => gformat!(
|
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!(
|
Err(_) => gformat!(
|
||||||
"# Redirect\n\nProvider request redirect but have not provided any target."
|
"# Redirect\n\nProvider request redirect but not provided any target."
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user