Small refactoring and fix LF escape in domain data.

This commit is contained in:
Revertron
2022-07-26 18:09:37 +02:00
parent 492bb4e16d
commit 8cfc48e9c0
4 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -360,7 +360,7 @@ fn load_domains(context: &mut MutexGuard<Context>, handle: &Handle<()>) {
//debug!("Domains: {:?}", &domains.values());
for (_identity, (domain, timestamp, data)) in domains {
let d = serde_json::to_string(&data).unwrap();
let d = d.replace("'", "\\'");
let d = d.replace("'", "\\'").replace("\\n", "\\\\n");
let command = format!("addMyDomain('{}', {}, {}, '{}');", &domain, timestamp, timestamp + DOMAIN_LIFETIME, &d);
let _ = handle.dispatch(move |web_view|{
web_view.eval(&command)