|
|
@ -193,6 +193,8 @@ impl Page { |
|
|
|
meta.borrow_mut().description = Some(host); |
|
|
|
meta.borrow_mut().description = Some(host); |
|
|
|
meta.borrow_mut().title = Some(uri.path()); |
|
|
|
meta.borrow_mut().title = Some(uri.path()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
action_update.activate(None); |
|
|
|
|
|
|
|
|
|
|
|
// Try create short base for title
|
|
|
|
// Try create short base for title
|
|
|
|
let path = uri.path(); |
|
|
|
let path = uri.path(); |
|
|
|
let path = Path::new(&path); |
|
|
|
let path = Path::new(&path); |
|
|
@ -219,28 +221,34 @@ impl Page { |
|
|
|
"text/gemini" => { |
|
|
|
"text/gemini" => { |
|
|
|
// Update meta
|
|
|
|
// Update meta
|
|
|
|
meta.borrow_mut().mime = Some(Mime::TextGemini); |
|
|
|
meta.borrow_mut().mime = Some(Mime::TextGemini); |
|
|
|
// Select widget
|
|
|
|
|
|
|
|
|
|
|
|
// Update data
|
|
|
|
match parts.get(4) { |
|
|
|
match parts.get(4) { |
|
|
|
Some(source) => { |
|
|
|
Some(source) => { |
|
|
|
// Update content
|
|
|
|
meta.borrow_mut().status = Some(Status::Success); |
|
|
|
let result = content.reset(content::Mime::TextGemini, &uri, &source); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This content type may return parsed title
|
|
|
|
// This content type may return parsed title
|
|
|
|
|
|
|
|
let result = content.reset(content::Mime::TextGemini, &uri, &source); |
|
|
|
meta.borrow_mut().title = result.title.clone(); |
|
|
|
meta.borrow_mut().title = result.title.clone(); |
|
|
|
|
|
|
|
|
|
|
|
// Update status
|
|
|
|
action_update.activate(None); |
|
|
|
meta.borrow_mut().status = Some(Status::Success); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
None => todo!(), |
|
|
|
None => todo!(), |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
"text/plain" => { |
|
|
|
"text/plain" => { |
|
|
|
|
|
|
|
meta.borrow_mut().status = Some(Status::Success); |
|
|
|
meta.borrow_mut().mime = Some(Mime::TextPlain); |
|
|
|
meta.borrow_mut().mime = Some(Mime::TextPlain); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
action_update.activate(None); |
|
|
|
todo!() |
|
|
|
todo!() |
|
|
|
}, |
|
|
|
}, |
|
|
|
_ => { |
|
|
|
_ => { |
|
|
|
|
|
|
|
meta.borrow_mut().status = Some(Status::Failure); |
|
|
|
meta.borrow_mut().title = Some(gformat!("Oops")); |
|
|
|
meta.borrow_mut().title = Some(gformat!("Oops")); |
|
|
|
meta.borrow_mut().description = Some(gformat!("Content {mime} not supported")); |
|
|
|
meta.borrow_mut().description = Some(gformat!("Content {mime} not supported")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
action_update.activate(None); |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
None => todo!(), |
|
|
|
None => todo!(), |
|
|
@ -253,6 +261,8 @@ impl Page { |
|
|
|
meta.borrow_mut().mime = Some(Mime::TextGemini); |
|
|
|
meta.borrow_mut().mime = Some(Mime::TextGemini); |
|
|
|
meta.borrow_mut().title = Some(gformat!("Redirect")); |
|
|
|
meta.borrow_mut().title = Some(gformat!("Redirect")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
action_update.activate(None); |
|
|
|
|
|
|
|
|
|
|
|
// Select widget
|
|
|
|
// Select widget
|
|
|
|
match parts.get(3) { |
|
|
|
match parts.get(3) { |
|
|
|
Some(source) => { |
|
|
|
Some(source) => { |
|
|
@ -268,16 +278,16 @@ impl Page { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// @TODO
|
|
|
|
// @TODO
|
|
|
|
_ => { |
|
|
|
_ => { |
|
|
|
|
|
|
|
// Update
|
|
|
|
meta.borrow_mut().status = Some(Status::Failure); |
|
|
|
meta.borrow_mut().status = Some(Status::Failure); |
|
|
|
meta.borrow_mut().title = Some(gformat!("Oops")); |
|
|
|
meta.borrow_mut().title = Some(gformat!("Oops")); |
|
|
|
meta.borrow_mut().description = Some(gformat!("Status {code} not supported")); |
|
|
|
meta.borrow_mut().description = Some(gformat!("Status {code} not supported")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
action_update.activate(None); |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
None => todo!(), |
|
|
|
None => todo!(), |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Update
|
|
|
|
|
|
|
|
action_update.activate(None); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
Err(e) => { |
|
|
|
Err(e) => { |
|
|
|
meta.borrow_mut().status = Some(Status::Failure); |
|
|
|
meta.borrow_mut().status = Some(Status::Failure); |
|
|
|