|
|
|
|
@ -117,6 +117,26 @@ fn prompt_for_answer(s: &mut Cursive, url: Url, message: String) {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn prompt_for_secret_answer(s: &mut Cursive, url: Url, message: String) { |
|
|
|
|
s.add_layer( |
|
|
|
|
Dialog::new() |
|
|
|
|
.title(message) |
|
|
|
|
// Padding is (left, right, top, bottom)
|
|
|
|
|
.padding((1, 1, 1, 0)) |
|
|
|
|
.content( |
|
|
|
|
EditView::new() |
|
|
|
|
.secret() |
|
|
|
|
.on_submit(move |s, response| { |
|
|
|
|
let link = format!("{}?{}", url.to_string(), response); |
|
|
|
|
s.pop_layer(); |
|
|
|
|
follow_link(s, &link); |
|
|
|
|
}) |
|
|
|
|
.fixed_width(60), |
|
|
|
|
) |
|
|
|
|
.with_id("url_query"), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn goto_url(s: &mut Cursive, url: &str) { |
|
|
|
|
// Prepend gemini scheme if needed
|
|
|
|
|
if url.starts_with("gemini://") { |
|
|
|
|
@ -243,6 +263,10 @@ fn handle_response_status(
|
|
|
|
|
prompt_for_answer(s, url_copy, message); |
|
|
|
|
None |
|
|
|
|
} |
|
|
|
|
Status::Secret(message) => { |
|
|
|
|
prompt_for_secret_answer(s, url_copy, message); |
|
|
|
|
None |
|
|
|
|
} |
|
|
|
|
other_status => { |
|
|
|
|
s.add_layer(Dialog::info(format!("ERROR: {:?}", other_status))); |
|
|
|
|
None |
|
|
|
|
|