Beautify the scripts
This commit is contained in:
parent
3d0c8883b7
commit
0a6fb69349
@ -13,7 +13,9 @@
|
||||
|
||||
//Required for blockchain API operators
|
||||
apiURL: {
|
||||
FLO: ['https://explorer.mediciland.com/', 'https://livenet.flocha.in/', 'https://flosight.duckdns.org/', 'http://livenet-explorer.floexperiments.com/'],
|
||||
FLO: ['https://explorer.mediciland.com/', 'https://livenet.flocha.in/', 'https://flosight.duckdns.org/',
|
||||
'http://livenet-explorer.floexperiments.com/'
|
||||
],
|
||||
FLO_TEST: ['https://testnet-flosight.duckdns.org/', 'https://testnet.flocha.in/']
|
||||
},
|
||||
adminID: "FKAEdnPfjXLHSYwrXQu377ugN4tXU7VGdf",
|
||||
@ -7091,7 +7093,8 @@ Bitcoin.Util = {
|
||||
|
||||
deriveSharedKeyReceiver: function (senderPublicKeyString, receiverPrivateKey) {
|
||||
try {
|
||||
return ellipticCurveEncryption.receiverSharedKeyDerivation(senderPublicKeyString.XValuePublicString,
|
||||
return ellipticCurveEncryption.receiverSharedKeyDerivation(senderPublicKeyString
|
||||
.XValuePublicString,
|
||||
senderPublicKeyString.YValuePublicString, receiverPrivateKey);
|
||||
|
||||
} catch (error) {
|
||||
@ -7128,7 +7131,8 @@ Bitcoin.Util = {
|
||||
if (alphaNumeric)
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
else
|
||||
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_+-./*?@#&$<>=[]{}():';
|
||||
var characters =
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_+-./*?@#&$<>=[]{}():';
|
||||
for (var i = 0; i < length; i++)
|
||||
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
||||
return result;
|
||||
@ -7137,7 +7141,8 @@ Bitcoin.Util = {
|
||||
//Encrypt Data using public-key
|
||||
encryptData: function (data, receiverCompressedPublicKey) {
|
||||
var senderECKeyData = this.util.getSenderPublicKeyString();
|
||||
var senderDerivedKey = this.util.deriveSharedKeySender(receiverCompressedPublicKey, senderECKeyData.privateKey);
|
||||
var senderDerivedKey = this.util.deriveSharedKeySender(receiverCompressedPublicKey, senderECKeyData
|
||||
.privateKey);
|
||||
let senderKey = senderDerivedKey.XValue + senderDerivedKey.YValue;
|
||||
let secret = Crypto.AES.encrypt(data, senderKey);
|
||||
return {
|
||||
@ -7156,7 +7161,8 @@ Bitcoin.Util = {
|
||||
"Failed to detremine your private key.");
|
||||
receiverECKeyData.privateKey = privateKey.privateKeyDecimal;
|
||||
|
||||
var receiverDerivedKey = this.util.deriveReceiverSharedKey(data.senderPublicKeyString, receiverECKeyData
|
||||
var receiverDerivedKey = this.util.deriveReceiverSharedKey(data.senderPublicKeyString,
|
||||
receiverECKeyData
|
||||
.privateKey);
|
||||
|
||||
let receiverKey = receiverDerivedKey.XValue + receiverDerivedKey.YValue;
|
||||
@ -7381,7 +7387,8 @@ Bitcoin.Util = {
|
||||
for (var i = utxos.length - 1;
|
||||
(i >= 0) && (utxoAmt < sendAmt + fee); i--) {
|
||||
if (utxos[i].confirmations) {
|
||||
trx.addinput(utxos[i].txid, utxos[i].vout, utxos[i].scriptPubKey)
|
||||
trx.addinput(utxos[i].txid, utxos[i].vout, utxos[i]
|
||||
.scriptPubKey)
|
||||
utxoAmt += utxos[i].amount;
|
||||
} else break;
|
||||
}
|
||||
@ -7462,22 +7469,32 @@ Bitcoin.Util = {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.promisedAPI(`api/addrs/${addr}/txs?from=0&to=1`).then(response => {
|
||||
var newItems = response.totalItems - options.ignoreOld;
|
||||
this.promisedAPI(`api/addrs/${addr}/txs?from=0&to=${newItems*2}`).then(response => {
|
||||
this.promisedAPI(`api/addrs/${addr}/txs?from=0&to=${newItems*2}`).then(
|
||||
response => {
|
||||
if (options.limit <= 0)
|
||||
options.limit = response.items.length;
|
||||
var filteredData = [];
|
||||
for (i = 0; i < (response.totalItems - options.ignoreOld) && filteredData.length < options.limit; i++){
|
||||
if(options.sentOnly && response.items[i].vin[0].addr !== addr)
|
||||
for (i = 0; i < (response.totalItems - options.ignoreOld) &&
|
||||
filteredData.length < options.limit; i++) {
|
||||
if (options.sentOnly && response.items[i].vin[0].addr !==
|
||||
addr)
|
||||
continue;
|
||||
if(options.pattern && !response.items[i].floData.startsWith(options.pattern, 0) && !response.items[i].floData.startsWith(options.pattern, 2))
|
||||
if (options.pattern && !response.items[i].floData
|
||||
.startsWith(options.pattern, 0) && !response.items[i]
|
||||
.floData.startsWith(options.pattern, 2))
|
||||
continue;
|
||||
if(options.contains && !response.items[i].floData.includes(options.contains))
|
||||
if (options.contains && !response.items[i].floData.includes(
|
||||
options.contains))
|
||||
continue;
|
||||
if(options.filter && !options.filter(response.items[i].floData))
|
||||
if (options.filter && !options.filter(response.items[i]
|
||||
.floData))
|
||||
continue;
|
||||
filteredData.push(response.items[i].floData);
|
||||
}
|
||||
resolve({totalTxs:response.totalItems , data:filteredData});
|
||||
resolve({
|
||||
totalTxs: response.totalItems,
|
||||
data: filteredData
|
||||
});
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
});
|
||||
@ -7508,7 +7525,8 @@ Bitcoin.Util = {
|
||||
const nodeIdNewInt8Array = new Uint8Array(nodeIdBytes);
|
||||
return nodeIdNewInt8Array;
|
||||
},
|
||||
launch: function (superNodeList = Object.keys(floGlobals.supernodes), master_floID = floGlobals.adminID) {
|
||||
launch: function (superNodeList = Object.keys(floGlobals.supernodes), master_floID = floGlobals
|
||||
.adminID) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
const SuKBucketId = this.floIdToKbucketId(master_floID);
|
||||
@ -8123,7 +8141,6 @@ Bitcoin.Util = {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<script id="compactIDB">
|
||||
/* Compact IndexedDB operations */
|
||||
@ -8151,15 +8168,18 @@ Bitcoin.Util = {
|
||||
idb.onupgradeneeded = (event) => {
|
||||
var db = event.target.result;
|
||||
for (obs in objectStores) {
|
||||
var objectStore = db.createObjectStore(obs, objectStores[obs].options || {});
|
||||
if (objectStores[obs].indexes && typeof objectStores[obs].indexes === 'object')
|
||||
var objectStore = db.createObjectStore(obs, objectStores[obs].options ||
|
||||
{});
|
||||
if (objectStores[obs].indexes && typeof objectStores[obs].indexes ===
|
||||
'object')
|
||||
for (i in objectStores[obs].indexes)
|
||||
objectStore.createIndex(i, i, objectStores[obs].indexes[i] || {});
|
||||
}
|
||||
}
|
||||
idb.onsuccess = (event) => {
|
||||
var db = event.target.result;
|
||||
if (JSON.stringify(Object.values(db.objectStoreNames).sort()) === JSON.stringify(Object.keys(
|
||||
if (JSON.stringify(Object.values(db.objectStoreNames).sort()) === JSON
|
||||
.stringify(Object.keys(
|
||||
objectStores).sort()))
|
||||
resolve("Initiated IndexedDB");
|
||||
else
|
||||
@ -8192,7 +8212,8 @@ Bitcoin.Util = {
|
||||
let writeReq = (key ? obs.put(data, key) : obs.put(data));
|
||||
writeReq.onsuccess = (evt) => resolve(`Write data Successful`);
|
||||
writeReq.onerror = (evt) => reject(
|
||||
`Write data unsuccessful [${evt.target.error.name}] ${evt.target.error.message}`);
|
||||
`Write data unsuccessful [${evt.target.error.name}] ${evt.target.error.message}`
|
||||
);
|
||||
db.close();
|
||||
}).catch(error => reject(error));
|
||||
});
|
||||
@ -8205,7 +8226,8 @@ Bitcoin.Util = {
|
||||
let addReq = (key ? obs.add(data, key) : obs.add(data));
|
||||
addReq.onsuccess = (evt) => resolve(`Add data successful`);
|
||||
addReq.onerror = (evt) => reject(
|
||||
`Add data unsuccessful [${evt.target.error.name}] ${evt.target.error.message}`);
|
||||
`Add data unsuccessful [${evt.target.error.name}] ${evt.target.error.message}`
|
||||
);
|
||||
db.close();
|
||||
}).catch(error => reject(error));
|
||||
});
|
||||
@ -8218,7 +8240,8 @@ Bitcoin.Util = {
|
||||
let delReq = obs.delete(key);
|
||||
delReq.onsuccess = (evt) => resolve(`Removed Data ${key}`);
|
||||
delReq.onerror = (evt) => reject(
|
||||
`Remove data unsuccessful [${evt.target.error.name}] ${evt.target.error.message}`);
|
||||
`Remove data unsuccessful [${evt.target.error.name}] ${evt.target.error.message}`
|
||||
);
|
||||
db.close();
|
||||
}).catch(error => reject(error));
|
||||
});
|
||||
@ -8231,7 +8254,8 @@ Bitcoin.Util = {
|
||||
let getReq = obs.get(key);
|
||||
getReq.onsuccess = (evt) => resolve(evt.target.result);
|
||||
getReq.onerror = (evt) => reject(
|
||||
`Read data unsuccessful [${evt.target.error.name}] ${evt.target.error.message}`);
|
||||
`Read data unsuccessful [${evt.target.error.name}] ${evt.target.error.message}`
|
||||
);
|
||||
db.close();
|
||||
}).catch(error => reject(error));
|
||||
});
|
||||
@ -8252,7 +8276,8 @@ Bitcoin.Util = {
|
||||
resolve(tmpResult);
|
||||
}
|
||||
curReq.onerror = (evt) => reject(
|
||||
`Read-All data unsuccessful [${evt.target.error.name}] ${evt.target.error.message}`);
|
||||
`Read-All data unsuccessful [${evt.target.error.name}] ${evt.target.error.message}`
|
||||
);
|
||||
db.close();
|
||||
}).catch(error => reject(error));
|
||||
});
|
||||
@ -8274,7 +8299,8 @@ Bitcoin.Util = {
|
||||
resolve(filteredResult);
|
||||
}
|
||||
curReq.onerror = (evt) => reject(
|
||||
`Search unsuccessful [${evt.target.error.name}] ${evt.target.error.message}`);
|
||||
`Search unsuccessful [${evt.target.error.name}] ${evt.target.error.message}`
|
||||
);
|
||||
db.close();
|
||||
}).catch(error => reject(error));
|
||||
});
|
||||
@ -8298,7 +8324,8 @@ Bitcoin.Util = {
|
||||
if (message.reset) {
|
||||
floGlobals.appObjects[message.object] = message.reset
|
||||
floGlobals.vectorClock[message.object] = vc
|
||||
compactIDB.writeData("appObjects", floGlobals.appObjects[message.object], message.object)
|
||||
compactIDB.writeData("appObjects", floGlobals.appObjects[message.object], message
|
||||
.object)
|
||||
compactIDB.writeData("vectorClock", vc, message.object)
|
||||
}
|
||||
}
|
||||
@ -8314,8 +8341,10 @@ Bitcoin.Util = {
|
||||
for (vc in dataSet) {
|
||||
var message = dataSet[vc].message;
|
||||
if (message.diff) {
|
||||
floGlobals.appObjects[message.object] = mergeDifference(floGlobals.appObjects[message.object], message.diff)
|
||||
compactIDB.writeData("appObjects",floGlobals.appObjects[message.object], message.object)
|
||||
floGlobals.appObjects[message.object] = mergeDifference(floGlobals.appObjects[
|
||||
message.object], message.diff)
|
||||
compactIDB.writeData("appObjects", floGlobals.appObjects[message.object], message
|
||||
.object)
|
||||
}
|
||||
floGlobals.vectorClock[message.object] = vc
|
||||
compactIDB.writeData("vectorClock", vc, message.object)
|
||||
@ -8332,7 +8361,11 @@ Bitcoin.Util = {
|
||||
if (!Array.isArray(floGlobals.generalData[filterStr]))
|
||||
floGlobals.generalData[filterStr] = []
|
||||
for (vc in dataSet) {
|
||||
floGlobals.generalData[filterStr].push({sender: dataSet[vc].senderID, vectorClock: vc, message: dataSet[vc].message})
|
||||
floGlobals.generalData[filterStr].push({
|
||||
sender: dataSet[vc].senderID,
|
||||
vectorClock: vc,
|
||||
message: dataSet[vc].message
|
||||
})
|
||||
compactIDB.writeData("generalData", floGlobals.generalData[filterStr], filterStr)
|
||||
floGlobals.generalVC[filterStr] = vc
|
||||
compactIDB.writeData("generalVC", vc, filterStr)
|
||||
@ -8394,9 +8427,14 @@ Bitcoin.Util = {
|
||||
//request General Data
|
||||
requestGeneralData: function (type, options = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var filterStr = JSON.stringify({application: options.application || floGlobals.application, type: type, comment: options.comment})
|
||||
var filterStr = JSON.stringify({
|
||||
application: options.application || floGlobals.application,
|
||||
type: type,
|
||||
comment: options.comment
|
||||
})
|
||||
options.type = type
|
||||
options.lowerVectorClock = options.lowerVectorClock || floGlobals.generalVC[filterStr] + 1
|
||||
options.lowerVectorClock = options.lowerVectorClock || floGlobals.generalVC[filterStr] +
|
||||
1
|
||||
this.requestApplicationData(options).then(dataSet => {
|
||||
this.util.storeGeneralData(filterStr, dataSet)
|
||||
resolve('General Data Updated')
|
||||
@ -8409,7 +8447,8 @@ Bitcoin.Util = {
|
||||
return new Promise((resolve, reject) => {
|
||||
var request = {
|
||||
receiverID: options.receiverID || floGlobals.adminID,
|
||||
senderIDs: (options.senderIDs === false) ? false: options.senderIDs || floGlobals.subAdmins,
|
||||
senderIDs: (options.senderIDs === false) ? false : options.senderIDs ||
|
||||
floGlobals.subAdmins,
|
||||
application: options.application || floGlobals.application,
|
||||
comment: options.comment,
|
||||
type: `${objectName}@Reset`,
|
||||
@ -8421,9 +8460,11 @@ Bitcoin.Util = {
|
||||
request.type = `${objectName}@Update`
|
||||
request.lowerVectorClock = floGlobals.vectorClock[objectName] + 1
|
||||
request.mostRecent = false
|
||||
floSupernode.requestData(JSON.stringify(request), request.receiverID).then(dataSet => {
|
||||
floSupernode.requestData(JSON.stringify(request), request.receiverID).then(
|
||||
dataSet => {
|
||||
this.util.updateData(dataSet)
|
||||
this.util.lastCommit[objectName] = JSON.stringify(floGlobals.appObjects[objectName])
|
||||
this.util.lastCommit[objectName] = JSON.stringify(floGlobals
|
||||
.appObjects[objectName])
|
||||
resolve('Object Data Updated')
|
||||
}).catch(error => reject(error))
|
||||
}).catch(error => reject(error))
|
||||
@ -8440,7 +8481,8 @@ Bitcoin.Util = {
|
||||
reset: floGlobals.appObjects[objectName]
|
||||
}
|
||||
this.sendApplicationData(message, `${objectName}@Reset`, options).then(result => {
|
||||
this.util.lastCommit[objectName] = JSON.stringify(floGlobals.appObjects[objectName])
|
||||
this.util.lastCommit[objectName] = JSON.stringify(floGlobals.appObjects[
|
||||
objectName])
|
||||
resolve(result)
|
||||
}).catch(error => reject(error))
|
||||
})
|
||||
@ -8453,10 +8495,12 @@ Bitcoin.Util = {
|
||||
division: options.division || floGlobals.division,
|
||||
object: objectName,
|
||||
vectorClock: floGlobals.vectorClock[objectName],
|
||||
diff: findDifference(JSON.parse(this.util.lastCommit[objectName]), floGlobals.appObjects[objectName])
|
||||
diff: findDifference(JSON.parse(this.util.lastCommit[objectName]), floGlobals
|
||||
.appObjects[objectName])
|
||||
}
|
||||
this.sendApplicationData(message, `${objectName}@Update`, options).then(result => {
|
||||
this.util.lastCommit[objectName] = JSON.stringify(floGlobals.appObjects[objectName])
|
||||
this.util.lastCommit[objectName] = JSON.stringify(floGlobals.appObjects[
|
||||
objectName])
|
||||
resolve(result)
|
||||
}).catch(error => reject(error))
|
||||
})
|
||||
@ -8478,7 +8522,10 @@ Bitcoin.Util = {
|
||||
lastTx: {},
|
||||
//supernode (cloud list)
|
||||
supernodes: {
|
||||
indexes:{ uri:null, pubKey:null }
|
||||
indexes: {
|
||||
uri: null,
|
||||
pubKey: null
|
||||
}
|
||||
},
|
||||
//login credentials
|
||||
credentials: {},
|
||||
@ -8514,20 +8561,31 @@ Bitcoin.Util = {
|
||||
readSupernodeListFromAPI: function () {
|
||||
return new Promise((resolve, reject) => {
|
||||
compactIDB.readData("lastTx", floGlobals.SNStorageID).then(lastTx => {
|
||||
floBlockchainAPI.readData(floGlobals.SNStorageID,{ignoreOld:lastTx,sentOnly:true,pattern:"SuperNodeStorage"}).then(result => {
|
||||
floBlockchainAPI.readData(floGlobals.SNStorageID, {
|
||||
ignoreOld: lastTx,
|
||||
sentOnly: true,
|
||||
pattern: "SuperNodeStorage"
|
||||
}).then(result => {
|
||||
for (var i = result.data.length - 1; i >= 0; i--) {
|
||||
var content = JSON.parse(result.data[i]).SuperNodeStorage;
|
||||
var content = JSON.parse(result.data[i])
|
||||
.SuperNodeStorage;
|
||||
for (sn in content.removeNodes)
|
||||
compactIDB.removeData("supernodes", sn);
|
||||
for (sn in content.addNodes)
|
||||
compactIDB.writeData("supernodes",content.addNodes[sn],sn);
|
||||
compactIDB.writeData("supernodes", content
|
||||
.addNodes[sn], sn);
|
||||
}
|
||||
compactIDB.writeData("lastTx",result.totalTxs,floGlobals.SNStorageID);
|
||||
compactIDB.writeData("lastTx", result.totalTxs,
|
||||
floGlobals.SNStorageID);
|
||||
compactIDB.readAllData("supernodes").then(result => {
|
||||
floGlobals.supernodes = result;
|
||||
|
||||
floSupernode.kBucket.launch(Object.keys(floGlobals.supernodes),floGlobals.SNStorageID)
|
||||
.then(result => resolve("Loaded Supernode list\n"+result))
|
||||
floSupernode.kBucket.launch(Object.keys(
|
||||
floGlobals.supernodes),
|
||||
floGlobals.SNStorageID)
|
||||
.then(result => resolve(
|
||||
"Loaded Supernode list\n" +
|
||||
result))
|
||||
})
|
||||
})
|
||||
}).catch(error => reject(error))
|
||||
@ -8537,17 +8595,27 @@ Bitcoin.Util = {
|
||||
readSubAdminListFromAPI: function () {
|
||||
return new Promise((resolve, reject) => {
|
||||
compactIDB.readData("lastTx", floGlobals.adminID).then(lastTx => {
|
||||
floBlockchainAPI.readData(floGlobals.adminID,{ignoreOld:lastTx,sentOnly:true,pattern:floGlobals.application}).then(result => {
|
||||
floBlockchainAPI.readData(floGlobals.adminID, {
|
||||
ignoreOld: lastTx,
|
||||
sentOnly: true,
|
||||
pattern: floGlobals.application
|
||||
}).then(result => {
|
||||
for (var i = result.data.length - 1; i >= 0; i--) {
|
||||
var content = JSON.parse(result.data[i])[floGlobals.application];
|
||||
var content = JSON.parse(result.data[i])[floGlobals
|
||||
.application];
|
||||
if (Array.isArray(content.removeSubAdmin))
|
||||
for(var j = 0; j < content.removeSubAdmin.length; j++)
|
||||
compactIDB.removeData("subAdmins",content.removeSubAdmin[j]);
|
||||
for (var j = 0; j < content.removeSubAdmin
|
||||
.length; j++)
|
||||
compactIDB.removeData("subAdmins", content
|
||||
.removeSubAdmin[j]);
|
||||
if (Array.isArray(content.addSubAdmin))
|
||||
for(var k = 0; k < content.addSubAdmin.length; k++)
|
||||
compactIDB.writeData("subAdmins",true,content.addSubAdmin[k]);
|
||||
for (var k = 0; k < content.addSubAdmin
|
||||
.length; k++)
|
||||
compactIDB.writeData("subAdmins", true,
|
||||
content.addSubAdmin[k]);
|
||||
}
|
||||
compactIDB.writeData("lastTx",result.totalTxs,floGlobals.adminID);
|
||||
compactIDB.writeData("lastTx", result.totalTxs,
|
||||
floGlobals.adminID);
|
||||
compactIDB.readAllData("subAdmins").then(result => {
|
||||
floGlobals.subAdmins = Object.keys(result);
|
||||
resolve("Read subAdmins from blockchain");
|
||||
@ -8617,7 +8685,8 @@ Bitcoin.Util = {
|
||||
try {
|
||||
if (!result)
|
||||
return reject("Empty Private Key")
|
||||
var floID = floCrypto.getFloIDfromPubkeyHex(floCrypto.getPubKeyHex(result))
|
||||
var floID = floCrypto.getFloIDfromPubkeyHex(
|
||||
floCrypto.getPubKeyHex(result))
|
||||
privKey = result
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
@ -8628,13 +8697,22 @@ Bitcoin.Util = {
|
||||
privKey = floCrypto.generateNewID().privKey
|
||||
}).finally(_ => {
|
||||
var threshold = floCrypto.randInt(10, 20)
|
||||
writeSharesToIDB(floCrypto.createShamirsSecretShares(privKey, threshold, threshold)).then(resultIndexes =>{
|
||||
writeSharesToIDB(floCrypto.createShamirsSecretShares(
|
||||
privKey, threshold, threshold)).then(
|
||||
resultIndexes => {
|
||||
//store index keys in localStorage
|
||||
localStorage.setItem(`${floGlobals.application}#privKey`, JSON.stringify(resultIndexes))
|
||||
localStorage.setItem(
|
||||
`${floGlobals.application}#privKey`,
|
||||
JSON.stringify(resultIndexes))
|
||||
//also add a dummy privatekey to the IDB
|
||||
var randomPrivKey = floCrypto.generateNewID().privKey
|
||||
var randomThreshold = floCrypto.randInt(10,20)
|
||||
writeSharesToIDB(floCrypto.createShamirsSecretShares(randomPrivKey, randomThreshold, randomThreshold))
|
||||
var randomPrivKey = floCrypto
|
||||
.generateNewID().privKey
|
||||
var randomThreshold = floCrypto.randInt(10,
|
||||
20)
|
||||
writeSharesToIDB(floCrypto
|
||||
.createShamirsSecretShares(
|
||||
randomPrivKey, randomThreshold,
|
||||
randomThreshold))
|
||||
//resolve private Key
|
||||
resolve(privKey)
|
||||
}).catch(error => reject(error))
|
||||
@ -8659,18 +8737,26 @@ Bitcoin.Util = {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.startUpFunctions[fname]().then(result => {
|
||||
this.callStartUpFunction.completed += 1
|
||||
reactor.dispatchEvent("startUpSuccessLog",`${result}\nCompleted ${this.callStartUpFunction.completed}/${this.callStartUpFunction.total} Startup functions`)
|
||||
reactor.dispatchEvent("startUpSuccessLog",
|
||||
`${result}\nCompleted ${this.callStartUpFunction.completed}/${this.callStartUpFunction.total} Startup functions`
|
||||
)
|
||||
resolve(true)
|
||||
}).catch(error => {
|
||||
this.callStartUpFunction.failed += 1
|
||||
reactor.dispatchEvent("startUpErrorLog",`${error}\nFailed ${this.callStartUpFunction.failed}/${this.callStartUpFunction.total} Startup functions`)
|
||||
reactor.dispatchEvent("startUpErrorLog",
|
||||
`${error}\nFailed ${this.callStartUpFunction.failed}/${this.callStartUpFunction.total} Startup functions`
|
||||
)
|
||||
reject(false)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
getFilterString: function (type, options = {}) {
|
||||
var filterStr = JSON.stringify({application: options.application || floGlobals.application, type: type, comment: options.comment})
|
||||
var filterStr = JSON.stringify({
|
||||
application: options.application || floGlobals.application,
|
||||
type: type,
|
||||
comment: options.comment
|
||||
})
|
||||
return filterStr
|
||||
}
|
||||
},
|
||||
@ -8679,7 +8765,8 @@ Bitcoin.Util = {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.util.initIndexedDB().then(log => {
|
||||
console.log(log)
|
||||
this.util.callStartUpFunction.total = Object.keys(this.util.startUpFunctions).length
|
||||
this.util.callStartUpFunction.total = Object.keys(this.util
|
||||
.startUpFunctions).length
|
||||
this.util.callStartUpFunction.completed = 0
|
||||
this.util.callStartUpFunction.failed = 0
|
||||
var promises = []
|
||||
|
||||
Loading…
Reference in New Issue
Block a user