Thu Aug 1 16:38:01 CST 2019 Source Update...

This commit is contained in:
2019-08-01 16:38:01 +08:00
parent 99967cb1d6
commit ea0bd38cae
8 changed files with 84 additions and 65 deletions

View File

@@ -151,9 +151,11 @@ function MainHTTPFunction(request,response)
var Params = querystring.parse(DataURL.query);
var Path = querystring.unescape(DataURL.pathname);
ToLogWeb("Get Path:" + Path);
ADD_TO_STAT("HTTP_ALL");
if(global.STAT_MODE === 2)
{
ADD_TO_STAT("HTTP_ALL");
response.DetailStatName = ":" + Path;
}
var Type = request.method;
if(Type === "POST")
{
@@ -186,12 +188,12 @@ function MainHTTPFunction(request,response)
Response.end("Error data parsing");
}
}
DoCommandNew(response, Type, Path, Data);
DoCommandNew(request, response, Type, Path, Data);
});
}
else
{
DoCommandNew(response, Type, Path, Params);
DoCommandNew(request, response, Type, Path, Params);
}
};
var bWasRun = 0;
@@ -284,20 +286,19 @@ WalletFileMap["glass.svg"] = 1;
WalletFileMap["dapp-edit.html"] = 1;
WalletFileMap["TeraLogo.svg"] = 1;
WalletFileMap["mobile-wallet.html"] = "web-wallet.html";
var MapRedirect = {};
MapRedirect["map.html"] = "teraexplorer.org";
MapRedirect["explorer.html"] = "teraexplorer.org";
MapRedirect["history.html"] = "teraexplorer.org";
MapRedirect["GetSupply"] = "teraexplorer.org";
MapRedirect["DappTemplateFile"] = "terawallet.org";
global.WebApi2 = {};
global.HostingCaller = {};
function DoCommandNew(response,Type,Path,Params)
function DoCommandNew(request,response,Type,Path,Params)
{
if(Path.substring(0, 1) === "/")
Path = Path.substring(1);
var ArrPath = Path.split('/', 5);
if(global.AddonCommand)
{
if(!global.AddonCommand(request, response, Type, Path, Params, ArrPath))
return ;
}
var Caller = HostingCaller;
var Method = ArrPath[0];
var APIv2 = 0;
@@ -316,9 +317,11 @@ function DoCommandNew(response,Type,Path,Params)
}
Method = ArrPath[2];
}
ADD_TO_STAT("HTTP:" + Method);
if(global.STAT_MODE === 2)
{
ADD_TO_STAT("HTTP:" + Method);
response.DetailStatName = ":" + Method;
}
var F = Caller[Method];
if(F)
{
@@ -359,17 +362,6 @@ function DoCommandNew(response,Type,Path,Params)
Method = Method.toLowerCase();
if(Method === "dapp" && ArrPath.length === 2)
Method = "DappTemplateFile";
if(HTTPS_HOSTING_DOMAIN === "terafoundation.org")
{
var DomenName = MapRedirect[Method];
if(DomenName)
{
if(Path.substr(0, 1) !== "/")
Path = "/" + Path;
response.writeHead(301, {"Location":'http://' + DomenName + Path});
return response.end();
}
}
switch(Method)
{
case "index.html":
@@ -841,8 +833,6 @@ HostingCaller.GetHistoryTransactions = function (Params)
};
HostingCaller.GetSupply = function (Params)
{
if(HTTPS_HOSTING_DOMAIN === "terafoundation.org")
return "" + (1000000000 - 420000000);
var Data = DApps.Accounts.ReadState(0);
if(!Data)
return "";