From bafd1ea316cd5a17e98d03b584764c65b42634fd Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 28 Oct 2024 14:27:19 +0200 Subject: [PATCH] fix redirect status detection --- Cargo.toml | 4 ++-- src/app/browser/window/tab/item/page.rs | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5a058c8a..bbd319f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index e708df61..c0179917 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -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." ) } );