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) {
|
||||
return new Promise((resolve, reject) => {
|
||||
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.send(data);
|
||||
resolve(`Data sent to ${floID}'s supernode`);
|
||||
@ -5266,7 +5266,7 @@
|
||||
requestData: function (request, floID) {
|
||||
return new Promise((resolve, reject) => {
|
||||
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.send(`?${request}`);
|
||||
};
|
||||
@ -5290,7 +5290,7 @@
|
||||
initSupernode: function (pwd, floID) {
|
||||
return new Promise((resolve, reject) => {
|
||||
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.send("$" + pwd);
|
||||
reactor.dispatchEvent('supernode_open', evt);
|
||||
@ -5354,13 +5354,13 @@
|
||||
console.log('Request :', request);
|
||||
try {
|
||||
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]) })
|
||||
.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))
|
||||
else
|
||||
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) {
|
||||
@ -5379,8 +5379,8 @@
|
||||
if (result[0].floID != myFloID)
|
||||
return;
|
||||
if (data.senderID == floCrypto.getFloIDfromPubkeyHex(data.pubKey) && floCrypto.verifySign(
|
||||
JSON.stringify(data.data), data.sign, data.pubKey)) {
|
||||
if (floGlobals.storageList.include(data.application))
|
||||
JSON.stringify(data.message), data.sign, data.pubKey)) {
|
||||
if (floGlobals.storageList.includes(data.application))
|
||||
var table = data.application;
|
||||
else
|
||||
var table = floGlobals.defaultStorage;
|
||||
@ -6024,8 +6024,8 @@
|
||||
return new Promise((resolve,reject) => {
|
||||
compactIDB.readData("lastTx",floGlobals.adminID).then(lastTx => {
|
||||
floBlockchainAPI.readData(floGlobals.adminID,{ignoreOld:lastTx,sendOnly:true,pattern:"SuperNodeStorage"}).then(result => {
|
||||
for(var i=result.length-1;i>=0;i--){
|
||||
var content = JSON.parse(result[i]).SuperNodeStorage;
|
||||
for(var i=result.data.length-1;i>=0;i--){
|
||||
var content = JSON.parse(result.data[i]).SuperNodeStorage;
|
||||
for(sn in content.removeNodes)
|
||||
compactIDB.removeData("supernodes",sn);
|
||||
for(sn in content.addNodes)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user