Bug Fix
This commit is contained in:
parent
feecb47cc3
commit
eceb276354
20
index.html
20
index.html
@ -5247,7 +5247,7 @@
|
|||||||
sendData: function (data, floID) {
|
sendData: function (data, floID) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.kBucket.determineClosestSupernode(floID).then(result => {
|
this.kBucket.determineClosestSupernode(floID).then(result => {
|
||||||
var websocket = new WebSocket("ws://" + floGlobals.supernodes[result[0].floID].uri + "/ws");
|
var websocket = new WebSocket("wss://" + floGlobals.supernodes[result[0].floID].uri + "/ws");
|
||||||
websocket.onopen = (evt) => {
|
websocket.onopen = (evt) => {
|
||||||
websocket.send(data);
|
websocket.send(data);
|
||||||
resolve(`Data sent to ${floID}'s supernode`);
|
resolve(`Data sent to ${floID}'s supernode`);
|
||||||
@ -5266,7 +5266,7 @@
|
|||||||
requestData: function (request, floID) {
|
requestData: function (request, floID) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.kBucket.determineClosestSupernode(floID).then(result => {
|
this.kBucket.determineClosestSupernode(floID).then(result => {
|
||||||
var websocket = new WebSocket("ws://" + floGlobals.supernodes[result[0].floID].uri + "/ws");
|
var websocket = new WebSocket("wss://" + floGlobals.supernodes[result[0].floID].uri + "/ws");
|
||||||
websocket.onopen = (evt) => {
|
websocket.onopen = (evt) => {
|
||||||
websocket.send(`?${request}`);
|
websocket.send(`?${request}`);
|
||||||
};
|
};
|
||||||
@ -5290,7 +5290,7 @@
|
|||||||
initSupernode: function (pwd, floID) {
|
initSupernode: function (pwd, floID) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
this.supernodeClientWS = new WebSocket("ws://" + floGlobals.supernodes[floID].uri + "/ws");
|
this.supernodeClientWS = new WebSocket("wss://" + floGlobals.supernodes[floID].uri + "/ws");
|
||||||
this.supernodeClientWS.onopen = (evt) => {
|
this.supernodeClientWS.onopen = (evt) => {
|
||||||
this.supernodeClientWS.send("$" + pwd);
|
this.supernodeClientWS.send("$" + pwd);
|
||||||
reactor.dispatchEvent('supernode_open', evt);
|
reactor.dispatchEvent('supernode_open', evt);
|
||||||
@ -5354,13 +5354,13 @@
|
|||||||
console.log('Request :', request);
|
console.log('Request :', request);
|
||||||
try {
|
try {
|
||||||
request = request.split(" ");
|
request = request.split(" ");
|
||||||
if (floGlobals.storageList.include(request[1]))
|
if (floGlobals.storageList.includes(request[1]))
|
||||||
compactIDB.searchData(request[1], (k, v) => { return (v.receiverID == request[2]) })
|
compactIDB.searchData(request[1], (k, v) => { return (v.receiverID == request[2]) })
|
||||||
.then(result => floSupernode.supernodeClientWS.send(request[0] + JSON.stringify(result)))
|
.then(result => floSupernode.supernodeClientWS.send(`${request[0]} ${JSON.stringify(result)}`))
|
||||||
.catch(error => console.log(error))
|
.catch(error => console.log(error))
|
||||||
else
|
else
|
||||||
compactIDB.searchData(floGlobals.defaultStorage, (k, v) => { return (v.application == request[1] && v.receiverID == request[2]) })
|
compactIDB.searchData(floGlobals.defaultStorage, (k, v) => { return (v.application == request[1] && v.receiverID == request[2]) })
|
||||||
.then(result => floSupernode.supernodeClientWS.send(request[0] + JSON.stringify(result)))
|
.then(result => floSupernode.supernodeClientWS.send(`${request[0]} ${JSON.stringify(result)}`))
|
||||||
.catch(error => console.log(error))
|
.catch(error => console.log(error))
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -5379,8 +5379,8 @@
|
|||||||
if (result[0].floID != myFloID)
|
if (result[0].floID != myFloID)
|
||||||
return;
|
return;
|
||||||
if (data.senderID == floCrypto.getFloIDfromPubkeyHex(data.pubKey) && floCrypto.verifySign(
|
if (data.senderID == floCrypto.getFloIDfromPubkeyHex(data.pubKey) && floCrypto.verifySign(
|
||||||
JSON.stringify(data.data), data.sign, data.pubKey)) {
|
JSON.stringify(data.message), data.sign, data.pubKey)) {
|
||||||
if (floGlobals.storageList.include(data.application))
|
if (floGlobals.storageList.includes(data.application))
|
||||||
var table = data.application;
|
var table = data.application;
|
||||||
else
|
else
|
||||||
var table = floGlobals.defaultStorage;
|
var table = floGlobals.defaultStorage;
|
||||||
@ -6024,8 +6024,8 @@
|
|||||||
return new Promise((resolve,reject) => {
|
return new Promise((resolve,reject) => {
|
||||||
compactIDB.readData("lastTx",floGlobals.adminID).then(lastTx => {
|
compactIDB.readData("lastTx",floGlobals.adminID).then(lastTx => {
|
||||||
floBlockchainAPI.readData(floGlobals.adminID,{ignoreOld:lastTx,sendOnly:true,pattern:"SuperNodeStorage"}).then(result => {
|
floBlockchainAPI.readData(floGlobals.adminID,{ignoreOld:lastTx,sendOnly:true,pattern:"SuperNodeStorage"}).then(result => {
|
||||||
for(var i=result.length-1;i>=0;i--){
|
for(var i=result.data.length-1;i>=0;i--){
|
||||||
var content = JSON.parse(result[i]).SuperNodeStorage;
|
var content = JSON.parse(result.data[i]).SuperNodeStorage;
|
||||||
for(sn in content.removeNodes)
|
for(sn in content.removeNodes)
|
||||||
compactIDB.removeData("supernodes",sn);
|
compactIDB.removeData("supernodes",sn);
|
||||||
for(sn in content.addNodes)
|
for(sn in content.addNodes)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user