Implemented immidiate check of DNS records, reverted Edge usage.
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ rust-crypto = "^0.2"
|
|||||||
blakeout = "0.1.0"
|
blakeout = "0.1.0"
|
||||||
num_cpus = "1.13.0"
|
num_cpus = "1.13.0"
|
||||||
byteorder = "1.3.2"
|
byteorder = "1.3.2"
|
||||||
web-view = { version = "0.7.3", features = ["edge"] }
|
web-view = { version = "0.7.3", features = [] }
|
||||||
tinyfiledialogs = "3.3.10"
|
tinyfiledialogs = "3.3.10"
|
||||||
serde = { version = "1.0.123", features = ["derive"] }
|
serde = { version = "1.0.123", features = ["derive"] }
|
||||||
serde_json = "1.0.42"
|
serde_json = "1.0.42"
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ pub fn run_interface(context: Arc<Mutex<Context>>, miner: Arc<Mutex<Miner>>) {
|
|||||||
LoadKey => { action_load_key(&context, web_view); }
|
LoadKey => { action_load_key(&context, web_view); }
|
||||||
CreateKey => { keys::create_key(Arc::clone(&context)); }
|
CreateKey => { keys::create_key(Arc::clone(&context)); }
|
||||||
SaveKey => { action_save_key(&context); }
|
SaveKey => { action_save_key(&context); }
|
||||||
|
CheckRecord { data } => { action_check_record(web_view, data); }
|
||||||
CheckDomain { name } => { action_check_domain(&context, web_view, name); }
|
CheckDomain { name } => { action_check_domain(&context, web_view, name); }
|
||||||
MineDomain { name, records, .. } => {
|
MineDomain { name, records, .. } => {
|
||||||
action_create_domain(Arc::clone(&context), Arc::clone(&miner), web_view, name, &records);
|
action_create_domain(Arc::clone(&context), Arc::clone(&miner), web_view, name, &records);
|
||||||
@@ -105,6 +106,13 @@ fn action_check_zone(context: &Arc<Mutex<Context>>, web_view: &mut WebView<()>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn action_check_record(web_view: &mut WebView<()>, data: String) {
|
||||||
|
match serde_json::from_str::<DnsRecord>(&data) {
|
||||||
|
Ok(_) => { web_view.eval("recordOkay(true)").expect("Error evaluating!"); }
|
||||||
|
Err(e) => { web_view.eval("recordOkay(false)").expect("Error evaluating!"); dbg!(e); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn action_check_domain(context: &Arc<Mutex<Context>>, web_view: &mut WebView<()>, name: String) {
|
fn action_check_domain(context: &Arc<Mutex<Context>>, web_view: &mut WebView<()>, name: String) {
|
||||||
let name = name.to_lowercase();
|
let name = name.to_lowercase();
|
||||||
let c = context.lock().unwrap();
|
let c = context.lock().unwrap();
|
||||||
@@ -230,6 +238,7 @@ fn action_create_domain(context: Arc<Mutex<Context>>, miner: Arc<Mutex<Miner>>,
|
|||||||
let data = DomainData::new(zone.clone(), records);
|
let data = DomainData::new(zone.clone(), records);
|
||||||
let data = serde_json::to_string(&data).unwrap();
|
let data = serde_json::to_string(&data).unwrap();
|
||||||
create_domain(c, miner, &name, &data, difficulty, &context.keystore);
|
create_domain(c, miner, &name, &data, difficulty, &context.keystore);
|
||||||
|
let _ = web_view.eval("domainMiningStarted()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MineResult::WrongName => { show_warning(web_view, "You can't mine this domain!"); }
|
MineResult::WrongName => { show_warning(web_view, "You can't mine this domain!"); }
|
||||||
@@ -304,6 +313,7 @@ pub enum Cmd {
|
|||||||
SaveKey,
|
SaveKey,
|
||||||
CheckZone { name: String },
|
CheckZone { name: String },
|
||||||
MineZone { name: String, data: String },
|
MineZone { name: String, data: String },
|
||||||
|
CheckRecord { data: String },
|
||||||
CheckDomain { name: String },
|
CheckDomain { name: String },
|
||||||
MineDomain { name: String, records: String, tags: String },
|
MineDomain { name: String, records: String, tags: String },
|
||||||
TransferDomain { name: String, owner: String },
|
TransferDomain { name: String, owner: String },
|
||||||
|
|||||||
+20
-5
@@ -48,9 +48,7 @@ function refresh_records_list() {
|
|||||||
function showNewRecordDialog() {
|
function showNewRecordDialog() {
|
||||||
button_positive = document.getElementById("new_record_positive_button");
|
button_positive = document.getElementById("new_record_positive_button");
|
||||||
button_positive.onclick = function() {
|
button_positive.onclick = function() {
|
||||||
addRecord(get_record_from_dialog()); // It will refresh list
|
checkRecord(get_record_from_dialog());
|
||||||
dialog = document.getElementById("new_record_dialog");
|
|
||||||
dialog.className = "modal";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
button_negative = document.getElementById("new_record_negative_button");
|
button_negative = document.getElementById("new_record_negative_button");
|
||||||
@@ -65,7 +63,7 @@ function showNewRecordDialog() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get_record_from_dialog() {
|
function get_record_from_dialog() {
|
||||||
record_name = document.getElementById("record_name").value;
|
record_name = document.getElementById("record_name").value.toLowerCase();
|
||||||
record_type = document.getElementById("record_type").value;
|
record_type = document.getElementById("record_type").value;
|
||||||
record_ttl = parseInt(document.getElementById("record_ttl").value);
|
record_ttl = parseInt(document.getElementById("record_ttl").value);
|
||||||
record_data = document.getElementById("record_data").value;
|
record_data = document.getElementById("record_data").value;
|
||||||
@@ -123,11 +121,28 @@ function saveKey() {
|
|||||||
external.invoke(JSON.stringify({cmd: 'saveKey'}));
|
external.invoke(JSON.stringify({cmd: 'saveKey'}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkRecord(data) {
|
||||||
|
external.invoke(JSON.stringify({cmd: 'checkRecord', data: JSON.stringify(data)}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function recordOkay(okay) {
|
||||||
|
if (okay) {
|
||||||
|
addRecord(get_record_from_dialog()); // It will refresh list
|
||||||
|
dialog = document.getElementById("new_record_dialog");
|
||||||
|
dialog.className = "modal";
|
||||||
|
} else {
|
||||||
|
showWarning('Record is not valid!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function createDomain() {
|
function createDomain() {
|
||||||
new_domain = document.getElementById("new_domain").value;
|
new_domain = document.getElementById("new_domain").value.toLowerCase();
|
||||||
new_dom_records = JSON.stringify(recordsBuffer);
|
new_dom_records = JSON.stringify(recordsBuffer);
|
||||||
new_dom_tags = document.getElementById("new_domain_tags").value;
|
new_dom_tags = document.getElementById("new_domain_tags").value;
|
||||||
external.invoke(JSON.stringify({cmd: 'mineDomain', name: new_domain, records: new_dom_records, tags: new_dom_tags}));
|
external.invoke(JSON.stringify({cmd: 'mineDomain', name: new_domain, records: new_dom_records, tags: new_dom_tags}));
|
||||||
|
}
|
||||||
|
|
||||||
|
function domainMiningStarted() {
|
||||||
recordsBuffer = [];
|
recordsBuffer = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user