bug fix
This commit is contained in:
parent
0108e50c64
commit
2b34ce3047
@ -1,4 +1,4 @@
|
|||||||
(function(EXPORTS) { //floDapps v2.3.2d
|
(function (EXPORTS) { //floDapps v2.3.3
|
||||||
/* General functions for FLO Dapps*/
|
/* General functions for FLO Dapps*/
|
||||||
'use strict';
|
'use strict';
|
||||||
const floDapps = EXPORTS;
|
const floDapps = EXPORTS;
|
||||||
@ -181,6 +181,7 @@
|
|||||||
credentials: {},
|
credentials: {},
|
||||||
//for Dapps
|
//for Dapps
|
||||||
subAdmins: {},
|
subAdmins: {},
|
||||||
|
trustedIDs: {},
|
||||||
settings: {},
|
settings: {},
|
||||||
appObjects: {},
|
appObjects: {},
|
||||||
generalData: {},
|
generalData: {},
|
||||||
@ -244,6 +245,12 @@
|
|||||||
compactIDB.removeData("supernodes", sn, DEFAULT.root);
|
compactIDB.removeData("supernodes", sn, DEFAULT.root);
|
||||||
for (let sn in content.newNodes)
|
for (let sn in content.newNodes)
|
||||||
compactIDB.writeData("supernodes", content.newNodes[sn], sn, DEFAULT.root);
|
compactIDB.writeData("supernodes", content.newNodes[sn], sn, DEFAULT.root);
|
||||||
|
for (let sn in content.updateNodes)
|
||||||
|
compactIDB.readData("supernodes", sn, DEFAULT.root).then(r => {
|
||||||
|
r = r || {}
|
||||||
|
r.uri = content.updateNodes[sn];
|
||||||
|
compactIDB.writeData("supernodes", r, sn, DEFAULT.root);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
compactIDB.writeData("lastTx", result.totalTxs, floCloudAPI.SNStorageID, DEFAULT.root);
|
compactIDB.writeData("lastTx", result.totalTxs, floCloudAPI.SNStorageID, DEFAULT.root);
|
||||||
compactIDB.readAllData("supernodes", DEFAULT.root).then(nodes => {
|
compactIDB.readAllData("supernodes", DEFAULT.root).then(nodes => {
|
||||||
@ -274,6 +281,12 @@
|
|||||||
if (Array.isArray(content.addSubAdmin))
|
if (Array.isArray(content.addSubAdmin))
|
||||||
for (var k = 0; k < content.addSubAdmin.length; k++)
|
for (var k = 0; k < content.addSubAdmin.length; k++)
|
||||||
compactIDB.writeData("subAdmins", true, content.addSubAdmin[k]);
|
compactIDB.writeData("subAdmins", true, content.addSubAdmin[k]);
|
||||||
|
if (Array.isArray(content.removeTrustedID))
|
||||||
|
for (var j = 0; j < content.removeTrustedID.length; j++)
|
||||||
|
compactIDB.removeData("trustedIDs", content.removeTrustedID[j]);
|
||||||
|
if (Array.isArray(content.addTrustedID))
|
||||||
|
for (var k = 0; k < content.addTrustedID.length; k++)
|
||||||
|
compactIDB.writeData("trustedIDs", true, content.addTrustedID[k]);
|
||||||
if (content.settings)
|
if (content.settings)
|
||||||
for (let l in content.settings)
|
for (let l in content.settings)
|
||||||
compactIDB.writeData("settings", content.settings[l], l)
|
compactIDB.writeData("settings", content.settings[l], l)
|
||||||
@ -589,6 +602,28 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
floDapps.manageAppTrustedIDs = function (adminPrivKey, addList, rmList) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (!Array.isArray(addList) || !addList.length) addList = undefined;
|
||||||
|
if (!Array.isArray(rmList) || !rmList.length) rmList = undefined;
|
||||||
|
if (!addList && !rmList)
|
||||||
|
return reject("No change in list")
|
||||||
|
var floData = {
|
||||||
|
[DEFAULT.application]: {
|
||||||
|
addTrustedID: addList,
|
||||||
|
removeTrustedID: rmList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var floID = floCrypto.getFloID(adminPrivKey)
|
||||||
|
if (floID != DEFAULT.adminID)
|
||||||
|
reject('Access Denied for Admin privilege')
|
||||||
|
else
|
||||||
|
floBlockchainAPI.writeData(floID, JSON.stringify(floData), adminPrivKey)
|
||||||
|
.then(result => resolve(['Updated App Configuration', result]))
|
||||||
|
.catch(error => reject(error))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const clearCredentials = floDapps.clearCredentials = function () {
|
const clearCredentials = floDapps.clearCredentials = function () {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
compactIDB.clearData('credentials', DEFAULT.application).then(result => {
|
compactIDB.clearData('credentials', DEFAULT.application).then(result => {
|
||||||
|
|||||||
@ -87,7 +87,6 @@ function getFormattedTime(timestamp, format) {
|
|||||||
switch (format) {
|
switch (format) {
|
||||||
case 'date-only':
|
case 'date-only':
|
||||||
return `${month} ${date}, ${year}`;
|
return `${month} ${date}, ${year}`;
|
||||||
break;
|
|
||||||
case 'time-only':
|
case 'time-only':
|
||||||
return finalHours;
|
return finalHours;
|
||||||
case 'relative':
|
case 'relative':
|
||||||
@ -326,8 +325,9 @@ function formatAmount(amount = 0) {
|
|||||||
function fetchRibcData() {
|
function fetchRibcData() {
|
||||||
return floCloudAPI.requestObjectData("RIBC", {
|
return floCloudAPI.requestObjectData("RIBC", {
|
||||||
application: "InternManage",
|
application: "InternManage",
|
||||||
receiverID: "FMyRTrz9CG4TFNM6rCQgy3VQ5NF23bY2xD"
|
receiverID: "FMyRTrz9CG4TFNM6rCQgy3VQ5NF23bY2xD",
|
||||||
});
|
senderID: [ "FCja6sLv58e3RMy41T5AmWyvXEWesqBCkX", "FFS5hFXG7DBtdgzrLwixZLpenAmsCKRddm", "FS4jMAcSimRMrhoRhk5cjuJERS2otiwq4A" ],
|
||||||
|
})
|
||||||
}
|
}
|
||||||
function fetchTransactions() {
|
function fetchTransactions() {
|
||||||
return floTokenAPI.getAllTxs(floGlobals.payer)
|
return floTokenAPI.getAllTxs(floGlobals.payer)
|
||||||
@ -436,6 +436,7 @@ function getReceiverAddress(vout) {
|
|||||||
}
|
}
|
||||||
function main() {
|
function main() {
|
||||||
return Promise.all([fetchTransactions(), fetchRibcData()]).then(([txData]) => {
|
return Promise.all([fetchTransactions(), fetchRibcData()]).then(([txData]) => {
|
||||||
|
console.log(floGlobals.appObjects.RIBC.internList)
|
||||||
floGlobals.appObjects.RIBC.internList = {
|
floGlobals.appObjects.RIBC.internList = {
|
||||||
...floGlobals.appObjects.RIBC.internList,
|
...floGlobals.appObjects.RIBC.internList,
|
||||||
...oldInterns
|
...oldInterns
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user