mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
update ggemtext api
This commit is contained in:
parent
c6a691bbdf
commit
7d65795e8c
1 changed files with 34 additions and 16 deletions
|
|
@ -584,23 +584,41 @@ fn handle(
|
||||||
update_page_info(&page, EVENT_COMPLETED);
|
update_page_info(&page, EVENT_COMPLETED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Response::Certificate(ref certificate) => match certificate {
|
Response::Certificate(ref certificate) => {
|
||||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-60
|
let (header_size, message) = match certificate {
|
||||||
Certificate::Required { message } |
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-60
|
||||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-61-certificate-not-authorized
|
Certificate::Required(required) => (
|
||||||
Certificate::NotAuthorized { message } |
|
required.as_bytes().len(),
|
||||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-62-certificate-not-valid
|
required.message().unwrap_or("Certificate required")
|
||||||
Certificate::NotValid { message } => {
|
),
|
||||||
let s = page.content.to_status_identity();
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-61-certificate-not-authorized
|
||||||
s.set_description(Some(message.as_ref().unwrap_or(&certificate.to_string())));
|
Certificate::NotAuthorized(not_authorized) => (
|
||||||
page.set_progress(0.0);
|
not_authorized.as_bytes().len(),
|
||||||
page.set_title(&s.title());
|
not_authorized.message().unwrap_or("Certificate not authorized")
|
||||||
if is_snap_history {
|
),
|
||||||
page.snap_history();
|
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-62-certificate-not-valid
|
||||||
}
|
Certificate::NotValid(not_valid) => (
|
||||||
redirects.replace(0); // reset
|
not_valid.as_bytes().len(),
|
||||||
update_page_info(&page, EVENT_COMPLETED);
|
not_valid.message().unwrap_or("Certificate not valid")
|
||||||
|
),
|
||||||
|
};
|
||||||
|
{
|
||||||
|
let mut i = page.navigation.request.info.borrow_mut();
|
||||||
|
i
|
||||||
|
.add_event(EVENT_COMPLETED.to_string())
|
||||||
|
.set_size(Some(header_size), None)
|
||||||
|
.unset_mime()
|
||||||
|
.commit();
|
||||||
|
page.navigation.request.update_secondary_icon(&i)
|
||||||
}
|
}
|
||||||
|
let s = page.content.to_status_identity();
|
||||||
|
s.set_description(Some(message));
|
||||||
|
page.set_progress(0.0);
|
||||||
|
page.set_title(&s.title());
|
||||||
|
if is_snap_history {
|
||||||
|
page.snap_history();
|
||||||
|
}
|
||||||
|
redirects.replace(0); // reset
|
||||||
}
|
}
|
||||||
Response::Failure(failure) => match failure {
|
Response::Failure(failure) => match failure {
|
||||||
Failure::Temporary(ref temporary) => match temporary {
|
Failure::Temporary(ref temporary) => match temporary {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue