1
0
Fork 0
merge-requests/3/head
progr76@gmail.com 2019-04-07 18:09:59 +03:00
parent c49425621c
commit e2104b0fa6
24 changed files with 180 additions and 96 deletions

Binary file not shown.

Binary file not shown.

View File

@ -13,6 +13,55 @@ function $(id)
{ {
return document.getElementById(id); return document.getElementById(id);
}; };
if(!Math.log2)
Math.log2 = Math.log2 || function (x)
{
return Math.log(x) * Math.LOG2E;
};
if(!window.crypto)
window.crypto = window.msCrypto;
if(!window.toStaticHTML)
toStaticHTML = function (Str)
{
return Str;
};
if(!String.prototype.padStart)
{
window.BrowserIE = 1;
String.prototype.padStart = function padStart(targetLength,padString)
{
targetLength = targetLength >> 0;
padString = String((typeof padString !== 'undefined' ? padString : ' '));
if(this.length > targetLength)
{
return String(this);
}
else
{
targetLength = targetLength - this.length;
if(targetLength > padString.length)
{
padString += padString.repeat(targetLength / padString.length);
}
return padString.slice(0, targetLength) + String(this);
}
};
}
window.Storage = {};
window.Storage.setItem = function (Key,Value)
{
if(window.localStorage)
localStorage.setItem(Key, Value);
};
window.Storage.getItem = function (Key)
{
if(window.localStorage)
return localStorage.getItem(Key);
};
window.IsLocalClient = function ()
{
return (window.location.protocol.substr(0, 4) !== "http");
};
var ServerHTTP; var ServerHTTP;
var MainServer; var MainServer;
if(window.nw) if(window.nw)
@ -74,7 +123,7 @@ else
} }
else else
{ {
if(!window.location.hostname) if(IsLocalClient())
return ; return ;
} }
} }
@ -789,7 +838,7 @@ function SetGridData(arr,id_name,TotalSum,bclear,revert)
if(cell0.H) if(cell0.H)
{ {
var text = "" + cell0.F(Item); var text = "" + cell0.F(Item);
text.trim(); text = toStaticHTML(text.trim());
if(cell.innerHTML !== text) if(cell.innerHTML !== text)
cell.innerHTML = text; cell.innerHTML = text;
} }
@ -873,7 +922,7 @@ function RetOpenDapps(Item,bNum,AccountNum)
if(Item.HTMLLength > 0) if(Item.HTMLLength > 0)
{ {
var StrText = RetIconDapp(Item) + Name; var StrText = RetIconDapp(Item) + Name;
return '<button class="bt_open_dapp" style="margin: -2px 0 0 0" onclick="OpenDapps(' + Item.Num + ',' + AccountNum + ')">' + StrText + '</button>'; return '<button type="button" class="bt_open_dapp" style="margin: -2px 0 0 0" onclick="OpenDapps(' + Item.Num + ',' + AccountNum + ')">' + StrText + '</button>';
} }
else else
return RetIconDapp(Item) + Name; return RetIconDapp(Item) + Name;
@ -1059,7 +1108,7 @@ function LoadValuesByArr(Arr,DopStr)
{ {
if(!DopStr) if(!DopStr)
DopStr = ""; DopStr = "";
if(localStorage["VerSave"] !== "3") if(Storage.getItem("VerSave") !== "3")
return 0; return 0;
for(var i = 0; i < Arr.length; i++) for(var i = 0; i < Arr.length; i++)
{ {
@ -1067,9 +1116,9 @@ function LoadValuesByArr(Arr,DopStr)
var Item = document.getElementById(name); var Item = document.getElementById(name);
var name2 = DopStr + name; var name2 = DopStr + name;
if(Item.type === "checkbox") if(Item.type === "checkbox")
Item.checked = parseInt(localStorage.getItem(name2)); Item.checked = parseInt(Storage.getItem(name2));
else else
Item.value = localStorage.getItem(name2); Item.value = Storage.getItem(name2);
} }
return 1; return 1;
}; };
@ -1078,16 +1127,16 @@ function SaveValuesByArr(Arr,DopStr)
{ {
if(!DopStr) if(!DopStr)
DopStr = ""; DopStr = "";
localStorage["VerSave"] = "3"; Storage.setItem("VerSave", "3");
for(var i = 0; i < Arr.length; i++) for(var i = 0; i < Arr.length; i++)
{ {
var name = Arr[i]; var name = Arr[i];
var name2 = DopStr + name; var name2 = DopStr + name;
var Item = $(name); var Item = $(name);
if(Item.type === "checkbox") if(Item.type === "checkbox")
window.localStorage.setItem(name2, 0 + Item.checked); window.Storage.setItem(name2, 0 + Item.checked);
else else
window.localStorage.setItem(name2, Item.value); window.Storage.setItem(name2, Item.value);
} }
}; };
var MapCurrency = {}; var MapCurrency = {};
@ -1290,7 +1339,7 @@ function FillCategory(IdName)
function AddToInvoiceList(Item) function AddToInvoiceList(Item)
{ {
var arr; var arr;
var Str = localStorage["InvoiceList"]; var Str = Storage.getItem("InvoiceList");
if(Str) if(Str)
{ {
arr = JSON.parse(Str); arr = JSON.parse(Str);
@ -1300,13 +1349,13 @@ function AddToInvoiceList(Item)
arr = []; arr = [];
} }
arr.unshift(Item); arr.unshift(Item);
localStorage["InvoiceList"] = JSON.stringify(arr); Storage.setItem("InvoiceList", JSON.stringify(arr));
}; };
function OpenDapps(Num,AccountNum) function OpenDapps(Num,AccountNum)
{ {
var StrPath = '/dapp/' + Num; var StrPath = '/dapp/' + Num;
if(window.location.protocol === "file:") if(IsLocalClient())
{ {
StrPath = "./dapp-frame.html?dapp=" + Num; StrPath = "./dapp-frame.html?dapp=" + Num;
} }
@ -1587,7 +1636,7 @@ function GetSignTransaction(TR,StrPrivKey,F)
function GetSignFromArr(Arr,StrPrivKey) function GetSignFromArr(Arr,StrPrivKey)
{ {
if(!StrPrivKey) if(!StrPrivKey)
StrPrivKey = localStorage["idPrivKey"]; StrPrivKey = Storage.getItem("idPrivKey");
if(!IsHexStr(StrPrivKey) || StrPrivKey.length !== 64) if(!IsHexStr(StrPrivKey) || StrPrivKey.length !== 64)
return "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; return "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
var PrivKey = GetArrFromHex(StrPrivKey); var PrivKey = GetArrFromHex(StrPrivKey);
@ -1633,7 +1682,7 @@ Number.prototype.toStringF = function ()
function CanClientSign() function CanClientSign()
{ {
var StrPrivKey = localStorage["idPrivKey"]; var StrPrivKey = Storage.getItem("idPrivKey");
if(!IsHexStr(StrPrivKey) || StrPrivKey.length !== 64) if(!IsHexStr(StrPrivKey) || StrPrivKey.length !== 64)
{ {
return 0; return 0;

View File

@ -35,10 +35,18 @@ function GetPowPower(arrhash)
var SumBit = 0; var SumBit = 0;
for(var i = 0; i < arrhash.length; i++) for(var i = 0; i < arrhash.length; i++)
{ {
var CurSum = Math.clz32(arrhash[i]) - 24; var byte = arrhash[i];
SumBit += CurSum; for(var b = 7; b >= 0; b--)
if(CurSum !== 8) {
break; if((byte >> b) & 1)
{
return SumBit;
}
else
{
SumBit++;
}
}
} }
return SumBit; return SumBit;
}; };
@ -265,9 +273,9 @@ function ComputeSecretWithCheck(PubKey,StrPrivKey,F)
function ComputeSecret(Account,PubKey,F) function ComputeSecret(Account,PubKey,F)
{ {
if(localStorage["idPrivKey"]) if(Storage.getItem("idPrivKey"))
{ {
ComputeSecretWithCheck(PubKey, localStorage["idPrivKey"], F); ComputeSecretWithCheck(PubKey, Storage.getItem("idPrivKey"), F);
} }
else else
{ {

View File

@ -11,6 +11,11 @@
var DiagramMap = {}; var DiagramMap = {};
var DiagramMapId = {}; var DiagramMapId = {};
var LMouseOn = false; var LMouseOn = false;
if(!window.toStaticHTML)
toStaticHTML = function (Str)
{
return Str;
};
function Rigth(Str,Count) function Rigth(Str,Count)
{ {
@ -44,11 +49,11 @@ function SetHTMLDiagramItem(Item,width)
} }
var ElBlock = document.getElementById("B" + Item.id); var ElBlock = document.getElementById("B" + Item.id);
if(ElBlock) if(ElBlock)
ElBlock.innerHTML = Str; ElBlock.innerHTML = toStaticHTML(Str);
else else
{ {
var diargams = document.getElementById("diargams"); var diargams = document.getElementById("diargams");
diargams.innerHTML += "<DIV id='B" + Item.id + "'>" + Str + "</DIV>"; diargams.innerHTML = toStaticHTML(diargams.innerHTML + "<DIV id='B" + Item.id + "'>" + Str + "</DIV>");
} }
}; };

View File

@ -285,7 +285,7 @@ function AddWhiteList()
{ {
var ToID = ParseNum($("idTo").value); var ToID = ParseNum($("idTo").value);
if(ToID && $("idWhiteOnSend").checked) if(ToID && $("idWhiteOnSend").checked)
localStorage["White:" + ToID] = 1; Storage.setItem("White:" + ToID, 1);
}; };
function SendMoneyBefore() function SendMoneyBefore()
@ -294,7 +294,7 @@ function SendMoneyBefore()
return ; return ;
var ToID = ParseNum($("idTo").value); var ToID = ParseNum($("idTo").value);
var Item = MapAccounts[ToID]; var Item = MapAccounts[ToID];
if(localStorage["White:" + ToID] || !$("idSumSend").value || Item && Item.MyAccount) if(Storage.getItem("White:" + ToID) || !$("idSumSend").value || Item && Item.MyAccount)
{ {
SendMoney(); SendMoney();
} }
@ -530,7 +530,7 @@ function CheckSendList(bRedraw)
TitleWarning = PayList.length; TitleWarning = PayList.length;
if(AttachItem) if(AttachItem)
TitleWarning++; TitleWarning++;
var Str = localStorage["InvoiceList"]; var Str = Storage.getItem("InvoiceList");
if(!Str && !bRedraw) if(!Str && !bRedraw)
return ; return ;
if(!bRedraw) if(!bRedraw)
@ -544,7 +544,7 @@ function CheckSendList(bRedraw)
{ {
AddSendList(arr[i]); AddSendList(arr[i]);
} }
localStorage["InvoiceList"] = ""; Storage.setItem("InvoiceList", "");
} }
var idList = $("idSendList"); var idList = $("idSendList");
if(PayList.length) if(PayList.length)

View File

@ -43,7 +43,7 @@ function StartWebWallet()
function OnInitWebWallet() function OnInitWebWallet()
{ {
var str = localStorage.getItem(NETWORK + "NodesArrayList"); var str = Storage.getItem(NETWORK + "NodesArrayList");
if(str) if(str)
{ {
var arr = JSON.parse(str); var arr = JSON.parse(str);
@ -68,20 +68,23 @@ function SaveServerMap()
arr.push({ip:Item.ip, port:Item.port}); arr.push({ip:Item.ip, port:Item.port});
} }
} }
localStorage.setItem(NETWORK + "NodesArrayList", JSON.stringify(arr)); Storage.setItem(NETWORK + "NodesArrayList", JSON.stringify(arr));
}; };
function SetStatus(Str) function SetStatus(Str)
{ {
var id = $("idStatus"); var id = $("idStatus");
id.innerHTML = Str; id.innerHTML = Str;
console.log(id.innerText); if(Str)
console.log(id.innerText);
}; };
function SetError(Str,bNoSound) function SetError(Str,bNoSound)
{ {
SetStatus("<DIV align='left' style='color:red'><B>" + Str + "</B></DIV>"); SetStatus("<DIV align='left' style='color:red'><B>" + Str + "</B></DIV>");
}; };
var CountConnect = 0;
var CountWallet = 0;
function ConnectWebWallet() function ConnectWebWallet()
{ {
@ -92,6 +95,13 @@ function ConnectWebWallet()
var Item = ServerMap[key]; var Item = ServerMap[key];
Item.SendHandShake = 0; Item.SendHandShake = 0;
} }
if(window.BrowserIE && !IsLocalClient())
{
MainServer = undefined;
return ;
}
CountConnect = 0;
CountWallet = 0;
SetStatus("Connecting..."); SetStatus("Connecting...");
LoopHandShake(); LoopHandShake();
setTimeout(LoopWalletInfo, 1500); setTimeout(LoopWalletInfo, 1500);
@ -107,6 +117,9 @@ function LoopHandShake()
var Item = ServerMap[key]; var Item = ServerMap[key];
if(Item.SendHandShake || !Item.port) if(Item.SendHandShake || !Item.port)
continue; continue;
CountConnect++;
if(window.BrowserIE && CountConnect > 4)
break;
DoNodeList(Item); DoNodeList(Item);
} }
}; };
@ -155,6 +168,9 @@ function LoopWalletInfo()
var Item = ServerMap[key]; var Item = ServerMap[key];
if(Item.port) if(Item.port)
{ {
CountWallet++;
if(window.BrowserIE && CountWallet > 4)
break;
DoWalletInfo(Item); DoWalletInfo(Item);
} }
} }

View File

@ -15,6 +15,8 @@
<script> <script>
window.Storage=window.localStorage;
var DapNumber="#template-number#"; var DapNumber="#template-number#";
var glSmart=parseInt(DapNumber); var glSmart=parseInt(DapNumber);
var CONFIG_DATA={}; var CONFIG_DATA={};
@ -62,12 +64,12 @@
} }
case "setstorage": case "setstorage":
{ {
localStorage.setItem("DAPP-"+DapNumber+"-"+Data.Key,JSON.stringify(Data.Value)); Storage.setItem("DAPP-"+DapNumber+"-"+Data.Key,JSON.stringify(Data.Value));
break; break;
} }
case "getstorage": case "getstorage":
{ {
Data.Value=localStorage.getItem("DAPP-"+DapNumber+"-"+Data.Key); Data.Value=Storage.getItem("DAPP-"+DapNumber+"-"+Data.Key);
if(Data.Value) if(Data.Value)
Data.Value=JSON.parse(Data.Value); Data.Value=JSON.parse(Data.Value);
SendMessage(Data); SendMessage(Data);
@ -75,12 +77,12 @@
} }
case "setcommon": case "setcommon":
{ {
localStorage.setItem("DAPP-"+Data.Key,JSON.stringify(Data.Value)); Storage.setItem("DAPP-"+Data.Key,JSON.stringify(Data.Value));
break; break;
} }
case "getcommon": case "getcommon":
{ {
Data.Value=localStorage.getItem("DAPP-"+Data.Key); Data.Value=Storage.getItem("DAPP-"+Data.Key);
if(Data.Value) if(Data.Value)
Data.Value=JSON.parse(Data.Value); Data.Value=JSON.parse(Data.Value);
SendMessage(Data); SendMessage(Data);
@ -129,7 +131,7 @@
AllData=1; AllData=1;
NumDappGet++; NumDappGet++;
var Key=localStorage["idPubKey"]; var Key=Storage.getItem("idPubKey");
GetData("DappInfo",{Smart:glSmart,Key:Key,Session:glSession,NumDappInfo:NumDappInfo,AllData:AllData,AllAccounts:Data.AllAccounts}, function (SetData) GetData("DappInfo",{Smart:glSmart,Key:Key,Session:glSession,NumDappInfo:NumDappInfo,AllData:AllData,AllAccounts:Data.AllAccounts}, function (SetData)
{ {
if(SetData) if(SetData)
@ -153,8 +155,8 @@
if(!Data.PubKey) if(!Data.PubKey)
{ {
//support web/light wallet mode: //support web/light wallet mode:
Data.PubKey=localStorage["idPubKey"]; Data.PubKey=Storage.getItem("idPubKey");
Data.WalletIsOpen=IsPrivateMode(localStorage["idPrivKey"]); Data.WalletIsOpen=IsPrivateMode(Storage.getItem("idPrivKey"));
Data.WalletCanSign=Data.WalletIsOpen; Data.WalletCanSign=Data.WalletIsOpen;
} }
CONFIG_DATA.WalletCanSign=Data.WalletCanSign; CONFIG_DATA.WalletCanSign=Data.WalletCanSign;
@ -167,7 +169,7 @@
break; break;
} }
case "DappWalletList": case "DappWalletList":
var Key=localStorage["idPubKey"]; var Key=Storage.getItem("idPubKey");
Data.Params={Smart:glSmart,Key:Key}; Data.Params={Smart:glSmart,Key:Key};
case "DappSmartHTMLFile": case "DappSmartHTMLFile":
case "DappBlockFile": case "DappBlockFile":
@ -182,8 +184,8 @@
//check storage //check storage
var StrKeyStorage=Data.Params.BlockNum+"-"+Data.Params.TrNum; var StrKeyStorage=Data.Params.BlockNum+"-"+Data.Params.TrNum;
var Storage=sessionStorage; var Storage2=sessionStorage;
var SavedTextData=Storage[StrKeyStorage]; var SavedTextData=Storage2[StrKeyStorage];
if(SavedTextData) if(SavedTextData)
{ {
var SetData=JSON.parse(SavedTextData); var SetData=JSON.parse(SavedTextData);
@ -206,7 +208,7 @@
SendMessage(Data); SendMessage(Data);
if(StrKeyStorage && SetData.result) if(StrKeyStorage && SetData.result)
{ {
Storage[StrKeyStorage]=responseText; Storage2[StrKeyStorage]=responseText;
} }
} }
}); });
@ -237,7 +239,11 @@
} }
case "OpenLink": case "OpenLink":
{ {
window.open(Data.Message); var Path=Data.Message.substr(0,200);
if(IsLocalClient() && Path.substr(0,6)==="/dapp/")
Path="?dapp="+Path.substr(6);
//console.log("OpenLink:"+Path);
window.open(Path);
break; break;
} }
case "ComputeSecret": case "ComputeSecret":
@ -284,18 +290,18 @@
{ {
if(window.location.hash) if(window.location.hash)
OPEN_PATH=window.location.hash.substr(1); OPEN_PATH=window.location.hash.substr(1);
if(window.location.protocol==="file:") if(IsLocalClient())
{ {
DapNumber=window.location.search.substr(6); DapNumber=window.location.search.substr(6);
if(localStorage["MainServer"]) if(Storage.getItem("MainServer"))
{ {
MainServer=JSON.parse(localStorage["MainServer"]); MainServer=JSON.parse(Storage.getItem("MainServer"));
} }
} }
glSmart=parseInt(DapNumber); glSmart=parseInt(DapNumber);
var Key=localStorage["idPubKey"]; var Key=Storage.getItem("idPubKey");
GetData("DappInfo",{Smart:glSmart, Key:Key, Session:glSession, AllData:1}, function (SetData) GetData("DappInfo",{Smart:glSmart, Key:Key, Session:glSession, AllData:1}, function (SetData)
{ {
if(!SetData || !SetData.result) if(!SetData || !SetData.result)
@ -414,7 +420,7 @@
StrRef='<A class="btcreate" href="./web-wallet.html#TabAccounts">Accounts</A>'; StrRef='<A class="btcreate" href="./web-wallet.html#TabAccounts">Accounts</A>';
else else
{ {
if(localStorage["BIGWALLET"]) if(Storage.getItem("BIGWALLET"))
StrRef='<A class="btcreate" href="/wallet.html#TabAccounts">Config</A>' StrRef='<A class="btcreate" href="/wallet.html#TabAccounts">Config</A>'
else else
StrRef='<A class="btcreate" href="/web-wallet.html#TabAccounts">Accounts</A>'; StrRef='<A class="btcreate" href="/web-wallet.html#TabAccounts">Accounts</A>';
@ -480,9 +486,9 @@
var arr = new Uint8Array(32); var arr = new Uint8Array(32);
window.crypto.getRandomValues(arr); window.crypto.getRandomValues(arr);
var PrivKey=GetHexFromArr(sha3(arr)); var PrivKey=GetHexFromArr(sha3(arr));
localStorage["idPrivKey"]=PrivKey; Storage.setItem("idPrivKey",PrivKey);
localStorage["idPubKey"]=GetHexFromArr(SignLib.publicKeyCreate(PrivKey,1)); Storage.setItem("idPubKey",GetHexFromArr(SignLib.publicKeyCreate(PrivKey,1)));
CONFIG_DATA.PubKey=localStorage["idPubKey"]; CONFIG_DATA.PubKey=Storage.getItem("idPubKey");
console.log("CreateNewWebKeys: "+CONFIG_DATA.PubKey); console.log("CreateNewWebKeys: "+CONFIG_DATA.PubKey);
} }
@ -492,7 +498,7 @@
{ {
if(!CONFIG_DATA.WalletCanSign) if(!CONFIG_DATA.WalletCanSign)
{ {
if(localStorage["BIGWALLET"]) if(Storage.getItem("BIGWALLET"))
{ {
SetError("Pls, open wallet"); SetError("Pls, open wallet");
return; return;
@ -533,14 +539,14 @@
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height:20px; height:18px;
padding: 0; padding: 0;
margin: 0; margin: 0;
background-color:white; background-color:white;
} }
.btcreate .btcreate
{ {
height:20px; height:18px;
background-color: #347867; background-color: #347867;
color: white; color: white;
cursor: pointer; cursor: pointer;
@ -558,18 +564,12 @@
</html> </html>
<script> <script>
var glDebugPath=""; var glDebugPath="";
// glDebugPath="./dapp-smart/forum.html"; //glDebugPath="./dapp-smart/forum.html";
//glDebugPath="./dapp-smart/DEX.html"; //glDebugPath="./dapp-smart/DEX.html";
//glDebugPath="./dapp-smart/test-load.html";
// glDebugPath="./dapp-smart/gambling-1.html";
// glDebugPath="./dapp-smart/BTC-coin.html";
// glDebugPath="./dapp-smart/freeze.html";
// glDebugPath="./dapp-smart/promise.html";
//glDebugPath="./dapp-smart/OnlineStore.html"; //glDebugPath="./dapp-smart/OnlineStore.html";
//glDebugPath="./dapp-smart/Clicker.html"; //glDebugPath="./dapp-smart/BTC-coin.html";
//{"HTMLBlock":3492141,"HTMLTr":0} //glDebugPath="./dapp-smart/static/miner-list.html";
//glDebugPath="./dapp-smart/static/ReadAccountArr.html";
//{"HTMLBlock":24201380,"HTMLTr":0}
</script> </script>

View File

@ -764,7 +764,8 @@
{ {
CurTabName=name; CurTabName=name;
OnSelectTab(name); OnSelectTab(name);
window.location.hash="#"+name; history.pushState(null,null,"#"+name);
//window.location.hash="#"+name;
SetVisibleTab(); SetVisibleTab();
SaveValues(); SaveValues();
@ -1483,7 +1484,7 @@
<td>Amount</td> <td>Amount</td>
<td> <td>
<INPUT type="number" id="idSumSend" style="color:#1e21cb" value="" step=0 min=0 max=1000000000 onkeyup="OnEditTransactionFields()" onchange="OnEditTransactionFields()">&nbsp; <INPUT type="number" id="idSumSend" style="color:#1e21cb" value="" step=0 min=0 max=1000000000 onkeyup="OnEditTransactionFields()" onchange="OnEditTransactionFields()">&nbsp;
<button style="font-family: monospace;" onclick="SetAllSum()"><-</button> <button style="font-family: monospace;" onclick="SetAllSum()"></button>
<B id="idCoinName"></B> <B id="idCoinName"></B>
</td> </td>
</tr> </tr>

View File

@ -41,7 +41,7 @@
{ {
LoadSignLib(); LoadSignLib();
if(localStorage["NETWORK"] || window.location.protocol==="file:") if(localStorage["NETWORK"] || IsLocalClient())
{ {
OnLoad(); OnLoad();
} }
@ -914,7 +914,7 @@
<td>数量</td> <td>数量</td>
<td> <td>
<INPUT type="number" id="idSumSend" style="color:#1e21cb" value="" step=0 min=0 max=1000000000 oninput="OnEditTransactionFields()">&nbsp; <INPUT type="number" id="idSumSend" style="color:#1e21cb" value="" step=0 min=0 max=1000000000 oninput="OnEditTransactionFields()">&nbsp;
<button style="font-family: monospace;" onclick="SetAllSum()"><-</button> <button style="font-family: monospace;" onclick="SetAllSum()"></button>
<B id="idCoinName"></B> <B id="idCoinName"></B>
</td> </td>
</tr> </tr>

View File

@ -22,13 +22,15 @@
<script> <script>
// window.WEBWALLET=1; // window.WEBWALLET=1;
var PubKeyStr; var PubKeyStr;
var NumAccountList=0; var NumAccountList=0;
//Pagination //Pagination
var SaveIdArr=["idAccount","idTo","idSumSend","idDescription","idCurTabName","idPubKey","idPrivKey","idViewBlockNum","idViewAccountNum","idViewDappNum"]; var SaveIdArr=["idAccount","idTo","idSumSend","idDescription","idCurTabName","idPubKey","idPrivKey","idViewBlockNum","idViewAccountNum","idViewDappNum"];
var CONFIG_DATA={};
CONFIG_DATA={PRICE_DAO:{NewAccount:10}}; var CONFIG_DATA={PRICE_DAO:{NewAccount:10},MaxNumBlockDB:0,MaxAccID:0,MaxDappsID:0};
var CountViewRows=20; var CountViewRows=20;
var DefAccounts={BlockName:"idPaginationAccount", NumName:"idViewAccountNum", TabName:"explorer_accounts",APIName:"GetAccountList"}; var DefAccounts={BlockName:"idPaginationAccount", NumName:"idViewAccountNum", TabName:"explorer_accounts",APIName:"GetAccountList"};
var DefBlock={BlockName:"idPaginationBlock", NumName:"idViewBlockNum", TabName:"explorer_blocks",APIName:"GetBlockList"}; var DefBlock={BlockName:"idPaginationBlock", NumName:"idViewBlockNum", TabName:"explorer_blocks",APIName:"GetBlockList"};
@ -41,7 +43,7 @@
{ {
LoadSignLib(); LoadSignLib();
if(localStorage["NETWORK"] || window.location.protocol==="file:") if(Storage.getItem("NETWORK") || IsLocalClient())
{ {
OnLoad(); OnLoad();
} }
@ -51,7 +53,7 @@
{ {
if(Data && Data.result) if(Data && Data.result)
{ {
localStorage["NETWORK"]=Data.NETWORK; Storage.setItem("NETWORK",Data.NETWORK);
console.log("Default network: "+Data.NETWORK); console.log("Default network: "+Data.NETWORK);
OnLoad(); OnLoad();
@ -62,8 +64,8 @@
function OnLoad() function OnLoad()
{ {
if(localStorage["NETWORK"]) if(Storage.getItem("NETWORK"))
NETWORK=localStorage["NETWORK"]; NETWORK=Storage.getItem("NETWORK");
@ -105,7 +107,7 @@
{ {
NETWORK="TERA-TEST2"; NETWORK="TERA-TEST2";
} }
localStorage["NETWORK"]=NETWORK; Storage.setItem("NETWORK",NETWORK);
StartWebWallet(); StartWebWallet();
UpdatesExplorerData(); UpdatesExplorerData();
@ -118,11 +120,11 @@
if(!MainServer) if(!MainServer)
{ {
SetStatus("Server not found"); SetStatus("Server not found");
delete localStorage["MainServer"]; Storage.setItem("MainServer",undefined);
return; return;
} }
localStorage["MainServer"]=JSON.stringify(MainServer);//for use in dapp Storage.setItem("MainServer",JSON.stringify(MainServer));//for use in dapp
//currency fill //currency fill
FillCurrencyAsync("idAccountCur"); FillCurrencyAsync("idAccountCur");
@ -161,7 +163,9 @@
SetVisibleTab(); SetVisibleTab();
SaveValues(); SaveValues();
OnSelectTab(name); OnSelectTab(name);
window.location.hash="#"+name;
if(history.pushState)
history.pushState(null,null,"#"+name);
} }
function OnSelectTab(name) function OnSelectTab(name)
{ {
@ -264,7 +268,7 @@
{ {
Str="OK. Using Private key."; Str="OK. Using Private key.";
} }
$("idPrivKeyButton").innerHTML=Str; $("idPrivKeyButton").innerHTML=toStaticHTML(Str);
} }
if(EditFlag) if(EditFlag)
@ -421,7 +425,7 @@
var StrVersion=" 0."+Data.VersionNum; var StrVersion=" 0."+Data.VersionNum;
var Str="Blockchain height: <B>"+Data.MaxNumBlockDB+"</B> Current create: <B>"+Data.CurBlockNum+"</B> Wallet ver:"+"<B>"+StrVersion+"</B>"; var Str="Blockchain height: <B>"+Data.MaxNumBlockDB+"</B> Current create: <B>"+Data.CurBlockNum+"</B> Wallet ver:"+"<B>"+StrVersion+"</B>";
$("idCurrentBlockNum").innerHTML=Str; $("idCurrentBlockNum").innerHTML=toStaticHTML(Str);
SetArrLog(Data.ArrLog); SetArrLog(Data.ArrLog);
@ -527,7 +531,7 @@
background-color: #22547f; background-color: #22547f;
margin: 0; margin: 0;
padding: 0; padding: 0;
height: 34px; height: 24px;
} }
.bttab .bttab
{ {
@ -538,7 +542,7 @@
width: 100%; width: 100%;
margin: 0; margin: 0;
padding-top: 7px; padding-top: 7px;
height: 100%; height: 24px;
border: 1px solid white; border: 1px solid white;
} }
.bttab:hover .bttab:hover
@ -666,6 +670,7 @@
{ {
text-align: left; text-align: left;
width: 90px; width: 90px;
min-width: 90px;
font-size: small; font-size: small;
} }
td.hash td.hash
@ -807,7 +812,7 @@
<th><DIV id="MTabExplorer" onclick="SelectTab('TabExplorer')" class="bttab">EXPLORER</DIV></th> <th><DIV id="MTabExplorer" onclick="SelectTab('TabExplorer')" class="bttab">EXPLORER</DIV></th>
</tr> </tr>
</table> </table>
<table><tr><td><DIV id="idStatus">&nbsp;</DIV></td><td><button id="idNetwork" onclick="ChangeNetwork()"></button></td></tr></table> <table><tr><td><DIV id="idStatus">&nbsp;</DIV></td><td><button id="idNetwork" style="height: 24px;" onclick="ChangeNetwork()"></button></td></tr></table>
<DIV id="TabLogo" style="display: block;"> <DIV id="TabLogo" style="display: block;">
@ -914,7 +919,7 @@
<td>Amount</td> <td>Amount</td>
<td> <td>
<INPUT type="number" id="idSumSend" style="color:#1e21cb" value="" step=0 min=0 max=1000000000 oninput="OnEditTransactionFields()">&nbsp; <INPUT type="number" id="idSumSend" style="color:#1e21cb" value="" step=0 min=0 max=1000000000 oninput="OnEditTransactionFields()">&nbsp;
<button style="font-family: monospace;" onclick="SetAllSum()"><-</button> <button style="font-family: monospace;" onclick="SetAllSum()"></button>
<B id="idCoinName"></B> <B id="idCoinName"></B>
</td> </td>
</tr> </tr>

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -149,7 +149,7 @@
<h2 class="title">关于 TERA泰瑞</h2> <h2 class="title">关于 TERA泰瑞</h2>
</div> </div>
<p style="text-align: center;"> <p style="text-align: center;">
<img src="../PIC/Tera_Logo.png" align="center" width="240" /> <img src="../PIC/TERA_logo-03.png" align="center" width="240" />
</p> </p>
<p style="text-align: justify; font-size: 15px;"> <p style="text-align: justify; font-size: 15px;">
非常荣幸邀请您加入TERA挖矿。现有加密货币在以下方面存在问题中心化、交易吞吐量、交易速度、确认时间、交易税费以及一般可用性、难以整合到现有支付系统和金融系统。TERA提供了针对以上问题的解决方案。 非常荣幸邀请您加入TERA挖矿。现有加密货币在以下方面存在问题中心化、交易吞吐量、交易速度、确认时间、交易税费以及一般可用性、难以整合到现有支付系统和金融系统。TERA提供了针对以上问题的解决方案。

View File

@ -218,7 +218,7 @@
<h2 class="title">Über TERA</h2> <h2 class="title">Über TERA</h2>
</div> </div>
<p style="text-align: center;"> <p style="text-align: center;">
<img src="../PIC/Tera_Logo.png" align="center" width="240" /> <img src="../PIC/TERA_logo-03.png" align="center" width="240" />
</p> </p>
<p style="text-align: justify; font-size: 15px;"> <p style="text-align: justify; font-size: 15px;">
Wir freuen uns darüber dich auf unserer Website begrüßen zu dürfen. Mit TERA möchten wir den Menschen das Thema Blockchain und dezentralisierte Apps (dApps) auf eine neue, einfachere und vor allem, im Sinne der Dezentralisierung, richtige Weise näher bringen. TERA vereint alle erforderlichen Eigenschaften, um bereits bekannte Technologien abzulösen und die Krypto Welt zu revolutionieren. Wir freuen uns darüber dich auf unserer Website begrüßen zu dürfen. Mit TERA möchten wir den Menschen das Thema Blockchain und dezentralisierte Apps (dApps) auf eine neue, einfachere und vor allem, im Sinne der Dezentralisierung, richtige Weise näher bringen. TERA vereint alle erforderlichen Eigenschaften, um bereits bekannte Technologien abzulösen und die Krypto Welt zu revolutionieren.

View File

@ -149,7 +149,7 @@
<h1>О TERA</h1> <h1>О TERA</h1>
</div> </div>
<p class="tera-logo-panel"> <p class="tera-logo-panel">
<img src="../PIC/Tera_Logo.png" width="240" /> <img src="../PIC/TERA_logo-03.png" width="240" />
</p> </p>
<p> <p>
Рады предложить вам присоединиться к проекту TERA. Блокчейн TERA предлагает решения самых популярных проблем в области криптовалют: централизация, пропусканая способность, скорость осуществления транзакций, время подтверждения, комиссия за транзакции и общее удобство использования функционала рынка. Рады предложить вам присоединиться к проекту TERA. Блокчейн TERA предлагает решения самых популярных проблем в области криптовалют: централизация, пропусканая способность, скорость осуществления транзакций, время подтверждения, комиссия за транзакции и общее удобство использования функционала рынка.

View File

@ -8,8 +8,8 @@
* Telegram: https://web.telegram.org/#/im?p=@terafoundation * Telegram: https://web.telegram.org/#/im?p=@terafoundation
*/ */
global.UPDATE_CODE_VERSION_NUM = 993; global.UPDATE_CODE_VERSION_NUM = 995;
global.MIN_CODE_VERSION_NUM = 922; global.MIN_CODE_VERSION_NUM = 992;
global.MINING_VERSION_NUM = 3; global.MINING_VERSION_NUM = 3;
global.InitParamsArg = InitParamsArg; global.InitParamsArg = InitParamsArg;
global.CONST_NAME_ARR = ["AUTO_CORRECT_TIME", "DELTA_CURRENT_TIME", "COMMON_KEY", "NODES_NAME", "SERVER_PRIVATE_KEY_HEX", "USE_NET_FOR_SERVER_ADDRES", global.CONST_NAME_ARR = ["AUTO_CORRECT_TIME", "DELTA_CURRENT_TIME", "COMMON_KEY", "NODES_NAME", "SERVER_PRIVATE_KEY_HEX", "USE_NET_FOR_SERVER_ADDRES",

View File

@ -496,7 +496,7 @@ class SmartApp extends require("./dapp")
if(global.LOCAL_RUN || global.TEST_NETWORK) if(global.LOCAL_RUN || global.TEST_NETWORK)
this.RowHole = {} this.RowHole = {}
else else
this.RowHole = {"19":1, "22":1, "23":1, "24":1, "26":1, "27":1, "29":1, "30":1, "34":1} this.RowHole = {"19":1, "22":1, "23":1, "24":1, "26":1, "27":1, "29":1, "30":1, "34":1, "56":1, "57":1}
} }
IsHole(num) IsHole(num)
{ {

View File

@ -35,8 +35,9 @@ setTimeout(function ()
global.glCurNumFindArr = 0; global.glCurNumFindArr = 0;
global.ArrReconnect = []; global.ArrReconnect = [];
global.ArrConnect = []; global.ArrConnect = [];
var FindList = [{"ip":"149.154.70.158", "port":30000}, {"ip":"69.30.225.26", "port":30000}, {"ip":"185.240.243.182", "port":30000}, var FindList = [{"ip":"91.235.136.81", "port":30005}, {"ip":"149.154.70.158", "port":30000}, {"ip":"69.30.225.26", "port":30000},
{"ip":"212.109.197.205", "port":30000}, {"ip":"212.109.197.209", "port":30000}, {"ip":"80.87.192.24", "port":30000}, ]; {"ip":"185.240.243.182", "port":30000}, {"ip":"212.109.197.205", "port":30000}, {"ip":"212.109.197.209", "port":30000}, {"ip":"80.87.192.24",
"port":30000}, ];
if(global.LOCAL_RUN) if(global.LOCAL_RUN)
{ {
FindList = [{"ip":"127.0.0.1", "port":50001}, {"ip":"127.0.0.1", "port":50002}]; FindList = [{"ip":"127.0.0.1", "port":50001}, {"ip":"127.0.0.1", "port":50002}];
@ -226,6 +227,7 @@ function StartChildProcess(Item)
} }
catch(e) catch(e)
{ {
ToLog("ERR KILL");
return ; return ;
} }
ITEM.Worker = undefined; ITEM.Worker = undefined;
@ -236,6 +238,8 @@ function StartChildProcess(Item)
ITEM.LastAlive = (Date.now()) + ITEM.PeriodAlive * 3; ITEM.LastAlive = (Date.now()) + ITEM.PeriodAlive * 3;
ToLog("STARTING " + ITEM.Name); ToLog("STARTING " + ITEM.Name);
ITEM.Worker = Fork(ITEM.Path, ["READONLYDB"]); ITEM.Worker = Fork(ITEM.Path, ["READONLYDB"]);
ITEM.pid = ITEM.Worker.pid;
ToLog("STARTED " + ITEM.Name + ":" + ITEM.pid);
ITEM.Worker.on('message', function (msg) ITEM.Worker.on('message', function (msg)
{ {
if(ITEM.LastAlive < Date.now()) if(ITEM.LastAlive < Date.now())
@ -319,12 +323,10 @@ function StartChildProcess(Item)
ITEM.Worker.on('error', function (err) ITEM.Worker.on('error', function (err)
{ {
ToError("ERROR IN " + ITEM.Name + " Err : " + err); ToError("ERROR IN " + ITEM.Name + " Err : " + err);
ITEM.Worker = undefined;
}); });
ITEM.Worker.on('close', function (code) ITEM.Worker.on('close', function (code)
{ {
ToError("CLOSE " + ITEM.Name); ToError("CLOSE " + ITEM.Name);
ITEM.Worker = undefined;
}); });
} }
} }

View File

@ -846,10 +846,8 @@ catch(e)
} }
global.LoadBlockFromNetwork = function (Params,F) global.LoadBlockFromNetwork = function (Params,F)
{ {
ToLog("RUN: LoadBlockFromNetwork:" + Params.BlockNum);
process.RunRPC("LoadBlockFromNetwork", {BlockNum:Params.BlockNum, F:1}, function (Err,Block) process.RunRPC("LoadBlockFromNetwork", {BlockNum:Params.BlockNum, F:1}, function (Err,Block)
{ {
ToLog("RETURN: LoadBlockFromNetwork: " + Params.BlockNum);
F(Err, Block); F(Err, Block);
}); });
}; };