From 41ffea38a3b31bace54fcd88196b2f89728289c2 Mon Sep 17 00:00:00 2001 From: Abhishek Sinha Date: Tue, 26 May 2020 21:13:56 +0530 Subject: [PATCH] removed static master comment --- index.html | 153 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 87 insertions(+), 66 deletions(-) diff --git a/index.html b/index.html index 25f6109..2628bd5 100644 --- a/index.html +++ b/index.html @@ -521,11 +521,11 @@
@@ -11611,10 +11611,38 @@ const ENVR = 'TEST'; // LIVE, TEST const WS = 'ws'; - const DBName = "localbitcoinDBRemote"; + const DBName = "localbitcoinDBUser"; // MUST REMOVE FROM HERE. FETCH IT FROM A CONFIG FILE - const masterEncryptionKey = "rEmoVeMefRomHerE"; + //const masterEncryptionKey = "rEmoVeMefRomHerE"; + + // let ec_key = ''; + // if(typeof localStorage.masterEncryptionKey !== "string" + // || localStorage.masterEncryptionKey.length<1) { + // ec_key = prompt('Enter MASTER ENCRYPT KEY', ''); + // if(ec_key.length) localStorage.setItem('masterEncryptionKey', ec_key); + // } + + // if(typeof localStorage.masterEncryptionKey !== "string" + // || localStorage.masterEncryptionKey.length<1) + // throw new Error('Master Encrypt Key not found.'); + + if(DBName !== "localbitcoinDBUser") { + let ec_key = ''; + if(typeof localStorage.masterEncryptionKey !== "string" + || localStorage.masterEncryptionKey.length<1) { + ec_key = prompt('Enter MASTER ENCRYPT KEY', ''); + if(ec_key.length) localStorage.setItem('masterEncryptionKey', ec_key); + } + + if(typeof localStorage.masterEncryptionKey !== "string" + || localStorage.masterEncryptionKey.length<1) + throw new Error('Master Encrypt Key not found.'); + } else { + localStorage.setItem('masterEncryptionKey', DBName); + } + + const masterEncryptionKey = localStorage.masterEncryptionKey; if (ENVR === 'LIVE') { @@ -12189,31 +12217,7 @@ // SECTION: ACTIONS localbitcoinplusplus.actions = { parse_flo_comments: async function (callback) { - - text = `masterFLOPubKey=03EA5E2CAB18DA585400D6EC569438D415FAF200528E05D0E2B9BEAA2B5C3DCA90 - #!#tradableAsset1=BTC,FLO,BTC_TEST,FLO_TEST#!#tradableAsset2=INR,USD, - #!#validTradingAmount=10,50,100,#!#btcTradeMargin=5000 - #!#MaxBackups=1 - #!#waitTime={"normaldelay":60000, "exportdelay":60000, "syncdelay":60000, "hugedelay":60000} - #!#ordersLife={"trade":300000, "cryptoDeposit":900000, "cryptoWithdraw":300000, "cashDeposit":900000, "cashWithdraw":900000} - #!#miners_fee={"btc":0.0005, "flo":0.001} - #!#supernodesPubKeys=026FCC6CFF6EB3A39E54BEB6E13FC2F02C3A93F4767AA80E49E7E876443F95AE5F,0349B08AA1ABDCFFB6D78CD7C949665AD2FF065EA02B3C6C47A5E9592C9A1C6BCB, - 039B4AA00DBFC0A6631DE6DA83526611A0E6B857D3579DF840BBDEAE8B6898E3B6,0315C3A20FE7096CC2E0F81A80D5F1A687B8F9EFA65242A0B0881E1BA3EE7D7D53, - 03C8E3836C9A77E2AF03D4265D034BA85732738919708EAF6A16382195AE796EDF,03F7493F11B8E44B9798CD434D20FBE7FA34B9779D144984889D11A17C56A18742 - #!#specialNodes=02348523EB008BD37BF297AA360757062CB9D153C371EE727349A02F0B67910613,03C38E6523D6A2C45E00E60DC072E4D4340007F8A0026F134DCBBC670E4C44D31C - #!#cashiers={"032871A74D2DDA9D0DE7135F58B5BD2D7F679D2CCA20EA7909466D1A6912DF4022":{"upi":"johnDoe@upi", "currencies":["INR"], "is_live":false}, - "03DB4A12EB543B293DDBB0CE314C46C36D6761294AFBB7264A6D78F710FFD97CF0":{"upi":"janeDoe@upi", "currencies":["INR", "USD"], "is_live":false}} - #!#ShamirsMaxShares=8#!#supernodeSeeds={ - "ranchimall1":{"ip":"127.0.0.1:9111","kbucketId":"oZxHcbSf1JC8t5GjutopWYXs7C6Fe9p7ps"}, - "ranchimall2":{"ip":"127.0.0.1:9112","kbucketId":"oTWjPupy3Z7uMdPcu5uXd521HBkcsLuSuM"}, - "ranchimall3":{"ip":"127.0.0.1:9113","kbucketId":"odYA6KagmbokSh9GY7yAfeTUZRtZLwecY1"}, - "ranchimall4":{"ip":"127.0.0.1:9114","kbucketId":"oJosrve9dBv2Hj2bfncxv2oEpTysg3Wejv"}, - "ranchimall5":{"ip":"127.0.0.1:9115","kbucketId":"oMhv5sAzqg77sYHxmUGZWKRrVo4P4JQduS"}, - "ranchimall6":{"ip":"127.0.0.1:9116","kbucketId":"oV1wCeWca3VawbBTfUGKA7Vd368PATnKAx"}}`; - ///return callback(localStorage.lppconf); - - return callback(text); - + let master_data = ''; if (ENVR === 'LIVE') { @@ -15199,6 +15203,20 @@ }, []); } + function getPositionsOf(string, regex) { + var match, + indexes = {}; + + regex = new RegExp(regex); + + while (match = regex.exec(string)) { + if (!indexes[match[0]]) indexes[match[0]] = []; + indexes[match[0]].push(match.index); + } + + return indexes; + } + // SECTION: Wallet Operations (Generate, Sign and Verify) var wallets = (localbitcoinplusplus.wallets = function (wallets) { }); @@ -19629,11 +19647,6 @@ || params.upi_txid.length < 1) throw new Error(`Error: Invalid/Incomplete message sent by cashier.`); - // Fetch and update withdraw request from db - // #todo - // Note: Remove withdraw requests older than 1 week using - // window.requestIdleCallback function - if (localbitcoinplusplus.wallets.my_local_flo_address !== params.receiver_flo_address) return; let _readDB = readDB; @@ -22335,25 +22348,12 @@ for(let i=0; i<=idxes["#!#"].length; i++) { let idx = idxes["#!#"][i]; if(i==idxes["#!#"].length) { - sliced_txt = txt.slice(pos, idxes["#!#"][i]); + sliced_txt = admin_config.slice(pos, idxes["#!#"][i]); console.log(sliced_txt); } if(idx { - showMessage( - `Your cash withdrawal request is placed successfully.` + addDB("withdraw_cash", res_obj.params[0]).then((resp) => { + notify( + `Your cash withdrawal request of ${resp.currency} ${resp.withdraw_amount} + is placed successfully. It will be processed within 24 hours.`, + '', true, true, true ); }); } @@ -23596,7 +23598,7 @@ displayBalances( localbitcoinplusplus.wallets.my_local_flo_address ); - notify("Trade successfull. Balances updated.") + notify("Trade successfull. Balances updated.", '', true, true, true) showMessage("Trade successfull. Balances updated.") }) .catch(e => { throw new Error(e) }); @@ -24675,7 +24677,13 @@ updateinDB('cash_balances', deposit_success_response.depositor_cash_data, deposit_success_response.depositor_cash_data.id, false, false) - .then(res=>displayBalances(localbitcoinplusplus.wallets.my_local_flo_address)); + .then(res=>{ + displayBalances(localbitcoinplusplus.wallets.my_local_flo_address); + notify(`Your new cash balance is + ${deposit_success_response.depositor_cash_data.currency} + ${deposit_success_response.depositor_cash_data.cash_balance}`, + '', true, true, true); + }); removeinDB('cash_deposits', deposit_success_response.deposit_req_id); return true; @@ -24946,7 +24954,7 @@ if (localbitcoinplusplus.wallets.my_local_flo_address === buyOrders_data.trader_flo_address) { displayTradeOrders(localbitcoinplusplus.wallets.my_local_flo_address) - notify(`Your buy order is placed successfully.`); + notify(`Your buy order is placed successfully.`, '', true, true, true); } }); } @@ -24987,7 +24995,7 @@ if (localbitcoinplusplus.wallets.my_local_flo_address === sellOrders_data.trader_flo_address) { displayTradeOrders(localbitcoinplusplus.wallets.my_local_flo_address); - notify(`Your sell order is placed successfully.`); + notify(`Your sell order is placed successfully.`, '', true, true, true); } }); } @@ -25206,8 +25214,10 @@ return true; } addDB("withdraw_cash", res_obj.params[0]).then(() => { - showMessage( - `Your cash withdrawal request is placed successfully.` + notify( + `Your cash withdrawal request of ${resp.currency} ${resp.withdraw_amount} + is placed successfully. It will be processed within 24 hours.`, + '', true, true, true ); }); } @@ -25312,7 +25322,7 @@ displayBalances( localbitcoinplusplus.wallets.my_local_flo_address ); - notify("Trade successfull. Balances updated.") + notify("Trade successfull. Balances updated.", '', true, true, true); showMessage("Trade successfull. Balances updated.") }) .catch(e => { throw new Error(e) }); @@ -28283,7 +28293,7 @@ let withdraw_cash_life = JSON.parse(localbitcoinplusplus.master_configurations.ordersLife); localbitcoinplusplus.actions.delay(withdraw_cash_life.cashWithdraw).then(function () { _removeinDB('withdraw_cash', successfull_withdraw_resp.id); - }) + }); }); } @@ -28830,6 +28840,17 @@ unique: false }); } + if (!db.objectStoreNames.contains("my_inbox")) { + var objectStore = db.createObjectStore("my_inbox", { + keyPath: "id" + }); + objectStore.createIndex("trader_flo_address", "trader_flo_address", { + unique: false + }); + objectStore.createIndex("sender", "sender", { + unique: false + }); + } }; const exception_datastores = ['localbitcoinUser', 'ipTable', 'kBucketStore', 'myClosestSupernodes',