From 69142fa60f32404d603e48570c122a9cd6cc446f Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 21 Nov 2024 19:48:31 +0200 Subject: [PATCH] add 61, 62 status codes handle, show server-side message on failure --- README.md | 6 +++--- src/app/browser/window/tab/item/page.rs | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8ad3e558..c02cbf77 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,10 @@ GTK 4 / Libadwaita client written in Rust * [ ] `52` Gone * [ ] `53` Proxy request refused * [ ] `59` Bad request - * [ ] Client certificates + * [x] Client certificates * [x] `60` Certificate requested - * [ ] `61` Certificate not authorized - * [ ] `62` Certificate not valid + * [x] `61` Certificate not authorized + * [x] `62` Certificate not valid * [x] [Gemtext](https://geminiprotocol.net/docs/gemtext-specification.gmi) (by [ggemtext](https://github.com/YGGverse/ggemtext)) * [x] Code (inline/multiline) * [x] Inline diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index 0f14ba31..0aed7fdb 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -859,7 +859,11 @@ impl Page { update.activate(Some(&id)); }, // https://geminiprotocol.net/docs/protocol-specification.gmi#status-60 - gemini::client::response::meta::Status::CertificateRequest => { + gemini::client::response::meta::Status::CertificateRequest | + // https://geminiprotocol.net/docs/protocol-specification.gmi#status-61 + gemini::client::response::meta::Status::CertificateUnauthorized | + // https://geminiprotocol.net/docs/protocol-specification.gmi#status-62 + gemini::client::response::meta::Status::CertificateInvalid => { // Define common data let status = Status::Success; let title = "Identity"; @@ -867,7 +871,11 @@ impl Page { // Update widget content .to_status_identity() - .set_title(title); + .set_title(title) + .set_description(match response.data() { + Some(data) => Some(data.value().as_str()), + None => None, + }); // Update meta meta.set_status(status) @@ -885,7 +893,10 @@ impl Page { content .to_status_failure() .set_title(title) - .set_description(Some("Status code yet not supported")); + .set_description(Some(match response.data() { + Some(data) => data.value().as_str(), + None => "Status code yet not supported", // @TODO + })); // Update meta meta.set_status(status)