mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
enshort construction by using common methods
This commit is contained in:
parent
7d65795e8c
commit
100b0a1280
1 changed files with 7 additions and 15 deletions
|
|
@ -585,28 +585,20 @@ fn handle(
|
|||
}
|
||||
}
|
||||
Response::Certificate(ref certificate) => {
|
||||
let (header_size, message) = match certificate {
|
||||
let header = certificate.as_bytes();
|
||||
let message = match certificate {
|
||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-60
|
||||
Certificate::Required(required) => (
|
||||
required.as_bytes().len(),
|
||||
required.message().unwrap_or("Certificate required")
|
||||
),
|
||||
Certificate::Required(required) => required.message().unwrap_or("Certificate required"),
|
||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-61-certificate-not-authorized
|
||||
Certificate::NotAuthorized(not_authorized) => (
|
||||
not_authorized.as_bytes().len(),
|
||||
not_authorized.message().unwrap_or("Certificate not authorized")
|
||||
),
|
||||
Certificate::NotAuthorized(not_authorized) => not_authorized.message().unwrap_or("Certificate not authorized"),
|
||||
// https://geminiprotocol.net/docs/protocol-specification.gmi#status-62-certificate-not-valid
|
||||
Certificate::NotValid(not_valid) => (
|
||||
not_valid.as_bytes().len(),
|
||||
not_valid.message().unwrap_or("Certificate not valid")
|
||||
),
|
||||
Certificate::NotValid(not_valid) => 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)
|
||||
.set_size(Some(header.len()), None)
|
||||
.unset_mime()
|
||||
.commit();
|
||||
page.navigation.request.update_secondary_icon(&i)
|
||||
|
|
@ -614,7 +606,7 @@ fn handle(
|
|||
let s = page.content.to_status_identity();
|
||||
s.set_description(Some(message));
|
||||
page.set_progress(0.0);
|
||||
page.set_title(&s.title());
|
||||
page.set_title(message);
|
||||
if is_snap_history {
|
||||
page.snap_history();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue