diff --git a/Bin/Light/Tera-light.zip b/Bin/Light/Tera-light.zip index bd4d772..c06ab5d 100644 Binary files a/Bin/Light/Tera-light.zip and b/Bin/Light/Tera-light.zip differ diff --git a/Bin/Light/tera_light_setup.exe b/Bin/Light/tera_light_setup.exe index ce18c8d..d323783 100644 Binary files a/Bin/Light/tera_light_setup.exe and b/Bin/Light/tera_light_setup.exe differ diff --git a/Source/HTML/JS/client.js b/Source/HTML/JS/client.js index 1db5032..7445b71 100644 --- a/Source/HTML/JS/client.js +++ b/Source/HTML/JS/client.js @@ -13,6 +13,55 @@ function $(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 MainServer; if(window.nw) @@ -74,7 +123,7 @@ else } else { - if(!window.location.hostname) + if(IsLocalClient()) return ; } } @@ -789,7 +838,7 @@ function SetGridData(arr,id_name,TotalSum,bclear,revert) if(cell0.H) { var text = "" + cell0.F(Item); - text.trim(); + text = toStaticHTML(text.trim()); if(cell.innerHTML !== text) cell.innerHTML = text; } @@ -873,7 +922,7 @@ function RetOpenDapps(Item,bNum,AccountNum) if(Item.HTMLLength > 0) { var StrText = RetIconDapp(Item) + Name; - return ''; + return ''; } else return RetIconDapp(Item) + Name; @@ -1059,7 +1108,7 @@ function LoadValuesByArr(Arr,DopStr) { if(!DopStr) DopStr = ""; - if(localStorage["VerSave"] !== "3") + if(Storage.getItem("VerSave") !== "3") return 0; for(var i = 0; i < Arr.length; i++) { @@ -1067,9 +1116,9 @@ function LoadValuesByArr(Arr,DopStr) var Item = document.getElementById(name); var name2 = DopStr + name; if(Item.type === "checkbox") - Item.checked = parseInt(localStorage.getItem(name2)); + Item.checked = parseInt(Storage.getItem(name2)); else - Item.value = localStorage.getItem(name2); + Item.value = Storage.getItem(name2); } return 1; }; @@ -1078,16 +1127,16 @@ function SaveValuesByArr(Arr,DopStr) { if(!DopStr) DopStr = ""; - localStorage["VerSave"] = "3"; + Storage.setItem("VerSave", "3"); for(var i = 0; i < Arr.length; i++) { var name = Arr[i]; var name2 = DopStr + name; var Item = $(name); if(Item.type === "checkbox") - window.localStorage.setItem(name2, 0 + Item.checked); + window.Storage.setItem(name2, 0 + Item.checked); else - window.localStorage.setItem(name2, Item.value); + window.Storage.setItem(name2, Item.value); } }; var MapCurrency = {}; @@ -1290,7 +1339,7 @@ function FillCategory(IdName) function AddToInvoiceList(Item) { var arr; - var Str = localStorage["InvoiceList"]; + var Str = Storage.getItem("InvoiceList"); if(Str) { arr = JSON.parse(Str); @@ -1300,13 +1349,13 @@ function AddToInvoiceList(Item) arr = []; } arr.unshift(Item); - localStorage["InvoiceList"] = JSON.stringify(arr); + Storage.setItem("InvoiceList", JSON.stringify(arr)); }; function OpenDapps(Num,AccountNum) { var StrPath = '/dapp/' + Num; - if(window.location.protocol === "file:") + if(IsLocalClient()) { StrPath = "./dapp-frame.html?dapp=" + Num; } @@ -1587,7 +1636,7 @@ function GetSignTransaction(TR,StrPrivKey,F) function GetSignFromArr(Arr,StrPrivKey) { if(!StrPrivKey) - StrPrivKey = localStorage["idPrivKey"]; + StrPrivKey = Storage.getItem("idPrivKey"); if(!IsHexStr(StrPrivKey) || StrPrivKey.length !== 64) return "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; var PrivKey = GetArrFromHex(StrPrivKey); @@ -1633,7 +1682,7 @@ Number.prototype.toStringF = function () function CanClientSign() { - var StrPrivKey = localStorage["idPrivKey"]; + var StrPrivKey = Storage.getItem("idPrivKey"); if(!IsHexStr(StrPrivKey) || StrPrivKey.length !== 64) { return 0; diff --git a/Source/HTML/JS/crypto-client.js b/Source/HTML/JS/crypto-client.js index eb29a2c..e2bf30f 100644 --- a/Source/HTML/JS/crypto-client.js +++ b/Source/HTML/JS/crypto-client.js @@ -35,10 +35,18 @@ function GetPowPower(arrhash) var SumBit = 0; for(var i = 0; i < arrhash.length; i++) { - var CurSum = Math.clz32(arrhash[i]) - 24; - SumBit += CurSum; - if(CurSum !== 8) - break; + var byte = arrhash[i]; + for(var b = 7; b >= 0; b--) + { + if((byte >> b) & 1) + { + return SumBit; + } + else + { + SumBit++; + } + } } return SumBit; }; @@ -265,9 +273,9 @@ function ComputeSecretWithCheck(PubKey,StrPrivKey,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 { diff --git a/Source/HTML/JS/diagram.js b/Source/HTML/JS/diagram.js index ba05bde..173b2ff 100644 --- a/Source/HTML/JS/diagram.js +++ b/Source/HTML/JS/diagram.js @@ -11,6 +11,11 @@ var DiagramMap = {}; var DiagramMapId = {}; var LMouseOn = false; +if(!window.toStaticHTML) + toStaticHTML = function (Str) + { + return Str; + }; function Rigth(Str,Count) { @@ -44,11 +49,11 @@ function SetHTMLDiagramItem(Item,width) } var ElBlock = document.getElementById("B" + Item.id); if(ElBlock) - ElBlock.innerHTML = Str; + ElBlock.innerHTML = toStaticHTML(Str); else { var diargams = document.getElementById("diargams"); - diargams.innerHTML += "
" + Str + "
"; + diargams.innerHTML = toStaticHTML(diargams.innerHTML + "
" + Str + "
"); } }; diff --git a/Source/HTML/JS/wallet-lib.js b/Source/HTML/JS/wallet-lib.js index 1f209a3..a10af79 100644 --- a/Source/HTML/JS/wallet-lib.js +++ b/Source/HTML/JS/wallet-lib.js @@ -285,7 +285,7 @@ function AddWhiteList() { var ToID = ParseNum($("idTo").value); if(ToID && $("idWhiteOnSend").checked) - localStorage["White:" + ToID] = 1; + Storage.setItem("White:" + ToID, 1); }; function SendMoneyBefore() @@ -294,7 +294,7 @@ function SendMoneyBefore() return ; var ToID = ParseNum($("idTo").value); var Item = MapAccounts[ToID]; - if(localStorage["White:" + ToID] || !$("idSumSend").value || Item && Item.MyAccount) + if(Storage.getItem("White:" + ToID) || !$("idSumSend").value || Item && Item.MyAccount) { SendMoney(); } @@ -530,7 +530,7 @@ function CheckSendList(bRedraw) TitleWarning = PayList.length; if(AttachItem) TitleWarning++; - var Str = localStorage["InvoiceList"]; + var Str = Storage.getItem("InvoiceList"); if(!Str && !bRedraw) return ; if(!bRedraw) @@ -544,7 +544,7 @@ function CheckSendList(bRedraw) { AddSendList(arr[i]); } - localStorage["InvoiceList"] = ""; + Storage.setItem("InvoiceList", ""); } var idList = $("idSendList"); if(PayList.length) diff --git a/Source/HTML/JS/wallet-web.js b/Source/HTML/JS/wallet-web.js index 0f2e7f5..3157735 100644 --- a/Source/HTML/JS/wallet-web.js +++ b/Source/HTML/JS/wallet-web.js @@ -43,7 +43,7 @@ function StartWebWallet() function OnInitWebWallet() { - var str = localStorage.getItem(NETWORK + "NodesArrayList"); + var str = Storage.getItem(NETWORK + "NodesArrayList"); if(str) { var arr = JSON.parse(str); @@ -68,20 +68,23 @@ function SaveServerMap() 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) { var id = $("idStatus"); id.innerHTML = Str; - console.log(id.innerText); + if(Str) + console.log(id.innerText); }; function SetError(Str,bNoSound) { SetStatus("
" + Str + "
"); }; +var CountConnect = 0; +var CountWallet = 0; function ConnectWebWallet() { @@ -92,6 +95,13 @@ function ConnectWebWallet() var Item = ServerMap[key]; Item.SendHandShake = 0; } + if(window.BrowserIE && !IsLocalClient()) + { + MainServer = undefined; + return ; + } + CountConnect = 0; + CountWallet = 0; SetStatus("Connecting..."); LoopHandShake(); setTimeout(LoopWalletInfo, 1500); @@ -107,6 +117,9 @@ function LoopHandShake() var Item = ServerMap[key]; if(Item.SendHandShake || !Item.port) continue; + CountConnect++; + if(window.BrowserIE && CountConnect > 4) + break; DoNodeList(Item); } }; @@ -155,6 +168,9 @@ function LoopWalletInfo() var Item = ServerMap[key]; if(Item.port) { + CountWallet++; + if(window.BrowserIE && CountWallet > 4) + break; DoWalletInfo(Item); } } diff --git a/Source/HTML/dapp-frame.html b/Source/HTML/dapp-frame.html index b0750bf..c2e12b8 100644 --- a/Source/HTML/dapp-frame.html +++ b/Source/HTML/dapp-frame.html @@ -15,6 +15,8 @@ diff --git a/Source/HTML/wallet.html b/Source/HTML/wallet.html index 8ab5f59..3e23a34 100644 --- a/Source/HTML/wallet.html +++ b/Source/HTML/wallet.html @@ -764,7 +764,8 @@ { CurTabName=name; OnSelectTab(name); - window.location.hash="#"+name; + history.pushState(null,null,"#"+name); + //window.location.hash="#"+name; SetVisibleTab(); SaveValues(); @@ -1483,7 +1484,7 @@ Amount   - + diff --git a/Source/HTML/web-wallet-cn.html b/Source/HTML/web-wallet-cn.html index cb2c75d..cb0e80c 100644 --- a/Source/HTML/web-wallet-cn.html +++ b/Source/HTML/web-wallet-cn.html @@ -41,7 +41,7 @@ { LoadSignLib(); - if(localStorage["NETWORK"] || window.location.protocol==="file:") + if(localStorage["NETWORK"] || IsLocalClient()) { OnLoad(); } @@ -914,7 +914,7 @@ 数量   - + diff --git a/Source/HTML/web-wallet.html b/Source/HTML/web-wallet.html index 8433a36..2c68aaa 100644 --- a/Source/HTML/web-wallet.html +++ b/Source/HTML/web-wallet.html @@ -22,13 +22,15 @@