diff --git a/index.html b/index.html
index a212443..034fa33 100644
--- a/index.html
+++ b/index.html
@@ -4,1534 +4,7 @@
Local Bitcoin++
-
+
@@ -2176,15 +649,15 @@
Admin panel
-
Admin Config
+ Master Configs
+ Alert All Supernodes of New Master Configs
+
Re-allocate Users by Supernodes
- Extra Option
-
@@ -14551,7 +13024,7 @@
}
},
- request_user_data_reallocation: function() {
+ reset_master_configs: function(data_subject) {
try {
let sendExportRequest = confirm(`Are you sure? User export should
be carried out only on addition of new Supernodes.`);
@@ -14559,8 +13032,8 @@
if(sendExportRequest===true) {
const msg_obj = {};
msg_obj.protocol = '__ALL_SUPERNODES_MSG__';
- msg_obj.event = 'initialize_user_data_reallocation';
- msg_obj.data = { request: "REALLOCATTION_OF_USER_DATA" };
+ msg_obj.event = 'reset_master_configs_request';
+ msg_obj.data = { request: data_subject };
msg_obj.initialSender = localbitcoinplusplus.wallets.my_local_flo_address;
msg_obj.su_pubKey = localbitcoinplusplus.wallets.my_local_flo_public_key;
msg_obj.hash = Crypto.SHA256(msg_obj);
@@ -23736,10 +22209,112 @@
const adminPanelBtn = document.getElementById('admin_panel_btn');
const user_reallocation_btn = document.getElementById('reallocate_user_btn');
user_reallocation_btn.onclick = function() {
- localbitcoinplusplus.actions.request_user_data_reallocation();
+ let ask_perms = confirm('ALERT: This will init user export process. Continue?');
+ if(ask_perms!==true) return;
+ localbitcoinplusplus.actions.reset_master_configs('REALLOCATTION_OF_USER_DATA');
}
adminPanelBtn.classList.remove('hide-completely');
- document.getElementById('user_type').textContent = 'Admin'
+ document.getElementById('user_type').textContent = 'Admin';
+
+ // Check new settings
+ const check_new_config = document.getElementById('check_new_config');
+ check_new_config.onclick = function() {
+ try {
+ let sample_localbitcoinplusplus = JSON.parse(JSON.stringify(localbitcoinplusplus))
+ const admin_config = document.getElementById('admin_config');
+ let RMAssets = removeWhiteSpaces(admin_config.value);
+ let floAssetsArray = RMAssets.split("#!#");
+
+ if (
+ floAssetsArray.length > 0 &&
+ typeof floAssetsArray[0] !== undefined &&
+ floAssetsArray[0].trim() !== "" &&
+ typeof floAssetsArray[1] !== undefined &&
+ floAssetsArray[1].trim() !== ""
+ ) {
+ floAssetsArray.map(function(assets_string) {
+ let k = assets_string.split("=");
+
+ if (k[1].indexOf(",") > 0 && k[1].indexOf("{") == -1) {
+ k[1] = k[1]
+ .split(",")
+ .map(val =>
+ !isNaN(val) ? parseFloat(val) : val.trim()
+ )
+ .filter(v => ![null, "", undefined, NaN].includes(v));
+ } else if (!isNaN(k[1])) {
+ k[1] = parseFloat(k[1]);
+ }
+ if (typeof k[1] == "string" && k[1].indexOf("{") >= 0) {
+ k[1] = JSON.parse(k[1].replace(/ /g, ""));
+ }
+
+ return Object.defineProperty(
+ sample_localbitcoinplusplus.master_configurations,
+ k[0],
+ {
+ value: k[1],
+ writable: false,
+ configurable: false,
+ enumerable: true
+ }
+ );
+ });
+ return console.log(sample_localbitcoinplusplus);
+ }
+ } catch(e) {
+ console.error(e);
+ }
+ }
+
+ const set_new_config = document.getElementById('set_new_config');
+ set_new_config.onclick = async function() {
+ try {
+ const ask_conf = confirm('Have you tested these configs?');
+ if(ask_conf!==true) return;
+ let admin_config_txt = document.getElementById('admin_config');
+ let admin_config = removeWhiteSpaces(admin_config_txt.value)
+ let idxes = getPositionsOf(admin_config, /#!#/g);
+
+ let len_counter = 900;
+ let pos = 0;
+ for(let i=0; i<=idxes["#!#"].length; i++) {
+ let idx = idxes["#!#"][i];
+ if(i==idxes["#!#"].length) {
+ sliced_txt = txt.slice(pos, idxes["#!#"][i]);
+ console.log(sliced_txt);
+ }
+ if(idxm.data.id);
let idx = sk_id.indexOf(localbitcoinplusplus.wallets.my_local_flo_address);
if(idx<0) throw new Error('Negative index in Supernode Kbucket array.');
+ console.log("REALLOCATTION_OF_USER_DATA");
+ showMessage('User data re-allocation to start in '+Math.floor(idx*wait_time.exportdelay/60000)+' mins.');
// Delay process a/c to Supernode rank
await localbitcoinplusplus.actions.delay(idx*wait_time.exportdelay);
await localbitcoinplusplus.actions.exportUserDataFromOneSupernodeToAnother(