sync: sync upstream code
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
a981ccbcae
commit
88bae3a4bd
@ -241,7 +241,7 @@ textarea {
|
|||||||
/* background: var(--blue-grey); */
|
/* background: var(--blue-grey); */
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
color: #fff;
|
color: #000;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
width: 55px;
|
width: 55px;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
@ -1858,7 +1858,7 @@ td.hash {
|
|||||||
width: 60px;
|
width: 60px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: rgba(255, 255, 255, 0.6);
|
color: #000;
|
||||||
}
|
}
|
||||||
.white-select {
|
.white-select {
|
||||||
display: block;
|
display: block;
|
||||||
@ -2773,7 +2773,7 @@ iframe
|
|||||||
.btn--float
|
.btn--float
|
||||||
{
|
{
|
||||||
float: left;
|
float: left;
|
||||||
width: 230px;
|
width: 200px;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ window.IsLocalClient = function ()
|
|||||||
{
|
{
|
||||||
return (window.location.protocol.substr(0, 4) !== "http");
|
return (window.location.protocol.substr(0, 4) !== "http");
|
||||||
};
|
};
|
||||||
|
var glSession;
|
||||||
var ServerHTTP;
|
var ServerHTTP;
|
||||||
var MainServer;
|
var MainServer;
|
||||||
if(window.nw)
|
if(window.nw)
|
||||||
@ -1983,3 +1984,10 @@ function isMobile()
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function DoNewSession()
|
||||||
|
{
|
||||||
|
var arr = new Uint8Array(6);
|
||||||
|
window.crypto.getRandomValues(arr);
|
||||||
|
glSession = GetHexFromArr(arr);
|
||||||
|
};
|
||||||
|
@ -24,6 +24,7 @@ var CONNECT_STATUS = 0;
|
|||||||
var NotModalClose = 0;
|
var NotModalClose = 0;
|
||||||
window.onload = function ()
|
window.onload = function ()
|
||||||
{
|
{
|
||||||
|
DoNewSession();
|
||||||
InitAccountsCard();
|
InitAccountsCard();
|
||||||
DoLangScript();
|
DoLangScript();
|
||||||
InitWalletKeyName();
|
InitWalletKeyName();
|
||||||
@ -38,7 +39,6 @@ window.onload = function ()
|
|||||||
if(Data && Data.result)
|
if(Data && Data.result)
|
||||||
{
|
{
|
||||||
Storage.setItem("NETWORK", Data.NETWORK);
|
Storage.setItem("NETWORK", Data.NETWORK);
|
||||||
console.log("Default network: " + Data.NETWORK);
|
|
||||||
OnLoad();
|
OnLoad();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -98,8 +98,8 @@ function OnLoad()
|
|||||||
LoadValues();
|
LoadValues();
|
||||||
InitDappsCard();
|
InitDappsCard();
|
||||||
StartWebWallet();
|
StartWebWallet();
|
||||||
setInterval(UpdatesExplorerData, 1000);
|
setInterval(UpdatesExplorerData, 2000);
|
||||||
setInterval(UpdatesAccountsData, 1000);
|
setInterval(UpdatesAccountsData, 2000);
|
||||||
DoStableScroll();
|
DoStableScroll();
|
||||||
window.onmousemove = function (event)
|
window.onmousemove = function (event)
|
||||||
{
|
{
|
||||||
@ -117,11 +117,13 @@ function OnLoad()
|
|||||||
|
|
||||||
function ChangeNetwork(bStart)
|
function ChangeNetwork(bStart)
|
||||||
{
|
{
|
||||||
|
FirstAccountsData = 1;
|
||||||
CONNECT_STATUS = 0;
|
CONNECT_STATUS = 0;
|
||||||
NETWORK = $("idCurNetwork").value;
|
NETWORK = $("idCurNetwork").value;
|
||||||
Storage.setItem("NETWORK", NETWORK);
|
Storage.setItem("NETWORK", NETWORK);
|
||||||
if(bStart)
|
if(bStart)
|
||||||
StartWebWallet();
|
StartWebWallet();
|
||||||
|
else
|
||||||
ConnectWebWallet();
|
ConnectWebWallet();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -144,6 +146,7 @@ function OnFindServer()
|
|||||||
CONNECT_STATUS = 2;
|
CONNECT_STATUS = 2;
|
||||||
Storage.setItem("MainServer", JSON.stringify({ip:MainServer.ip, port:MainServer.port}));
|
Storage.setItem("MainServer", JSON.stringify({ip:MainServer.ip, port:MainServer.port}));
|
||||||
FillCurrencyAsync("idAccountCur");
|
FillCurrencyAsync("idAccountCur");
|
||||||
|
SetDataUpdateTime(10);
|
||||||
UpdateTabs();
|
UpdateTabs();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -188,6 +191,16 @@ function OnSelectTab(name)
|
|||||||
SetPrivKey($("idPrivKeyEdit").value.trim());
|
SetPrivKey($("idPrivKeyEdit").value.trim());
|
||||||
InitPrivKey();
|
InitPrivKey();
|
||||||
}
|
}
|
||||||
|
if(name === "TabAccounts" || name === "TabSend")
|
||||||
|
{
|
||||||
|
UpdatesAccountsData(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(name === "TabExplorer")
|
||||||
|
{
|
||||||
|
UpdatesExplorerData(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
if(name === "TabDapps")
|
if(name === "TabDapps")
|
||||||
{
|
{
|
||||||
ViewDapps();
|
ViewDapps();
|
||||||
@ -292,8 +305,14 @@ function OnPrivKeyCancel()
|
|||||||
};
|
};
|
||||||
var FirstAccountsData = 1;
|
var FirstAccountsData = 1;
|
||||||
var AccountsCount = - 1;
|
var AccountsCount = - 1;
|
||||||
|
var DataUpdateTime = 0;
|
||||||
|
|
||||||
function UpdatesAccountsData()
|
function SetDataUpdateTime(PeriodSec)
|
||||||
|
{
|
||||||
|
DataUpdateTime = Date.now() + 1000 * PeriodSec;
|
||||||
|
};
|
||||||
|
|
||||||
|
function UpdatesAccountsData(bGetData)
|
||||||
{
|
{
|
||||||
if(IsVisibleClass(".accounts-info__add"))
|
if(IsVisibleClass(".accounts-info__add"))
|
||||||
return ;
|
return ;
|
||||||
@ -304,7 +323,16 @@ function UpdatesAccountsData()
|
|||||||
{
|
{
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
GetData("/GetAccountListByKey", {Key:Str, AllData:FirstAccountsData}, function (Data,responseText)
|
if(!bGetData)
|
||||||
|
{
|
||||||
|
if(IsVisibleBlock("TabAccounts") || DataUpdateTime >= Date.now())
|
||||||
|
{
|
||||||
|
bGetData = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!bGetData)
|
||||||
|
return ;
|
||||||
|
GetData("/GetAccountListByKey", {Key:Str, Session:glSession, AllData:FirstAccountsData}, function (Data,responseText)
|
||||||
{
|
{
|
||||||
if(!Data || !Data.result || !Data.arr)
|
if(!Data || !Data.result || !Data.arr)
|
||||||
return ;
|
return ;
|
||||||
@ -549,8 +577,20 @@ function RestoreAllAccounts()
|
|||||||
DelAccount(0);
|
DelAccount(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
function UpdatesExplorerData()
|
function UpdatesExplorerData(bGetData)
|
||||||
{
|
{
|
||||||
|
var bDiagram = 0;
|
||||||
|
if(IsVisibleBlock("TabExplorer") && IsVisibleBlock("idStatBlock"))
|
||||||
|
bDiagram = 1;
|
||||||
|
if(!bGetData)
|
||||||
|
{
|
||||||
|
if(bDiagram || DataUpdateTime >= Date.now())
|
||||||
|
{
|
||||||
|
bGetData = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!bGetData)
|
||||||
|
return ;
|
||||||
var WasSendTr = 0;
|
var WasSendTr = 0;
|
||||||
for(var key in MapSendTransaction)
|
for(var key in MapSendTransaction)
|
||||||
{
|
{
|
||||||
@ -561,7 +601,7 @@ function UpdatesExplorerData()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GetData("GetCurrentInfo", {Diagram:IsVisibleBlock("idStatBlock") ? 1 : 0, ArrLog:WasSendTr}, function (Data)
|
GetData("GetCurrentInfo", {Diagram:bDiagram, ArrLog:WasSendTr}, function (Data)
|
||||||
{
|
{
|
||||||
if(!Data || !Data.result)
|
if(!Data || !Data.result)
|
||||||
return ;
|
return ;
|
||||||
@ -697,9 +737,11 @@ function downloadKey(fieldID)
|
|||||||
anchor.click();
|
anchor.click();
|
||||||
document.body.removeChild(anchor);
|
document.body.removeChild(anchor);
|
||||||
};
|
};
|
||||||
|
var glWasModal = 0;
|
||||||
|
|
||||||
function openModal(id)
|
function openModal(id)
|
||||||
{
|
{
|
||||||
|
glWasModal = 1;
|
||||||
var modal = document.querySelector("#" + id);
|
var modal = document.querySelector("#" + id);
|
||||||
var overlay = document.querySelector("#overlay");
|
var overlay = document.querySelector("#overlay");
|
||||||
modal.style.display = "block";
|
modal.style.display = "block";
|
||||||
@ -710,6 +752,7 @@ function closeModal()
|
|||||||
{
|
{
|
||||||
if(NotModalClose)
|
if(NotModalClose)
|
||||||
return ;
|
return ;
|
||||||
|
glWasModal = 0;
|
||||||
var modals = document.querySelectorAll(".modal");
|
var modals = document.querySelectorAll(".modal");
|
||||||
var overlay = document.querySelector("#overlay");
|
var overlay = document.querySelector("#overlay");
|
||||||
modals.forEach(function (item)
|
modals.forEach(function (item)
|
||||||
@ -802,14 +845,24 @@ function SendMobileBefore()
|
|||||||
SetVisibleClass(".send-page__setting", 0);
|
SetVisibleClass(".send-page__setting", 0);
|
||||||
SetVisibleClass(".send-page__confirm", 1);
|
SetVisibleClass(".send-page__confirm", 1);
|
||||||
SetStatus("");
|
SetStatus("");
|
||||||
|
UpdatesAccountsData(1);
|
||||||
|
UpdatesExplorerData(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
function OKSend()
|
function OKSend()
|
||||||
{
|
{
|
||||||
SendMoney();
|
SendMoney(function ()
|
||||||
|
{
|
||||||
|
if(glWasModal)
|
||||||
|
{
|
||||||
ClearSend();
|
ClearSend();
|
||||||
SaveValues();
|
SaveValues();
|
||||||
|
}
|
||||||
|
closeModal();
|
||||||
|
});
|
||||||
|
SetDataUpdateTime(20);
|
||||||
CancelSend();
|
CancelSend();
|
||||||
|
openModal('idSending');
|
||||||
};
|
};
|
||||||
|
|
||||||
function CancelSend()
|
function CancelSend()
|
||||||
@ -920,6 +973,7 @@ function SetUsePassword(bUse)
|
|||||||
function DoExitWallet()
|
function DoExitWallet()
|
||||||
{
|
{
|
||||||
ClearSend();
|
ClearSend();
|
||||||
|
SaveValues();
|
||||||
NotModalClose = 1;
|
NotModalClose = 1;
|
||||||
$("Password").value = "";
|
$("Password").value = "";
|
||||||
SetWalletPassword("");
|
SetWalletPassword("");
|
||||||
@ -1210,7 +1264,7 @@ LangMap["RUS"] = {"TERA WALLET":"TERA КОШЕЛЕК", "Generate key":"Сген
|
|||||||
"Buy/sell/mine TERA":"Купить/Продать", "+ CREATE NEW":"+ СОЗДАТЬ", "Confirm Transaction":"Подтверждение транзакции", "CREATE DAPPS":"СОЗДАТЬ",
|
"Buy/sell/mine TERA":"Купить/Продать", "+ CREATE NEW":"+ СОЗДАТЬ", "Confirm Transaction":"Подтверждение транзакции", "CREATE DAPPS":"СОЗДАТЬ",
|
||||||
"Set pass":"Установить пароль", "Unlock":"Разблокировать", "Entrance to sub-wallet":"Войти в под-кошелек", "Public name":"Публичное имя",
|
"Set pass":"Установить пароль", "Unlock":"Разблокировать", "Entrance to sub-wallet":"Войти в под-кошелек", "Public name":"Публичное имя",
|
||||||
"Currency":"Валюта", "Pay to:":"Получатель:", "Amount:":"Сумма:", "Description:":"Описание:", "Welcome to TERA Wallet":"Добропожаловать в кошелек TERA",
|
"Currency":"Валюта", "Pay to:":"Получатель:", "Amount:":"Сумма:", "Description:":"Описание:", "Welcome to TERA Wallet":"Добропожаловать в кошелек TERA",
|
||||||
"Edit your wallet":"Редактирование вашего кошелька", "Key settings":"Задание ключей", "KEY SETTINGS":"ЗАДАНИЕ КЛЮЧЕЙ", "Create an account":"Создание счета",
|
"Edit your wallet":"Редактирование вашего кошелька", "Key settings":"Задание ключей", "KEY SETTINGS":"КЛЮЧИ", "Create an account":"Создание счета",
|
||||||
"Sending coins":"Отправка монет", "Decentralized applications (dApps)":"Децентрализованные приложения (Даппс)", "Secure your wallet":"Безопасность вашего кошелька",
|
"Sending coins":"Отправка монет", "Decentralized applications (dApps)":"Децентрализованные приложения (Даппс)", "Secure your wallet":"Безопасность вашего кошелька",
|
||||||
"Wallet is secured":"Установлен пароль", "Total":"Всего", "Item.Name":"Item.Name", "You have no accounts yet":"У вас нет ни одного счета",
|
"Wallet is secured":"Установлен пароль", "Total":"Всего", "Item.Name":"Item.Name", "You have no accounts yet":"У вас нет ни одного счета",
|
||||||
"Wait 10-15 sec":"Ждите 10-15 сек", "Creating your account":"Идет создание вашего счета", "From:":"Отправитель:", "Set a password for protect entry":"Установите пароль для безопасности",
|
"Wait 10-15 sec":"Ждите 10-15 сек", "Creating your account":"Идет создание вашего счета", "From:":"Отправитель:", "Set a password for protect entry":"Установите пароль для безопасности",
|
||||||
|
@ -347,7 +347,7 @@ function SendMoney2()
|
|||||||
SendMoney();
|
SendMoney();
|
||||||
};
|
};
|
||||||
|
|
||||||
function SendMoney()
|
function SendMoney(F)
|
||||||
{
|
{
|
||||||
if(!CanSendTransaction)
|
if(!CanSendTransaction)
|
||||||
{
|
{
|
||||||
@ -358,7 +358,9 @@ function SendMoney()
|
|||||||
if($("idSendButton").disabled)
|
if($("idSendButton").disabled)
|
||||||
return ;
|
return ;
|
||||||
SetVisibleBlock("idBlockOnSend", 0);
|
SetVisibleBlock("idBlockOnSend", 0);
|
||||||
CreateTransaction(SendMoneyTR, true, ClearAttach);
|
if(!F)
|
||||||
|
F = ClearAttach;
|
||||||
|
CreateTransaction(SendMoneyTR, true, F);
|
||||||
};
|
};
|
||||||
|
|
||||||
function GetJSONFromTransaction(TR)
|
function GetJSONFromTransaction(TR)
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
var NumDappGet=0;
|
var NumDappGet=0;
|
||||||
var NumDappInfo=0;
|
var NumDappInfo=0;
|
||||||
|
|
||||||
var arr = new Uint8Array(6);
|
// var arr = new Uint8Array(6);
|
||||||
window.crypto.getRandomValues(arr);
|
// window.crypto.getRandomValues(arr);
|
||||||
var glSession=GetHexFromArr(arr);
|
// var glSession=GetHexFromArr(arr);
|
||||||
|
|
||||||
|
|
||||||
//DAPP TRANSFER
|
//DAPP TRANSFER
|
||||||
@ -295,6 +295,8 @@
|
|||||||
var SMART={},BASE_ACCOUNT={},OPEN_PATH="";
|
var SMART={},BASE_ACCOUNT={},OPEN_PATH="";
|
||||||
window.onload=function()
|
window.onload=function()
|
||||||
{
|
{
|
||||||
|
DoNewSession();
|
||||||
|
|
||||||
if(window.location.hash)
|
if(window.location.hash)
|
||||||
OPEN_PATH=window.location.hash.substr(1);
|
OPEN_PATH=window.location.hash.substr(1);
|
||||||
if(IsLocalClient())
|
if(IsLocalClient())
|
||||||
|
@ -490,6 +490,13 @@
|
|||||||
{
|
{
|
||||||
CanSendTransaction=1;
|
CanSendTransaction=1;
|
||||||
}
|
}
|
||||||
|
if(Data.NET_WORK_MODE && Data.NET_WORK_MODE.NOT_RUN)
|
||||||
|
{
|
||||||
|
CanSendTransaction=0;
|
||||||
|
WalletStatus="OK";
|
||||||
|
SetMainStatus("<DIV align='center' style='color:#565571'><big><B>NODE NOT RUNING</B></big></DIV>",1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MaxAccID=Data.MaxAccID;
|
MaxAccID=Data.MaxAccID;
|
||||||
MaxDappsID=Data.MaxDappsID;
|
MaxDappsID=Data.MaxDappsID;
|
||||||
@ -1105,10 +1112,10 @@
|
|||||||
ArrInfo=
|
ArrInfo=
|
||||||
[
|
[
|
||||||
{Name:"Hashrate from the beginning of the chain", Delta:1000000000, DX:310},
|
{Name:"Hashrate from the beginning of the chain", Delta:1000000000, DX:310},
|
||||||
{Name:"month", Delta:30.5*24*3600, DX:200},
|
{Name:"month", Delta:30.5*24*3600, DX:200, Mult:10000},
|
||||||
{Name:"day", Delta:24*3600, DX:140},
|
{Name:"day", Delta:24*3600, DX:140, Mult:1000},
|
||||||
{Name:"hour", Delta:3600, DX:90},
|
{Name:"hour", Delta:3600, DX:90, Mult:100},
|
||||||
{Name:"minute", Delta:60, DX:60}
|
{Name:"minute", Delta:60, DX:60, Mult:2},
|
||||||
];
|
];
|
||||||
|
|
||||||
for(var i=0;i<ArrInfo.length;i++)
|
for(var i=0;i<ArrInfo.length;i++)
|
||||||
@ -1137,7 +1144,7 @@
|
|||||||
if(Item.BlockNum1<0)
|
if(Item.BlockNum1<0)
|
||||||
Item.BlockNum1=0;
|
Item.BlockNum1=0;
|
||||||
|
|
||||||
CurBlockNum=Item.BlockNum1;
|
CurBlockNum=Math.floor(Item.BlockNum1/Item.Mult)*Item.Mult;
|
||||||
|
|
||||||
var MustUpdate=0;
|
var MustUpdate=0;
|
||||||
if(Item.PowerArr)
|
if(Item.PowerArr)
|
||||||
@ -1225,6 +1232,7 @@
|
|||||||
if(!Month)
|
if(!Month)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
var AvgTotal=0;
|
var AvgTotal=0;
|
||||||
for(var i=0;i<ArrInfo.length;i++)
|
for(var i=0;i<ArrInfo.length;i++)
|
||||||
{
|
{
|
||||||
@ -1435,6 +1443,7 @@
|
|||||||
</DIV>
|
</DIV>
|
||||||
<DIV style="float: left;display: none" id="idMiningParams">
|
<DIV style="float: left;display: none" id="idMiningParams">
|
||||||
<DIV style="float: left; color: blue;">CPU use:<input type="number" min=0 max=100 id="idPercentMining" onchange="SetPercentMining()"/>%</DIV>
|
<DIV style="float: left; color: blue;">CPU use:<input type="number" min=0 max=100 id="idPercentMining" onchange="SetPercentMining()"/>%</DIV>
|
||||||
|
<DIV style="float: left; margin: 2px 0 0 8px;" id="idStatusMining"></DIV>
|
||||||
</DIV>
|
</DIV>
|
||||||
</DIV>
|
</DIV>
|
||||||
<DIV id="idDevelopService" style="display: none">
|
<DIV id="idDevelopService" style="display: none">
|
||||||
@ -1474,7 +1483,6 @@
|
|||||||
</DIV>
|
</DIV>
|
||||||
<canvas width='800' height='30' id='idBlockInfo'></canvas>
|
<canvas width='800' height='30' id='idBlockInfo'></canvas>
|
||||||
<BR><BR>
|
<BR><BR>
|
||||||
<DIV style="float: left; font-family: monospace" id="idStatusMining"></DIV>
|
|
||||||
<DIV style="float: left; font-family: monospace">
|
<DIV style="float: left; font-family: monospace">
|
||||||
Block:<B id="idCurBlockNum"></B>
|
Block:<B id="idCurBlockNum"></B>
|
||||||
DB delta:<B id="idDeltaDB" style="min-width: 30px"></B>
|
DB delta:<B id="idDeltaDB" style="min-width: 30px"></B>
|
||||||
@ -1676,7 +1684,7 @@
|
|||||||
<option value="styleContrast2">Contrast 2</option>
|
<option value="styleContrast2">Contrast 2</option>
|
||||||
<option value="styleContrast3">Contrast 3</option>
|
<option value="styleContrast3">Contrast 3</option>
|
||||||
</select>
|
</select>
|
||||||
This Version Refactor By MiaoWoo Use TypeScript
|
|
||||||
|
|
||||||
|
|
||||||
</DIV>
|
</DIV>
|
||||||
|
@ -632,9 +632,12 @@
|
|||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="modal dapp-modal" id="idSending" onclick="closeModal()" style="display: none;">
|
||||||
|
<h2 class="password-modal__title">Sending Tx</h2><BR>
|
||||||
|
<p class="password-modal__subtitle">Wait 5-8 sec, pls</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="modal dapp-modal" id="idSmartEnter" style="display: none;">
|
||||||
<section class="modal password-modal" id="idSmartEnter">
|
|
||||||
<h2 class="password-modal__title"><span>Enter number of dapp</span></h2>
|
<h2 class="password-modal__title"><span>Enter number of dapp</span></h2>
|
||||||
<p class="password-modal__subtitle">Enter the dapps number that will be added to your account. Attention make sure that you trust this dapp, otherwise you may lose all funds in this account.</p>
|
<p class="password-modal__subtitle">Enter the dapps number that will be added to your account. Attention make sure that you trust this dapp, otherwise you may lose all funds in this account.</p>
|
||||||
|
|
||||||
|
@ -1270,10 +1270,10 @@ export default class CConnect extends CMessages {
|
|||||||
if (!this.LastNotZeroNodesTime)
|
if (!this.LastNotZeroNodesTime)
|
||||||
this.LastNotZeroNodesTime = CurTime
|
this.LastNotZeroNodesTime = CurTime
|
||||||
var DeltaTime = CurTime - this.LastNotZeroNodesTime;
|
var DeltaTime = CurTime - this.LastNotZeroNodesTime;
|
||||||
if (DeltaTime > 10 * 1000) {
|
if (DeltaTime > 60 * 1000) {
|
||||||
global.ToLog("DETECT GRAY MODE")
|
global.ToLog("DETECT GRAY MODE")
|
||||||
if (!global.NET_WORK_MODE) {
|
if (!global.NET_WORK_MODE) {
|
||||||
global.NET_WORK_MODE = { ip: "", port: "" }
|
global.NET_WORK_MODE = { ip: "", port: 30000 }
|
||||||
}
|
}
|
||||||
global.NET_WORK_MODE.UseDirectIP = 0
|
global.NET_WORK_MODE.UseDirectIP = 0
|
||||||
global.SAVE_CONST()
|
global.SAVE_CONST()
|
||||||
@ -1282,7 +1282,7 @@ export default class CConnect extends CMessages {
|
|||||||
SetDirectMode() {
|
SetDirectMode() {
|
||||||
var CountNodes = this.ActualNodes.size;
|
var CountNodes = this.ActualNodes.size;
|
||||||
if (CountNodes && !global.NET_WORK_MODE) {
|
if (CountNodes && !global.NET_WORK_MODE) {
|
||||||
global.NET_WORK_MODE = { ip: "", port: "30000" }
|
global.NET_WORK_MODE = { ip: "", port: "30000", NOT_RUN: 0 }
|
||||||
global.NET_WORK_MODE.UseDirectIP = 1
|
global.NET_WORK_MODE.UseDirectIP = 1
|
||||||
global.SAVE_CONST()
|
global.SAVE_CONST()
|
||||||
}
|
}
|
||||||
|
@ -852,6 +852,9 @@ export default class CTransport extends CConnect {
|
|||||||
this.CanSend++
|
this.CanSend++
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (global.NET_WORK_MODE && global.NET_WORK_MODE.NOT_RUN) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let SELF = this;
|
let SELF = this;
|
||||||
this.Server = net.createServer(function(sock: any) {
|
this.Server = net.createServer(function(sock: any) {
|
||||||
if (SELF.WasBanIP({ address: sock.remoteAddress })) {
|
if (SELF.WasBanIP({ address: sock.remoteAddress })) {
|
||||||
|
1
src/global.d.ts
vendored
1
src/global.d.ts
vendored
@ -74,6 +74,7 @@ declare global {
|
|||||||
UseDirectIP?: boolean | number;
|
UseDirectIP?: boolean | number;
|
||||||
NodeWhiteList?: string;
|
NodeWhiteList?: string;
|
||||||
DoRestartNode?: number;
|
DoRestartNode?: number;
|
||||||
|
NOT_RUN?: boolean | number;
|
||||||
}
|
}
|
||||||
STAT_MODE: number;
|
STAT_MODE: number;
|
||||||
MAX_STAT_PERIOD: number;
|
MAX_STAT_PERIOD: number;
|
||||||
|
@ -36,6 +36,13 @@ global.glCurNumFindArr = 0;
|
|||||||
global.ArrReconnect = [];
|
global.ArrReconnect = [];
|
||||||
global.ArrConnect = [];
|
global.ArrConnect = [];
|
||||||
var FindList = [
|
var FindList = [
|
||||||
|
{ "ip": "91.235.136.81", "port": 30000 },
|
||||||
|
{ "ip": "dappsgate.com", "port": 30000 },
|
||||||
|
{ "ip": "185.240.243.182", "port": 30000 },
|
||||||
|
{ "ip": "t1.teraexplorer.com", "port": 30000 },
|
||||||
|
{ "ip": "t2.teraexplorer.com", "port": 30000 },
|
||||||
|
{ "ip": "t4.teraexplorer.com", "port": 30000 },
|
||||||
|
{ "ip": "teraexplorer.org", "port": 30000 },
|
||||||
{ "ip": "60.12.241.181", "port": 30002 },
|
{ "ip": "60.12.241.181", "port": 30002 },
|
||||||
{ "ip": "60.12.241.181", "port": 30003 },
|
{ "ip": "60.12.241.181", "port": 30003 },
|
||||||
{ "ip": "60.12.241.181", "port": 30004 },
|
{ "ip": "60.12.241.181", "port": 30004 },
|
||||||
@ -323,7 +330,7 @@ function StartChildProcess(Item: TeraProcess) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ITEM.Worker) {
|
if (ITEM.Worker) {
|
||||||
ITEM.Worker.send({ cmd: "Alive" });
|
ITEM.Worker.send({ cmd: "Alive", DELTA_CURRENT_TIME: global.DELTA_CURRENT_TIME });
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
ITEM.RunRPC = function(Name, Params, F) {
|
ITEM.RunRPC = function(Name, Params, F) {
|
||||||
|
@ -526,7 +526,7 @@ HostingCaller.GetNodeList = function(Params) {
|
|||||||
};
|
};
|
||||||
var AccountKeyMap = {};
|
var AccountKeyMap = {};
|
||||||
var LastMaxNum = 0;
|
var LastMaxNum = 0;
|
||||||
HostingCaller.GetAccountListByKey = function(Params, ppp, bRet) {
|
HostingCaller.GetAccountListByKey = function(Params, aaa, bbb, bRet) {
|
||||||
if (typeof Params !== "object" || !Params.Key)
|
if (typeof Params !== "object" || !Params.Key)
|
||||||
return { result: 0, arr: [] };
|
return { result: 0, arr: [] };
|
||||||
var Accounts = global.DApps.Accounts;
|
var Accounts = global.DApps.Accounts;
|
||||||
@ -571,6 +571,8 @@ HostingCaller.GetAccountListByKey = function(Params, ppp, bRet) {
|
|||||||
return Ret;
|
return Ret;
|
||||||
var Context = global.GetUserContext(Params);
|
var Context = global.GetUserContext(Params);
|
||||||
var StrInfo = JSON.stringify(Ret);
|
var StrInfo = JSON.stringify(Ret);
|
||||||
|
if (Params.AllData === "0")
|
||||||
|
Params.AllData = 0;
|
||||||
if (!Params.AllData && Context.PrevAccountList === StrInfo) {
|
if (!Params.AllData && Context.PrevAccountList === StrInfo) {
|
||||||
return { result: 0, cache: 1 };
|
return { result: 0, cache: 1 };
|
||||||
}
|
}
|
||||||
@ -654,7 +656,7 @@ HostingCaller.DappInfo = function(Params) {
|
|||||||
HostingCaller.DappWalletList = function(Params) {
|
HostingCaller.DappWalletList = function(Params) {
|
||||||
if (typeof Params !== "object")
|
if (typeof Params !== "object")
|
||||||
return { result: 0 };
|
return { result: 0 };
|
||||||
var Ret = HostingCaller.GetAccountListByKey(Params, undefined, 1);
|
var Ret = HostingCaller.GetAccountListByKey(Params, undefined, undefined, 1);
|
||||||
var Smart = global.ParseNum(Params.Smart);
|
var Smart = global.ParseNum(Params.Smart);
|
||||||
var arr = [];
|
var arr = [];
|
||||||
for (var i = 0; i < Ret.arr.length; i++) {
|
for (var i = 0; i < Ret.arr.length; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user