Mise à jour de GitLab prévue ce dimanche 25 octobre 2020 à partir de 9h00 CEST | GitLab upgrade planned this Sunday 25rd of October 2020 from 9:00 AM CEST

Commit 1fc75139 authored by Éloïs's avatar Éloïs

[enh] change addon path to absolute and autorize node 8

parent 126a83a2
Pipeline #1962 passed with stage
in 2 minutes and 19 seconds
"use strict";
const addon = require('../native');
const path = require('path');
const binding_path = path.resolve(path.join(__dirname,'../native'));
const binding = require(binding_path);
module.exports = {
......@@ -9,9 +10,9 @@ module.exports = {
const instance = Object.create(WotB)
if (process.platform == 'win32') {
let bufferedPath = new Buffer(filePath,'ascii');
instance.init(addon.new_file_instance_win_32(bufferedPath, bufferedPath.length, sigStock))
instance.init(binding.new_file_instance_win_32(bufferedPath, bufferedPath.length, sigStock))
} else {
instance.init(addon.new_file_instance(filePath, sigStock));
instance.init(binding.new_file_instance(filePath, sigStock));
}
instance.setFilePath(filePath)
return instance
......@@ -19,7 +20,7 @@ module.exports = {
newMemoryInstance: (sigStock) => {
const instance = Object.create(WotB)
const id = addon.new_memory_instance(sigStock);
const id = binding.new_memory_instance(sigStock);
instance.init(id)
return instance
},
......@@ -45,53 +46,53 @@ const WotB = {
},
write: function() {
return addon.write_instance_in_file(this.instanceID, this.filePath);
return binding.write_instance_in_file(this.instanceID, this.filePath);
},
memCopy: function() {
const copy = Object.create(WotB)
copy.instanceID = addon.mem_copy(this.instanceID);
copy.instanceID = binding.mem_copy(this.instanceID);
return copy;
},
getMaxCert: function() {
return addon.get_max_links(this.instanceID);
return binding.get_max_links(this.instanceID);
},
getWoTSize: function() {
return addon.get_wot_size(this.instanceID);
return binding.get_wot_size(this.instanceID);
},
isEnabled: function(nodeId) {
return addon.is_enabled(this.instanceID, nodeId);
return binding.is_enabled(this.instanceID, nodeId);
},
getEnabled: function() {
return addon.get_enabled(this.instanceID);
return binding.get_enabled(this.instanceID);
},
getDisabled: function() {
return addon.get_disabled(this.instanceID);
return binding.get_disabled(this.instanceID);
},
getSentries: function(sentry_requirement) {
return addon.get_sentries(this.instanceID, sentry_requirement);
return binding.get_sentries(this.instanceID, sentry_requirement);
},
getNonSentries: function(sentry_requirement) {
return addon.get_non_sentries(this.instanceID, sentry_requirement);
return binding.get_non_sentries(this.instanceID, sentry_requirement);
},
existsLink: function(source, target) {
return addon.exist_link(this.instanceID, source, target);
return binding.exist_link(this.instanceID, source, target);
},
setMaxCert: function(maxCert) {
return addon.set_max_links(this.instanceID, maxCert);
return binding.set_max_links(this.instanceID, maxCert);
},
addNode: function() {
var result = addon.add_node(this.instanceID);
var result = binding.add_node(this.instanceID);
if (this.filePath.length > 0) {
this.write();
}
......@@ -99,7 +100,7 @@ const WotB = {
},
removeNode: function() {
var result = addon.rem_node(this.instanceID);
var result = binding.rem_node(this.instanceID);
if (this.filePath.length > 0) {
this.write();
}
......@@ -107,7 +108,7 @@ const WotB = {
},
setEnabled: function(is_enabled, nodeId) {
var result = addon.set_enabled(this.instanceID, is_enabled, nodeId);
var result = binding.set_enabled(this.instanceID, is_enabled, nodeId);
if (this.filePath.length > 0) {
this.write();
}
......@@ -115,7 +116,7 @@ const WotB = {
},
addLink: function(source, target) {
var result = addon.add_link(this.instanceID, source, target);
var result = binding.add_link(this.instanceID, source, target);
if (this.filePath.length > 0) {
this.write();
}
......@@ -123,7 +124,7 @@ const WotB = {
},
removeLink: function(source, target) {
var result = addon.rem_link(this.instanceID, source, target);
var result = binding.rem_link(this.instanceID, source, target);
if (this.filePath.length > 0) {
this.write();
}
......@@ -131,12 +132,12 @@ const WotB = {
},
isOutdistanced: function(node, sentry_requirement, step_max, x_percent) {
var distance_result = addon.compute_distance(this.instanceID, node, sentry_requirement, step_max, x_percent);
var distance_result = binding.compute_distance(this.instanceID, node, sentry_requirement, step_max, x_percent);
return distance_result.outdistanced;
},
detailedDistance: function(node, sentry_requirement, step_max, x_percent) {
var distance_result = addon.compute_distance(this.instanceID, node, sentry_requirement, step_max, x_percent);
var distance_result = binding.compute_distance(this.instanceID, node, sentry_requirement, step_max, x_percent);
return {
nbReached: distance_result.reached,
nbSuccess: distance_result.success,
......@@ -146,21 +147,21 @@ const WotB = {
},
detailedDistanceV2: function(node, sentry_requirement, step_max, x_percent) {
return addon.compute_distance(this.instanceID, node, sentry_requirement, step_max, x_percent);
return binding.compute_distance(this.instanceID, node, sentry_requirement, step_max, x_percent);
},
getPaths: function(from, to, step_max) {
return addon.find_paths(this.instanceID, from, to, step_max);
return binding.find_paths(this.instanceID, from, to, step_max);
},
clear: function() {
return addon.remove_wot(this.instanceID);
return binding.remove_wot(this.instanceID);
},
resetWoT: function() {
var sigStock = addon.getMaxCert(this.instanceID);
addon.remove_wot(this.instanceID);
this.instanceID = addon.new_memory_instance(sigStock);
var sigStock = binding.getMaxCert(this.instanceID);
binding.remove_wot(this.instanceID);
this.instanceID = binding.new_memory_instance(sigStock);
if (filePath.length > 0) {
this.write();
}
......
{
"name": "wotb-rs",
"version": "0.1.1",
"version": "0.1.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "wotb-rs",
"version": "0.1.1",
"version": "0.1.2",
"description": "Makes Web of Trust computations for the Duniter project.",
"main": "lib/index.js",
"repository": {
......@@ -10,7 +10,7 @@
"author": "librelois <elois@ifee.fr>",
"license": "AGPL-3.0",
"engines": {
"node": ">=9.4.0",
"node": ">=8.11.1",
"npm": ">=5.6.0"
},
"dependencies": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment