1
0
forked from circlecloud/tera

sync: sync upstream code

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2019-07-23 10:53:42 +08:00
parent e6e9bf0beb
commit 38e396feb0
8 changed files with 148 additions and 143 deletions

View File

@ -1,4 +1,4 @@
@import url('https://fonts.googleapis.com/css?family=Roboto:400,500,700&subset=cyrillic');
/*@import url('https://fonts.googleapis.com/css?family=Roboto:400,500,700&subset=cyrillic');*/
:root {
--blue-grey: #445368;
@ -243,7 +243,7 @@ textarea {
border: none;
color: #000;
padding: 5px;
width: 55px;
width: 75px;
font-family: inherit;
font-size: 12px;
line-height: 14px;
@ -1818,7 +1818,7 @@ td.hash {
}
.header__right select {
text-decoration: underline;
width: 60px;
width: 75px;
}
.header__wallet-link {
display: flex;
@ -1859,7 +1859,7 @@ td.hash {
font-size: 14px;
line-height: 16px;
right: 165px;
width: 60px;
width: 75px;
border-radius: 3px;
background: transparent;
color: #000;

View File

@ -179,7 +179,7 @@ else
function IsIPAddres(Str)
{
var arr = Str.split(".");
if(arr.length !== 3)
if(arr.length !== 4)
return 0;
for(var i = 0; i < arr.length; i++)
if(arr[i] !== "" + ParseNum(arr[i]))

View File

@ -8,6 +8,7 @@
* Telegram: https://t.me/terafoundation
*/
var WEB_WALLET_VERSION = "0.04";
var SaveIdArr = ["idAccount", "idTo", "idSumSend", "idDescription", "idCurTabName", "idViewBlockNum", "idViewAccountNum", "idViewDappNum",
"idLang"];
var CONFIG_DATA = {PRICE_DAO:{NewAccount:10}, MaxNumBlockDB:0, MaxAccID:0, MaxDappsID:0};
@ -455,7 +456,7 @@ function SetAccountsCard(Data,AccountsDataStr)
option.text = StrText;
var Str = StrAccCardTemplate;
Str = Str.replace("AccCardTemplate", "idCard" + Item.Num);
Str = Str.replace(/{Item.Num}/g, Item.Num);
Str = Str.replace(/\$Item.Num/g, Item.Num);
var Str1, Str2;
if(Item.Value.SumCOIN || Item.Value.SumCENT)
{
@ -468,25 +469,25 @@ function SetAccountsCard(Data,AccountsDataStr)
Str2 = "";
}
var StrCurrencyName = CurrencyName(Item.Currency);
Str = Str.replace("{Value.SumCOIN}", Str1);
Str = Str.replace("{Value.SumCENT}", Str2);
Str = Str.replace("{Value.CurrencyName}", StrCurrencyName);
Str = Str.replace("$Value.SumCOIN", Str1);
Str = Str.replace("$Value.SumCENT", Str2);
Str = Str.replace("$Value.CurrencyName", StrCurrencyName);
var CurrencyObj = Item.CurrencyObj;
if(!CurrencyObj)
CurrencyObj = {IconBlockNum:0, Num:0};
Str = Str.replace("{Value.CurrencyIconPath}", RetIconPath(CurrencyObj, 1));
Str = Str.replace("$value.currencyiconpath", "src='" + RetIconPath(CurrencyObj, 1) + "'");
var CurrencyPath = RetIconPath(CurrencyObj);
if(CurrencyPath.substr(0, 6) !== "/file/")
Str = Str.replace("prod-card__currency--with-dot", "");
Str = Str.replace("{Item.Name}", escapeHtml(Item.Name));
Str = Str.replace("$Item.Name", escapeHtml(Item.Name));
var SmartObj = Item.SmartObj;
if(!SmartObj)
SmartObj = {Name:"", Num:0, HTMLLength:0};
SmartObj.IconPath = RetIconPath(SmartObj, 0);
Str = Str.replace("{SmartObj.IconPath}", SmartObj.IconPath);
Str = Str.replace("{SmartObj.Name}", escapeHtml(SmartObj.Name));
Str = Str.replace(/{SmartObj.Num}/g, SmartObj.Num);
Str = Str.replace(/{SmartObj.HTMLLength}/g, SmartObj.HTMLLength);
Str = Str.replace("$smartobj.iconpath", "src='" + SmartObj.IconPath + "'");
Str = Str.replace("$SmartObj.Name", escapeHtml(SmartObj.Name));
Str = Str.replace(/\$SmartObj.Num/g, SmartObj.Num);
Str = Str.replace(/\$SmartObj.HTMLLength/g, SmartObj.HTMLLength);
if(SmartObj.Num)
{
Str = Str.replace("prod-card__link--connect", "myhidden");
@ -639,8 +640,8 @@ function SetExplorerData(Data)
FirstCallDiagram = 0;
var StrVersion = " 0." + Data.VersionNum;
$("idBHeight").innerText = Data.MaxNumBlockDB;
$("idBCurrent").innerText = Data.CurBlockNum;
$("idBVersion").innerText = StrVersion;
$("idWVersion").innerText = WEB_WALLET_VERSION;
SetArrLog(Data.ArrLog);
};
@ -1030,14 +1031,14 @@ function ViewDapps()
function FillDappCard(Str,Item)
{
CardMapList[Item.Num] = Item;
Str = Str.replace(/{Item.Num}/g, Item.Num);
Str = Str.replace("{Item.Name}", escapeHtml(Item.Name));
Str = Str.replace("{Item.Description}", escapeHtml(Item.Description));
Str = Str.replace("{Item.Owner}", Item.Owner);
Str = Str.replace(/\$Item.Num/g, Item.Num);
Str = Str.replace("$Item.Name", escapeHtml(Item.Name));
Str = Str.replace("$Item.Description", escapeHtml(Item.Description));
Str = Str.replace("$Item.Owner", Item.Owner);
if(!Item.TokenGenerate)
Str = Str.replace("dapp-modal__ok-token", "myhidden");
Str = Str.replace(/{Item.HTMLLength}/g, Item.HTMLLength);
Str = Str.replace("{Item.IconPath}", RetIconPath(Item, 0));
Str = Str.replace(/\$Item.HTMLLength/g, Item.HTMLLength);
Str = Str.replace("$item.iconpath", "src='" + RetIconPath(Item, 0) + "'");
return Str;
};
@ -1054,8 +1055,8 @@ function OpenDappCard(Num)
if(!Item)
return ;
var Str = FillDappCard(StrDappCardTemplate, Item);
Str = Str.replace("{Item.Account}", RetBaseAccount(Item));
Str = Str.replace("{Item.BlockNum}", RetOpenBlock(Item.BlockNum, 2));
Str = Str.replace("$Item.Account", RetBaseAccount(Item));
Str = Str.replace("$Item.BlockNum", RetOpenBlock(Item.BlockNum, 2));
Str = FillDappCategory(Str, Item, 1);
Str = FillDappCategory(Str, Item, 2);
Str = FillDappCategory(Str, Item, 3);
@ -1077,7 +1078,7 @@ function FillDappCategory(Str,Item,Num)
var Value = Item["Category" + Num];
if(Value && MapCategory[Value])
{
Str = Str.replace("{Item.Category" + Num + "}", MapCategory[Value]);
Str = Str.replace("$Item.Category" + Num, MapCategory[Value]);
}
else
{
@ -1199,7 +1200,7 @@ function InitLangItems()
continue;
if(!Text)
continue;
if(Text.substr(0, 1) === "{")
if(Text.substr(0, 1) === "$")
continue;
if(Text.toUpperCase() == Text.toLowerCase())
continue;
@ -1266,31 +1267,32 @@ LangMap["RUS"] = {"TERA WALLET":"TERA КОШЕЛЕК", "Generate key":"Сген
"Save key":"Сохран.", "+ CREATE A NEW ACCOUNT":"+ СОЗДАТЬ НОВЫЙ СЧЕТ", "Create account":"Создать счет", "Send":"Отправить",
"CONFIRM":"Подтверждение", "Accounts":"Счета", "Account(s)":"Счет(а,ов)", "Blocks and Tx":"Блоки и Транзакции", "Counters":"Показатели",
"Open DApp":"Открыть Дапп", "Back":"Назад", "Delete":"Удалить", "Save to book":"Сохранить в книгу", "Choose":"Выбрать", "RECONNECT":"КОННЕКТ",
"DApps":"ДАппс", "ID":"ИД", "Amount":"Величина", "Cur":"Вал", "Name":"Имя", "PubKey":"Пуб.ключ", "Operation":"Операция", "Smart":"Смарт",
"DApps":"DApps", "ID":"ИД", "Amount":"Величина", "Cur":"Вал", "Name":"Имя", "PubKey":"Пуб.ключ", "Operation":"Операция", "Smart":"Смарт",
"Block Num":"Ном блока", "Num":"Ном", "Date":"Дата", "Data Hash":"Хеш данных", "PowHash":"Хеш сложности", "Block Hash":"Хеш блока",
"Bytes":"Байт", "Pow":"Сложн", "Miner":"Майнер", "(secret)":"(секрет)", "Show":"Показать", "TERA":"TERA", "Blockchain height:":"Высота блокчейна:",
"Current create:":"Текущий блок:", "Protocol ver:":"Версия протокола:", "ID: {Item.Num}":"ИД: {Item.Num}", "Token generate":"Генерация токенов",
"ACCOUNTS":"СЧЕТА", "SEND":"ПОСЛАТЬ", "DAPPS":"ДАППС", "EXPLORER":"ПРОСМ", "ATTENTION: Before using the wallet, save the private key.":"ВНИМАНИЕ: Перед использованием кошелька сохраните приватный ключ",
"Current create:":"Текущий блок:", "Protocol ver:":"Версия протокола:", "ID: $Item.Num":"ИД: $Item.Num", "Token generate":"Генерация токенов",
"ACCOUNTS":"СЧЕТА", "SEND":"ОТПРАВИТЬ", "DAPPS":"ДАППС", "EXPLORER":"ПРОСМ", "ATTENTION: Before using the wallet, save the private key.":"ВНИМАНИЕ: Перед использованием кошелька сохраните приватный ключ",
"Web-site":"Веб-сайт", "Bitcointalk":"Bitcointalk", "Twitter":"Твиттер", "Telegram":"Телеграм", "Discord":"Дискорд", "QQchat":"QQchat",
"Buy/sell/mine TERA":"Купить/Продать", "+ CREATE NEW":"+ СОЗДАТЬ", "Confirm Transaction":"Подтверждение транзакции", "CREATE DAPPS":"СОЗДАТЬ",
"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":"Создание счета",
"Sending coins":"Отправка монет", "Decentralized applications (dApps)":"Децентрализованные приложения (Даппс)", "Secure your wallet":"Безопасность вашего кошелька",
"Sending coins":"Отправка монет", "Decentralized applications (dApps)":"Децентрализованные приложения (DApps)", "Secure your wallet":"Безопасность вашего кошелька",
"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":"Установите пароль для безопасности",
"Enter password to unlock wallet":"Введите пароль для разблокировки кошелька", "From ID:":"Отправитель:", "Pay to ID:":"Получатель:",
"Account":"Счет", "Owner":"Владелец", "Block num":"Ном блока", "Private key (secret)":"Приватный ключ (секретно)", "Load key":"Загруз.",
"Create your first account and start using TERA":"Создайте свой первый счет и начните использовать TERA", "0 Accounts":"0 Счетов",
"OWNER: {Item.Owner}":"Владелец: {Item.Owner}", "More info":"Информация", "Public key":"Публичный ключ", "Enter number of dapp":"Введите номер Даппа",
"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.":"Введите номер Даппа, который будет добавлен в ваш аккаунт. Внимание убедитесь, что Вы доверяете ему, в противном случае вы можете потерять все средства на этом счете."};
"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.":"Введите номер Даппа, который будет добавлен в ваш аккаунт. Внимание убедитесь, что Вы доверяете ему, в противном случае вы можете потерять все средства на этом счете.",
"Sending Tx":"Отправка транзакции", };
LangMap["简体中文"] = {"TERA WALLET":"TERA 钱包", "Generate key":"生成私钥", "OK":"OK", "Cancel":"取消", "Edit":"编辑", "Save key":"保存私钥",
"+ CREATE A NEW ACCOUNT":"+ 新建账号", "Create account":"创建账号", "Send":"发送", "SEND":"转账", "CONFIRM":"确认", "Accounts":"账号", "Account(s)":"账号",
"Blocks and Tx":"区块和交易", "Counters":"状态统计", "Open DApp":"打开DApp", "Back":"返回", "Delete":"删除", "Save to book":"保存到地址本", "Choose":"选择",
"RECONNECT":"重连", "DApps":"DApps", "ID":"ID", "Amount":"余额", "Cur":"币种", "Name":"名称", "PubKey":"公钥", "Operation":"操作次数", "Smart":"DApp",
"Block Num":"区块编号", "Num":"编号", "Date":"日期", "Data Hash":"数据哈希", "PowHash":"Pow哈希", "Block Hash":"区块哈希", "Bytes":"字节", "Pow":"Pow",
"Miner":"矿工", "(secret)":"(机密)", "Show":"显示", "TERA":"TERA", "Blockchain height:":"区块高度:", "Current create:":"最近区块:", "Protocol ver:":"协议版本:",
"ID: {Item.Num}":"ID: {Item.Num}", "Token generate":"生成代币", "ACCOUNTS":"账号", "DAPPS":"DAPPS", "EXPLORER":"浏览器", "ATTENTION: Before using the wallet, save the private key.":"注意: 使用钱包前,务必保存好私钥。",
"Token generate":"生成代币", "ACCOUNTS":"账号", "DAPPS":"DAPPS", "EXPLORER":"浏览器", "ATTENTION: Before using the wallet, save the private key.":"注意: 使用钱包前,务必保存好私钥。",
"Web-site":"官网", "Bitcointalk":"创世贴", "Twitter":"推特", "Telegram":"电报", "Discord":"Discord", "QQchat":"QQ群", "Buy/sell/mine TERA":"TERA 交易/挖矿",
"+ CREATE NEW":"+ 新建", "Confirm Transaction":"确认交易", "CREATE DAPPS":"创建DAPPS", "Set pass":"设置密码", "Unlock":"解锁", "Entrance to sub-wallet":"进入子钱包",
"Public name":"名称", "Currency":"币种", "Pay to:":"收款:", "Amount:":"金额:", "Description:":"描述:", "Welcome to TERA Wallet":"欢迎使用TERA钱包",
@ -1307,9 +1309,8 @@ LangMap["한글"] = {"TERA WALLET":"TERA 지갑", "Generate key":"개인 키 생
"Choose":"선택", "RECONNECT":"다시 연결", "DApps":"DApps", "ID":"ID", "Amount":"잔금", "Cur":"화폐", "Name":"이름", "PubKey":"공공키", "Operation":"조작 횟수",
"Smart":"DApp", "Block Num":"블록 번호", "Num":"번호", "Date":"날짜", "Data Hash":"데이터 하희", "PowHash":"Pow하희", "Block Hash":"블록 하희",
"Bytes":"바이트", "Pow":"Pow", "Miner":"바이트", "(secret)":"(비밀)", "Show":"쇼", "TERA":"TERA", "Blockchain height:":"블록높이:", "Current create:":"최근 블록:",
"Protocol ver:":"프로토콜 버전:", "ID: {Item.Num}":"ID: {Item.Num}", "Token generate":"생성대폐", "ACCOUNTS":"계정", "SEND":"발송", "DAPPS":"DAPPS",
"EXPLORER":"브라우저", "ATTENTION: Before using the wallet, save the private key.":"주의: 지갑을 사용하기 전에 반드시 개인 키를 저장해야 한다.", "Web-site":"사이트",
"Bitcointalk":"비트 화폐포럼", "Twitter":"트위터", "Telegram":"전보", "Discord":"Discord", "QQchat":"QQ ", "Buy/sell/mine TERA":"TERA거래 /채광",
"Protocol ver:":"프로토콜 버전:", "Token generate":"생성대폐", "ACCOUNTS":"계정", "SEND":"발송", "DAPPS":"DAPPS", "EXPLORER":"브라우저", "ATTENTION: Before using the wallet, save the private key.":"주의: 지갑을 사용하기 전에 반드시 개인 키를 저장해야 한다.",
"Web-site":"사이트", "Bitcointalk":"비트 화폐포럼", "Twitter":"트위터", "Telegram":"전보", "Discord":"Discord", "QQchat":"QQ ", "Buy/sell/mine TERA":"TERA거래 /채광",
"+ CREATE NEW":"+신건", "Confirm Transaction":"거래 확인", "CREATE DAPPS":" DAPPS만들기", "Set pass":"비밀번호 설정", "Unlock":"잠금 풀기", "Entrance to sub-wallet":"부속 지갑 들어가기",
"Public name":"이름", "Currency":"화폐", "Pay to:":"지불:", "Amount:":"수량:", "Description:":"묘사:", "Welcome to TERA Wallet":"TERA 지갑을 환영합니다",
"Edit your wallet":"지갑 편집", "Key settings":"개인 키 설정", "KEY SETTINGS":"개인 키 설정", "Create an account":"계정 만들기", "Sending coins":"동전 보내기",

View File

@ -8,12 +8,12 @@
* Telegram: https://t.me/terafoundation
*/
var MIN_VERSION = 1020;
var MIN_VERSION = 1114;
var COUNT_BLOCK_PROOF = 300;
var MIN_SUM_POWER = COUNT_BLOCK_PROOF * 35;
var MIN_SUM_POWER = 0;
var MainServer = undefined;
var MaxConnectedCount = 10;
var MaxTimeConnecting = 3 * 1000;
var MaxConnectedCount = 50;
var TIME_LENGTH_CONNECT_ALL = 2 * 1000;
var StartTimeConnecting = 0;
var ConnectedCount = 0;
var NETWORK = "TERA-MAIN";
@ -26,7 +26,7 @@ var ServerMainMap = {"127.0.0.1":{"ip":"127.0.0.1", "port":80, "Name":"LOCAL"},
"port":80, "Name":"SUPPORT2", "System":1}, "t1.teraexplorer.com":{"ip":"t1.teraexplorer.com", "port":80, "Name":"t1.teraexplorer.com",
"System":1}, };
var ServerTestMap = {"127.0.0.1":{"ip":"127.0.0.1", "port":80, "Name":"LOCAL"}, "dappsgate.com":{"ip":"dappsgate.com", "port":88,
"Name":"SUPPORT2", "System":1}, };
"Name":"SUPPORT1", "System":1}, };
function StartWebWallet()
{
@ -63,16 +63,21 @@ function OnInitWebWallet()
function SaveServerMap()
{
var arr = [];
for(var key in ServerMap)
var Arr = GetArrFromServerMap();
Arr.sort(function (a,b)
{
var Item = ServerMap[key];
if(Item.SumPower >= MIN_SUM_POWER)
{
arr.push({ip:Item.ip, port:Item.port});
}
if(a.SumPower === b.SumPower)
return a.DeltaTime - b.DeltaTime;
else
return b.SumPower - a.SumPower;
});
var Arr2 = [];
for(var i = 0; i < Math.min(Arr.length, MaxConnectedCount); i++)
{
var Item = Arr[i];
Arr2.push({ip:Item.ip, port:Item.port, Stat:Item.Stat, t:Item.DeltaTime});
}
Storage.setItem(NETWORK + "NodesArrayList", JSON.stringify(arr));
Storage.setItem(NETWORK + "NodesArrayList", JSON.stringify(Arr2));
};
function SetStatus(Str)
@ -111,9 +116,11 @@ function ConnectWebWallet()
setTimeout(LoopWalletInfo, 1500);
};
var Stage = 0;
var PreparingStartLoopHandShake = 0;
function LoopHandShake()
{
PreparingStartLoopHandShake = 0;
Stage++;
SetStatus("Connecting: " + Stage + "...");
for(var key in ServerMap)
@ -130,13 +137,12 @@ function LoopHandShake()
function DoNodeList(Item)
{
console.log(GetProtocolServerPath(Item) + "/GetNodeList");
if(window.location.protocol === "https:" && Item.port !== 443)
return ;
if(Item.port === 443 && IsIPAddres(Item.ip))
return ;
SetStatus("Try: " + Item.ip + ":" + Item.port);
Item.SendHandShake = 1;
Item.StartTime = Date.now();
GetData(GetProtocolServerPath(Item) + "/GetNodeList", {}, function (Data)
{
if(Data && Data.result && Data.NETWORK === NETWORK && Data.VersionNum >= MIN_VERSION)
@ -144,7 +150,7 @@ function DoNodeList(Item)
ConnectedCount++;
Item.GetHandShake = 1;
Item.BlockChain = Data.BlockChain;
SetStatus("Get: " + Item.ip + ":" + Item.port);
Item.DeltaTime = Date.now() - Item.StartTime;
var bWas = 0;
for(var i = 0; i < Data.arr.length; i++)
{
@ -152,33 +158,59 @@ function DoNodeList(Item)
if(!ServerMap[Node.ip] && Node.port)
{
ServerMap[Node.ip] = Node;
console.log("New: " + Node.ip + ":" + Node.port);
bWas = 1;
}
}
if(bWas && ConnectedCount < MaxConnectedCount && new Date() - StartTimeConnecting < MaxTimeConnecting)
var DeltaAll = Date.now() - StartTimeConnecting;
if(!PreparingStartLoopHandShake && bWas && ConnectedCount < MaxConnectedCount && DeltaAll < TIME_LENGTH_CONNECT_ALL)
{
PreparingStartLoopHandShake = 1;
setTimeout(LoopHandShake, 100);
}
}
});
};
function LoopWalletInfo()
function GetArrFromServerMap()
{
SetStatus("Get wallets info...");
var Arr = [];
for(var key in ServerMap)
{
var Item = ServerMap[key];
if(Item.port)
{
CountWallet++;
if(window.BrowserIE && CountWallet > 4)
break;
DoWalletInfo(Item);
if(!Item.SumPower)
Item.SumPower = 0;
if(!Item.DeltaTime)
Item.DeltaTime = 10000;
if(!Item.Stat)
Item.Stat = 0;
Arr.push(Item);
}
}
setTimeout(FindLider, 500);
return Arr;
};
var idTimeFindLider = 0;
var CountDoWalletInfoAll = 0;
var CountDoWalletInfoGet = 0;
function LoopWalletInfo()
{
CountDoWalletInfoAll = 0;
CountDoWalletInfoGet = 0;
var Arr = GetArrFromServerMap();
Arr.sort(function (a,b)
{
a.DeltaTime - b.DeltaTime;
});
CountWallet = Math.min(Arr.length, 8);
if(window.BrowserIE && CountWallet > 4)
CountWallet = 4;
for(var i = 0; i < CountWallet; i++)
{
DoWalletInfo(Arr[i]);
}
idTimeFindLider = setTimeout(FindLider, 2500);
};
function DoWalletInfo(Item)
@ -187,18 +219,28 @@ function DoWalletInfo(Item)
return ;
if(Item.port === 443 && IsIPAddres(Item.ip))
return ;
CountDoWalletInfoAll++;
Item.StartTime = Date.now();
Item.SendWalletInfo = 1;
GetData(GetProtocolServerPath(Item) + "/GetCurrentInfo", {BlockChain:1}, function (Data)
{
if(!idTimeFindLider)
return ;
if(Data && Data.result && Data.BlockChain && Data.NETWORK === NETWORK)
{
Item.Name = Data.NODES_NAME;
Item.GetWalletInfo = 1;
Item.DeltaTime = new Date() - Item.StartTime;
Item.DeltaTime2 = Date.now() - Item.StartTime;
Item.BlockChain = Data.BlockChain;
Item.MaxNumBlockDB = Data.MaxNumBlockDB;
console.log("Get: " + Item.ip + ":" + Item.port + " delta=" + Item.DeltaTime);
SetStatus("Get: " + Item.ip + ":" + Item.port + " t:" + Item.DeltaTime2);
CountDoWalletInfoGet++;
if(idTimeFindLider && CountDoWalletInfoAll && CountDoWalletInfoGet >= 2 && CountDoWalletInfoGet / CountDoWalletInfoAll > 0.7)
{
clearTimeout(idTimeFindLider);
idTimeFindLider = 0;
FindLider();
}
}
});
};
@ -219,7 +261,6 @@ function FindLider()
Item.SumPower = CalcPowFromBlockChain(arr);
if(Item.SumPower < MIN_SUM_POWER)
{
console.log("Skip: " + Item.ip + ":" + Item.port + " SumPower(" + Item.SumPower + ") < MIN_SUM_POWER(" + MIN_SUM_POWER + ")");
continue;
}
if(!MapSumPower[Item.SumPower])
@ -239,14 +280,15 @@ function FindLider()
}
Arr.sort(function (a,b)
{
return a.DeltaTime - b.DeltaTime;
return a.DeltaTime2 - b.DeltaTime2;
});
for(var i = 0; i < Arr.length; i++)
{
var Item = Arr[i];
if(Item.SumPower === MaxKey)
{
SetStatus("Find " + Item.ip + ":" + Item.port + " with pow=" + Item.SumPower + "/" + MaxKey + " ping=" + Item.DeltaTime);
Item.Stat++;
SetStatus("Find " + Item.ip + ":" + Item.port + " pow=" + Item.SumPower + " t:" + Item.DeltaTime2 + " ms");
MainServer = Item;
SaveServerMap();
break;

View File

@ -1632,7 +1632,7 @@
<DIV id="idNetworkView" style="display: none">
<H3>Network connections:</H3>
<INPUT type="checkbox" id="idUseDirectIP">Run server and use direct IP:<BR>
IP:<INPUT maxlength="16" id="idIP"> Port:<INPUT maxlength="9" id="idPort"><BR>
IP:<INPUT maxlength="20" id="idIP"> Port:<INPUT maxlength="9" id="idPort"><BR>
<!--<INPUT type="checkbox" id="idUseIncomeGrayIP">Allow connection users without a direct ip:<BR>-->
<!--White list nodes (HEX-format):<BR>-->
<TEXTAREA id="idNodeWhiteList" rows="4" cols="100" style="display: none"> </TEXTAREA>

View File

@ -64,7 +64,6 @@
</div>
<h1 class="welcome__title title">Welcome to TERA Wallet</h1>
<p><a onclick="SelectTab('TabKeySet')" class="pointer">ATTENTION: Before using the wallet, save the private key.</a></p>
<!--<a class="welcome__link btn" onclick="SelectTab('TabAccounts')">Open wallet</a>-->
<ul id="idStableScroll" align='center' class="social-list">
<li class="social-list__item"><a href="https://terafoundation.org/">Web-site</a></li>
@ -85,7 +84,6 @@
</div>
<div class="wallet-settings__field key-field">
<p class="key-field__title">Private key (secret)</p>
<!--<button class="key-field__btn btn-no-bg" onclick="pasteKey(event, 'idPrivKeyEdit')">Paste</button>-->
<textarea name="private-key" id="idPrivKeyEdit" placeholder="Insert your private key or generate a new key below..." class="key-field__textarea" oninput="OnEditPrivKey()">
</textarea>
@ -100,14 +98,12 @@
<button class="btn wallet-settings__btn-270" id="okEditBtn" style="margin-bottom: 15px;" onclick="OnPrivKeyOK()">OK</button>
<button class="btn btn--white wallet-settings__btn-270" id="cancelEditBtn" style="margin-bottom: 15px;" onclick="OnPrivKeyCancel()">Cancel</button>
</div>
<!--<button class="btn wallet-settings__go-btn" onclick="SelectTab('TabAccounts')">Go to accounts</button>-->
</section>
<section id="TabKeySet" class="wallet-settings wallet-settings--info" style="display: none;">
<div class="wallet-settings__title-wrap">
<!--<a class="back-link" onclick="SelectTab('TabWelcome')"><span>Back</span></a>-->
<h2 class="wallet-settings__title title">Key settings</h2>
<a class="modal-lock pointer" id="idPasswordEdit" onclick="openModal('password-modal-set');"><svg width="14" height="18" viewBox="0 0 14 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.5 5V10H10.5H12H13C13.5523 10 14 10.4477 14 11V17C14 17.5523 13.5523 18 13 18H1C0.447716 18 0 17.5523 0 17V11C0 10.4477 0.447715 10 1 10H2V5C2 2.23858 4.23858 0 7 0C9.76142 0 12 2.23858 12 5V7H10.5V5C10.5 3.067 8.933 1.5 7 1.5C5.067 1.5 3.5 3.067 3.5 5Z" fill="var(--fill--password)" fill-opacity="0.2"/>
@ -210,29 +206,29 @@
<li class="prod-list__item prod-card prod-card--line prod-card--switch find--switch" id="AccCardTemplate">
<div class="prod-card__first-line">
<span class="hidden id-sign">ID:&nbsp;</span>
<a target='_blank' class="prod-card__id prod-card__id--mobile">{Item.Num}</a>
<a onclick="OpenHistoryPage({Item.Num})" class="prod-card__id prod-card__id--mobile-active pointer">{Item.Num}</a>
<a onclick="OpenHistoryPage({Item.Num})" target='_blank' class="prod-card__id prod-card__id--desktop pointer">{Item.Num}</a>
<a target='_blank' class="prod-card__id prod-card__id--mobile">$Item.Num</a>
<a onclick="OpenHistoryPage($Item.Num)" class="prod-card__id prod-card__id--mobile-active pointer">$Item.Num</a>
<a onclick="OpenHistoryPage($Item.Num)" target='_blank' class="prod-card__id prod-card__id--desktop pointer">$Item.Num</a>
<div class="prod-card__heading">
<span class="prod-card__coins-count">{Value.SumCOIN}<sup>{Value.SumCENT}</sup><br>
<span class="light-grey-text small-text mob-hidden">{Value.CurrencyName}</span>
<span class="prod-card__coins-count">$Value.SumCOIN<sup>$Value.SumCENT</sup><br>
<span class="light-grey-text small-text mob-hidden">$Value.CurrencyName</span>
</span>
<span class="prod-card__currency prod-card__currency--with-dot">
<img src="{Value.CurrencyIconPath}" width="18" height="18" alt="">
<img $value.currencyiconpath width="18" height="18" alt="">
</span>
</div>
<span class="prod-card__descr light-grey-text">{Item.Name}</span>
<span class="prod-card__descr light-grey-text">$Item.Name</span>
</div>
<div class="prod-card__footer">
<div class="prod-card__footer-wrap" >
<a onclick="OpenDapps({SmartObj.Num},{Item.Num},{SmartObj.HTMLLength})" class="prod-card__link prod-card__link--dapp">
<img src="{SmartObj.IconPath}" alt="." width="32" height="32">
<span class="prod-card__dapp-name mob-hidden">{SmartObj.Name}</span>
<a onclick="OpenDapps($SmartObj.Num,$Item.Num,$SmartObj.HTMLLength)" class="prod-card__link prod-card__link--dapp">
<img $smartobj.iconpath alt="." width="32" height="32">
<span class="prod-card__dapp-name mob-hidden">$SmartObj.Name</span>
</a>
<a class="prod-card__link prod-card__link--connect" onclick="ConnectSmart({Item.Num})">
<a class="prod-card__link prod-card__link--connect" onclick="ConnectSmart($Item.Num)">
<svg class="prod-card__dapp-icon" width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="15" cy="15" r="14.5" fill="white" fill-opacity="0.01" stroke="#F2F2F2"/>
<path d="M15.5 10H14.5V14.5H10V15.5H14.5V20H15.5V15.5H20V14.5H15.5V10Z" fill="#445368"/>
@ -240,19 +236,19 @@
<span class="prod-card__dapp-text mob-hidden">Connect DApp...</span>
</a>
<button type="button" class="prod-card__drop-btn btn-no-bg mob-hidden" onclick="showMenu({Item.Num})" onblur="closeMenu({Item.Num})">
<button type="button" class="prod-card__drop-btn btn-no-bg mob-hidden" onclick="showMenu($Item.Num)" onblur="closeMenu($Item.Num)">
<svg width="4" height="16" viewBox="0 0 4 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.5 2C3.5 2.82843 2.82843 3.5 2 3.5C1.17157 3.5 0.5 2.82843 0.5 2C0.5 1.17157 1.17157 0.5 2 0.5C2.82843 0.5 3.5 1.17157 3.5 2ZM3.5 8C3.5 8.82843 2.82843 9.5 2 9.5C1.17157 9.5 0.5 8.82843 0.5 8C0.5 7.17157 1.17157 6.5 2 6.5C2.82843 6.5 3.5 7.17157 3.5 8ZM2 15.5C2.82843 15.5 3.5 14.8284 3.5 14C3.5 13.1716 2.82843 12.5 2 12.5C1.17157 12.5 0.5 13.1716 0.5 14C0.5 14.8284 1.17157 15.5 2 15.5Z" fill="#445368"/>
</svg>
</button>
<div class="prod-card__dropdown" style="display: none;" id="idBt{Item.Num}">
<a class="editdapp" onclick="SetSmart({Item.Num},{SmartObj.Num})">Change dApp</a>
<a class="editdapp" onclick="DelSmart({Item.Num},-1)">Disconnect dApp</a>
<a onclick="DelAccount({Item.Num})">Hide account</a>
<div class="prod-card__dropdown" style="display: none;" id="idBt$Item.Num">
<a class="editdapp" onclick="SetSmart($Item.Num,$SmartObj.Num)">Change dApp</a>
<a class="editdapp" onclick="DelSmart($Item.Num,-1)">Disconnect dApp</a>
<a onclick="DelAccount($Item.Num)">Hide account</a>
<a onclick="RestoreAllAccounts()">Show All accounts</a>
</div>
</div>
<a class="prod-card__footer-empty" style="display: none;" onclick="ConnectSmart({Item.Num},{SmartObj.Num})"><span class="mob-hidden">Connect dapp...</span></a>
<a class="prod-card__footer-empty" style="display: none;" onclick="ConnectSmart($Item.Num,$SmartObj.Num)"><span class="mob-hidden">Connect dapp...</span></a>
</div>
</li>
@ -407,26 +403,19 @@
<ul id="DappRowCardTemplate" class="grid prod-list">
<li class="prod-card dapps-page__card">
<div class="prod-card__first-line">
<span class="prod-card__id light-grey-text">ID: {Item.Num}</span>
<span class="prod-card__id light-grey-text">OWNER: {Item.Owner}</span>
<a onclick="OpenDappCard({Item.Num})" class="prod-card__link prod-card__link--info">More info</a>
<span class="prod-card__id light-grey-text">ID: $Item.Num</span>
<span class="prod-card__id light-grey-text">OWNER: $Item.Owner</span>
<a onclick="OpenDappCard($Item.Num)" class="prod-card__link prod-card__link--info">More info</a>
</div>
<div class="prod-card__second-line">
<div class="prod-card__second-line-left">
<div class="prod-card__heading">
<a class="prod-card__link" onclick="OpenOnlyDapp({Item.Num},{Item.HTMLLength})">{Item.Name}</a>
<!--<span class="lighter-grey-text">Without token generate</span>-->
<!--<span class="dapp-modal__ok-token">Token generate</span>-->
<a class="prod-card__link" onclick="OpenOnlyDapp($Item.Num,$Item.HTMLLength)">$Item.Name</a>
</div>
<p>{Item.Description}</p>
<!-- <ol>-->
<!--<li>Gaming & VR</li>-->
<!--<li>Gaming & VR</li>-->
<!--<li>Gaming & VR</li>-->
<!--</ol> -->
<p>$Item.Description</p>
</div>
<div class="prod-card__second-line-img">
<a class="prod-card__link" onclick="OpenOnlyDapp({Item.Num},{Item.HTMLLength})"><img src="{Item.IconPath}" width="32"></a>
<a class="prod-card__link" onclick="OpenOnlyDapp($Item.Num,$Item.HTMLLength)"><img $item.iconpath width="32"></a>
</div>
</div>
</li>
@ -436,9 +425,10 @@
<section id="TabExplorer" class="explorer-page" style="display: none;">
<div id="idCurrentBlockNum" class="currentBlockNum">
<p><span>Blockchain height:</span> <b id="idBHeight">26003136</b></p>
<p><span>Current create:</span> <b id="idBCurrent">26003140</b></p>
<p><span>Protocol ver:</span> <b id="idBVersion">0.1057</b></p>
<p><span>Blockchain height:</span> <b id="idBHeight">00000000</b></p>
<!--<p><span>Current create:</span> <b id="idBCurrent">00000000</b></p>-->
<p><span>Protocol ver:</span> <b id="idBVersion">00000</b></p>
<p><span>Wallet ver:</span> <b id="idWVersion">000</b></p>
</div>
<button onclick="ViewCurrent(DefAccounts,1,this);" class="btview explorer-page__explore btn btn--white btn--full-width">Accounts</button>
@ -518,12 +508,12 @@
<section class="dapp-modal modal" id="DappCardTemplate" style="display: none;">
<div class="modal__header">
<div class="modal__title-wrap">
<span class="light-grey-text">ID: {Item.Num}</span>
<h3>{Item.Name}</h3>
<span class="light-grey-text">ID: $Item.Num</span>
<h3>$Item.Name</h3>
<ol class="modal__ol">
<li class="modal__category dappcategory1">{Item.Category1}</li>
<li class="modal__category dappcategory2">{Item.Category2}</li>
<li class="modal__category dappcategory3">{Item.Category3}</li>
<li class="modal__category dappcategory1">$Item.Category1</li>
<li class="modal__category dappcategory2">$Item.Category2</li>
<li class="modal__category dappcategory3">$Item.Category3</li>
</ol>
<p class="dapp-modal__token-status dapp-modal__token-status--ok">
<!--<span class="light-grey-text">Without token generate</span>-->
@ -531,27 +521,27 @@
</p>
</div>
<div class="modal__img-wrap">
<img src="{Item.IconPath}" alt="dApp logo" width="32">
<img $item.iconpath alt="dApp logo" width="32">
</div>
</div>
<p>{Item.Description}</p>
<p>$Item.Description</p>
<dl class="modal__def-list def-list">
<div class="def-list__item">
<dt>Account</dt>
<dd>{Item.Account}</dd>
<dd>$Item.Account</dd>
</div>
<div class="def-list__item">
<dt>Owner</dt>
<dd>{Item.Owner}</dd>
<dd>$Item.Owner</dd>
</div>
<div class="def-list__item">
<dt>Block num</dt>
<dd>{Item.BlockNum}</dd>
<dd>$Item.BlockNum</dd>
</div>
</dl>
<div class="modal__btns-wrap">
<button class="btn" onclick="OpenOnlyDapp({Item.Num},{Item.HTMLLength})">Open DApp</button>
<button class="btn" onclick="OpenOnlyDapp($Item.Num,$Item.HTMLLength)">Open DApp</button>
<button class="btn btn--white" onclick="closeModal()">Back</button>
</div>

View File

@ -565,33 +565,6 @@ export default class CConnect extends CMessages {
Info.Node.IsAddrList = Data.IsAddrList
global.AddNodeInfo(Info.Node, "RETGETNODES length=" + arr.length)
}
static RETGETNODES2_F() {
return "{arr:[\
{\
addrStr:str64,\
ip:str30,\
port:uint16,\
portweb:uint16,\
LastTime:uint,\
DeltaTime:uint,\
StatData:arr70\
}\
],\
IsAddrList:byte}";
}
RETGETNODES2(Info, CurTime) {
var Data = this.DataFromF(Info);
var arr = Data.arr;
if (arr && arr.length > 0) {
for (var i = 0; i < arr.length; i++) {
var Item = this.AddToArrNodes(arr[i], true);
if (Item)
Item.LastTimeGetNode = CurTime - 0
}
}
Info.Node.IsAddrList = Data.IsAddrList
global.AddNodeInfo(Info.Node, "RETGETNODES2 length=" + arr.length)
}
GetNewNode(ip, port, addrStr?) {
var bTemp;
if (!addrStr) {

View File

@ -134,7 +134,6 @@ export default class CTransport extends CConnect {
Map["GETBLOCK"] = { Period: global.PERIOD_GET_BLOCK, Hard: 2, Process: global.STATIC_PROCESS }
Map["GETNODES"] = { Period: 1000, Hard: 1, LowVersion: 1, IsAddrList: 1 }
Map["RETGETNODES"] = { Period: 0, IsAddrList: 1 }
Map["RETGETNODES2"] = { Period: 0, IsAddrList: 1 }
Map["GETCODE"] = { Period: 10000, Hard: 1, LowVersion: 1, Process: global.STATIC_PROCESS }
Map["RETBLOCKHEADER"] = { Period: 0 }
Map["RETBLOCKHEADER100"] = { Period: 0 }