@@ -13,6 +13,17 @@ function $(id)
|
||||
{
|
||||
return document.getElementById(id);
|
||||
};
|
||||
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);
|
||||
};
|
||||
var WALLET_KEY_NAME = "WALLET_KEY";
|
||||
var WALLET_PUB_KEY_NAME = "WALLET_PUB_KEY";
|
||||
if(!Math.log2)
|
||||
@@ -49,17 +60,6 @@ if(!String.prototype.padStart)
|
||||
}
|
||||
};
|
||||
}
|
||||
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");
|
||||
@@ -937,7 +937,7 @@ function RetIconPath(Item,bCurrency)
|
||||
return StrPath + '/file/' + Item.IconBlockNum + '/' + Item.IconTrNum;
|
||||
}
|
||||
else
|
||||
return StrPath + "./PIC/blank.svg";
|
||||
return StrPath + "/PIC/blank.svg";
|
||||
};
|
||||
|
||||
function RetIconDapp(Item)
|
||||
@@ -1437,9 +1437,9 @@ function AddToInvoiceList(Item)
|
||||
Storage.setItem("InvoiceList", JSON.stringify(arr));
|
||||
};
|
||||
|
||||
function OpenDapps(Num,AccountNum)
|
||||
function OpenDapps(Num,AccountNum,HTMLLength)
|
||||
{
|
||||
if(!Num)
|
||||
if(!Num || !HTMLLength)
|
||||
return ;
|
||||
var StrPath = '/dapp/' + Num;
|
||||
if(IsLocalClient())
|
||||
@@ -1801,8 +1801,8 @@ function ToLog(Str)
|
||||
|
||||
function InitMainServer()
|
||||
{
|
||||
var Str = localStorage["MainServer"];
|
||||
if(Str && !localStorage["BIGWALLET"] && Str.substr(0, 1) === "{")
|
||||
var Str = Storage.getItem("MainServer");
|
||||
if(Str && !Storage.getItem("BIGWALLET") && Str.substr(0, 1) === "{")
|
||||
{
|
||||
MainServer = JSON.parse(Str);
|
||||
}
|
||||
@@ -1823,13 +1823,13 @@ var KeyPasswordMap = {};
|
||||
|
||||
function InitWalletKeyName()
|
||||
{
|
||||
if(!localStorage["WALLET_KEY"])
|
||||
if(!Storage.getItem("WALLET_KEY"))
|
||||
{
|
||||
localStorage["WALLET_KEY"] = localStorage["idPrivKey"];
|
||||
Storage.setItem("WALLET_KEY", Storage.getItem("idPrivKey"));
|
||||
}
|
||||
if(!localStorage["WALLET_PUB_KEY"])
|
||||
if(!Storage.getItem("WALLET_PUB_KEY"))
|
||||
{
|
||||
localStorage["WALLET_PUB_KEY"] = localStorage["idPubKey"];
|
||||
Storage.setItem("WALLET_PUB_KEY", Storage.getItem("idPubKey"));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1862,8 +1862,11 @@ function OpenWalletKey()
|
||||
{
|
||||
PubKeyStr = "";
|
||||
}
|
||||
sessionStorage[WALLET_KEY_NAME] = RetKey;
|
||||
sessionStorage[WALLET_PUB_KEY_NAME] = PubKeyStr;
|
||||
if(window.sessionStorage)
|
||||
{
|
||||
sessionStorage[WALLET_KEY_NAME] = RetKey;
|
||||
sessionStorage[WALLET_PUB_KEY_NAME] = PubKeyStr;
|
||||
}
|
||||
if(!WALLET_PASSWORD)
|
||||
Storage.setItem(WALLET_PUB_KEY_NAME, PubKeyStr);
|
||||
return RetKey;
|
||||
@@ -1880,26 +1883,28 @@ function IsLockedWallet()
|
||||
|
||||
function GetPrivKey()
|
||||
{
|
||||
var Key = sessionStorage[WALLET_KEY_NAME];
|
||||
var Key;
|
||||
if(window.sessionStorage)
|
||||
Key = sessionStorage[WALLET_KEY_NAME];
|
||||
if(!Key)
|
||||
Key = Storage.getItem(WALLET_KEY_NAME);
|
||||
if(Key && typeof Key === "string" && Key.length >= 64)
|
||||
return Key;
|
||||
else
|
||||
return "";
|
||||
|
||||
};
|
||||
|
||||
function GetPubKey()
|
||||
{
|
||||
var Key = sessionStorage[WALLET_PUB_KEY_NAME];
|
||||
var Key;
|
||||
if(window.sessionStorage)
|
||||
Key = sessionStorage[WALLET_PUB_KEY_NAME];
|
||||
if(!Key)
|
||||
Key = Storage.getItem(WALLET_PUB_KEY_NAME);
|
||||
if(Key && typeof Key === "string" && Key.length >= 64)
|
||||
if(Key && typeof Key === "string" && Key.length >= 66)
|
||||
return Key;
|
||||
else
|
||||
return "";
|
||||
|
||||
};
|
||||
|
||||
function SetPrivKey(StrPrivKey)
|
||||
@@ -1920,15 +1925,18 @@ function SetPrivKey(StrPrivKey)
|
||||
Storage.setItem(WALLET_KEY_NAME, Key);
|
||||
Storage.setItem(WALLET_PUB_KEY_NAME, StrPubKey);
|
||||
Storage.setItem("WALLET_PUB_KEY_MAIN", StrPubKey);
|
||||
sessionStorage[WALLET_KEY_NAME] = StrPrivKey;
|
||||
sessionStorage[WALLET_PUB_KEY_NAME] = StrPubKey;
|
||||
if(window.sessionStorage)
|
||||
{
|
||||
sessionStorage[WALLET_KEY_NAME] = StrPrivKey;
|
||||
sessionStorage[WALLET_PUB_KEY_NAME] = StrPubKey;
|
||||
}
|
||||
};
|
||||
|
||||
function SetWalletPassword(Str)
|
||||
{
|
||||
WALLET_PASSWORD = Str;
|
||||
if(localStorage["idPrivKey"])
|
||||
delete localStorage["idPrivKey"];
|
||||
if(Storage.getItem("idPrivKey"))
|
||||
Storage.setItem("idPrivKey", "");
|
||||
};
|
||||
|
||||
function HashProtect(Str)
|
||||
|
||||
Reference in New Issue
Block a user