Skip to content
Snippets Groups Projects
Commit c2b1b66c authored by Éloïs's avatar Éloïs
Browse files

[fix] add resetWot and write to each modifications

parent 03193931
No related branches found
No related tags found
No related merge requests found
Pipeline #
test.bin
native/target native/target
native/index.node native/index.node
native/artifacts.json native/artifacts.json
......
...@@ -90,25 +90,44 @@ const WotB = { ...@@ -90,25 +90,44 @@ const WotB = {
return addon.set_max_links(this.instanceID, maxCert); return addon.set_max_links(this.instanceID, maxCert);
}, },
addNode: function() { addNode: function() {
return addon.add_node(this.instanceID); var result = addon.add_node(this.instanceID);
if (this.filePath.length > 0) {
this.write();
}
return result;
}, },
removeNode: function() { removeNode: function() {
return addon.rem_node(this.instanceID); var result = addon.rem_node(this.instanceID);
if (this.filePath.length > 0) {
this.write();
}
return result;
}, },
setEnabled: function(is_enabled, nodeId) { setEnabled: function(is_enabled, nodeId) {
return addon.set_enabled(this.instanceID, is_enabled, nodeId); var result = addon.set_enabled(this.instanceID, is_enabled, nodeId);
if (this.filePath.length > 0) {
this.write();
}
return result;
}, },
addLink: function(source, target) { addLink: function(source, target) {
return addon.add_link(this.instanceID, source, target); var result = addon.add_link(this.instanceID, source, target);
if (this.filePath.length > 0) {
this.write();
}
return result;
}, },
removeLink: function(source, target) { removeLink: function(source, target) {
return addon.rem_link(this.instanceID, source, target); var result = addon.rem_link(this.instanceID, source, target);
if (this.filePath.length > 0) {
this.write();
}
return result;
}, },
isOutdistanced: function(node, sentry_requirement, step_max, x_percent) { isOutdistanced: function(node, sentry_requirement, step_max, x_percent) {
...@@ -136,5 +155,14 @@ const WotB = { ...@@ -136,5 +155,14 @@ const WotB = {
clear: function() { clear: function() {
return addon.remove_wot(this.instanceID); return addon.remove_wot(this.instanceID);
},
resetWoT: function() {
var sigStock = addon.getMaxCert(this.instanceID);
addon.remove_wot(this.instanceID);
this.instanceID = addon.new_memory_instance(sigStock);
if (filePath.length > 0) {
this.write();
}
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment