update ggemini namespace

This commit is contained in:
yggverse 2024-12-01 08:49:43 +02:00
parent 2d46fb9726
commit 9658e772da

View File

@ -433,8 +433,8 @@ impl Page {
// Route by status // Route by status
match response.meta.status { match response.meta.status {
// https://geminiprotocol.net/docs/protocol-specification.gmi#input-expected // https://geminiprotocol.net/docs/protocol-specification.gmi#input-expected
gemini::client::response::meta::Status::Input | gemini::client::connection::response::meta::Status::Input |
gemini::client::response::meta::Status::SensitiveInput => { gemini::client::connection::response::meta::Status::SensitiveInput => {
// Format response // Format response
let status = Status::Input; let status = Status::Input;
let title = match response.meta.data { let title = match response.meta.data {
@ -444,7 +444,7 @@ impl Page {
// Toggle input form variant // Toggle input form variant
match response.meta.status { match response.meta.status {
gemini::client::response::meta::Status::SensitiveInput => gemini::client::connection::response::meta::Status::SensitiveInput =>
input.set_new_sensitive( input.set_new_sensitive(
tab_action.clone(), tab_action.clone(),
uri.clone(), uri.clone(),
@ -468,7 +468,7 @@ impl Page {
update.activate(Some(&id)); update.activate(Some(&id));
}, },
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-20 // https://geminiprotocol.net/docs/protocol-specification.gmi#status-20
gemini::client::response::meta::Status::Success => { gemini::client::connection::response::meta::Status::Success => {
// Add history record // Add history record
if is_history { if is_history {
snap_history(navigation.clone()); snap_history(navigation.clone());
@ -476,9 +476,9 @@ impl Page {
// Route by MIME // Route by MIME
match response.meta.mime { match response.meta.mime {
Some(gemini::client::response::meta::Mime::TextGemini) => { Some(gemini::client::connection::response::meta::Mime::TextGemini) => {
// Read entire input stream to buffer // Read entire input stream to buffer
gemini::client::response::data::Text::from_stream_async( gemini::client::connection::response::data::Text::from_stream_async(
response.connection.stream(), response.connection.stream(),
Priority::DEFAULT, Priority::DEFAULT,
cancellable.clone(), cancellable.clone(),
@ -534,10 +534,10 @@ impl Page {
); );
}, },
Some( Some(
gemini::client::response::meta::Mime::ImagePng | gemini::client::connection::response::meta::Mime::ImagePng |
gemini::client::response::meta::Mime::ImageGif | gemini::client::connection::response::meta::Mime::ImageGif |
gemini::client::response::meta::Mime::ImageJpeg | gemini::client::connection::response::meta::Mime::ImageJpeg |
gemini::client::response::meta::Mime::ImageWebp gemini::client::connection::response::meta::Mime::ImageWebp
) => { ) => {
// Final image size unknown, show loading widget // Final image size unknown, show loading widget
let status = content.to_status_loading( let status = content.to_status_loading(
@ -645,9 +645,9 @@ impl Page {
} }
}, },
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-30-temporary-redirection // https://geminiprotocol.net/docs/protocol-specification.gmi#status-30-temporary-redirection
gemini::client::response::meta::Status::Redirect | gemini::client::connection::response::meta::Status::Redirect |
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-31-permanent-redirection // https://geminiprotocol.net/docs/protocol-specification.gmi#status-31-permanent-redirection
gemini::client::response::meta::Status::PermanentRedirect => { gemini::client::connection::response::meta::Status::PermanentRedirect => {
// Extract redirection URL from response data // Extract redirection URL from response data
match response.meta.data { match response.meta.data {
Some(unresolved_url) => { Some(unresolved_url) => {
@ -702,7 +702,7 @@ impl Page {
UriHideFlags::FRAGMENT | UriHideFlags::QUERY UriHideFlags::FRAGMENT | UriHideFlags::QUERY
), ),
// Set follow policy based on status code // Set follow policy based on status code
matches!(response.meta.status, gemini::client::response::meta::Status::PermanentRedirect), matches!(response.meta.status, gemini::client::connection::response::meta::Status::PermanentRedirect),
) )
.set_status(Status::Redirect) // @TODO is this status really wanted? .set_status(Status::Redirect) // @TODO is this status really wanted?
.set_title("Redirect"); .set_title("Redirect");
@ -756,11 +756,11 @@ impl Page {
update.activate(Some(&id)); update.activate(Some(&id));
}, },
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-60 // https://geminiprotocol.net/docs/protocol-specification.gmi#status-60
gemini::client::response::meta::Status::CertificateRequest | gemini::client::connection::response::meta::Status::CertificateRequest |
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-61-certificate-not-authorized // https://geminiprotocol.net/docs/protocol-specification.gmi#status-61-certificate-not-authorized
gemini::client::response::meta::Status::CertificateUnauthorized | gemini::client::connection::response::meta::Status::CertificateUnauthorized |
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-62-certificate-not-valid // https://geminiprotocol.net/docs/protocol-specification.gmi#status-62-certificate-not-valid
gemini::client::response::meta::Status::CertificateInvalid => { gemini::client::connection::response::meta::Status::CertificateInvalid => {
// Define common data // Define common data
let status = Status::Success; let status = Status::Success;
let title = "Identity"; let title = "Identity";
@ -777,8 +777,8 @@ impl Page {
.set_description(Some(&match response.meta.data { .set_description(Some(&match response.meta.data {
Some(data) => data.value, Some(data) => data.value,
None => match response.meta.status { None => match response.meta.status {
gemini::client::response::meta::Status::CertificateUnauthorized => gformat!("Certificate not authorized"), gemini::client::connection::response::meta::Status::CertificateUnauthorized => gformat!("Certificate not authorized"),
gemini::client::response::meta::Status::CertificateInvalid => gformat!("Certificate not valid"), gemini::client::connection::response::meta::Status::CertificateInvalid => gformat!("Certificate not valid"),
_ => gformat!("Client certificate required") _ => gformat!("Client certificate required")
}, },
})); }));