add progress bar to snapchat net tls mozilla

This commit is contained in:
nworbnhoj 2023-07-04 05:51:59 +10:00
parent 044fed1096
commit 5c9905a0be
2 changed files with 20 additions and 2 deletions

View file

@ -19,6 +19,14 @@
"en": "trust all Root CA's in webpki-roots",
"en-tts": "trust all Root CA's in webpki-roots"
},
"tls.mozilla_progress": {
"en": "trusting Mozilla Root CA's",
"en-tts": "trusting Mozilla Root CA's"
},
"tls.mozilla_done": {
"en": "trusted Root CA's",
"en-tts": "trusted Root CA's"
},
"tls.probe_cmd": {
"en": "save host CA'a if trusted",
"en-tts": "save host CA'a if trusted"

View file

@ -1,11 +1,13 @@
use crate::{danger, Tls};
use locales::t;
use modals::Modals;
use std::convert::TryInto;
use std::io::Read;
use std::io::Write;
use std::net::TcpStream;
use std::str::from_utf8;
use std::sync::Arc;
use xous_names::XousNames;
pub fn shellchat<'a>(
mut tokens: impl Iterator<Item = &'a str>,
@ -39,13 +41,21 @@ pub fn shellchat<'a>(
)
})
.collect();
let mut count = 0;
let mut count:u32 = rotas.len().try_into().unwrap();
let xns = XousNames::new().unwrap();
let modals = Modals::new(&xns).unwrap();
modals
.start_progress(t!("tls.mozilla_progress", locales::LANG), 0, count, 0)
.expect("no progress");
count = 0;
let tls = Tls::new();
for rota in rotas {
tls.save_cert(&rota).unwrap_or_else(|e| log::warn!("{e}"));
modals.update_progress(count).expect("no progress");
count += 1;
}
write!(ret, "trusted {count} certificates").ok();
modals.finish_progress().expect("finish progress");
write!(ret, "{} {}", count, t!("tls.mozilla_done", locales::LANG)).ok();
}
// probe establishes a tls connection to the supplied host, extracts the
// certificates offered and immediately closes the connection.