|
|
@ -63,6 +63,13 @@ using namespace NLMISC;
|
|
|
|
CGroupHTML *CGroupHTML::_ConnectingLock = NULL;
|
|
|
|
CGroupHTML *CGroupHTML::_ConnectingLock = NULL;
|
|
|
|
extern CActionsContext ActionsContext;
|
|
|
|
extern CActionsContext ActionsContext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check if domain is on TrustedDomain
|
|
|
|
|
|
|
|
bool CGroupHTML::isTrustedDomain(const string &domain) {
|
|
|
|
|
|
|
|
vector<string>::iterator it;
|
|
|
|
|
|
|
|
it = find (ClientCfg.WebIgTrustedDomains.begin(), ClientCfg.WebIgTrustedDomains.end(), domain);
|
|
|
|
|
|
|
|
return it != ClientCfg.WebIgTrustedDomains.end();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Get an url and return the local filename with the path where the url image should be
|
|
|
|
// Get an url and return the local filename with the path where the url image should be
|
|
|
|
string CGroupHTML::localImageName(const string &url)
|
|
|
|
string CGroupHTML::localImageName(const string &url)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -215,6 +222,9 @@ bool CGroupHTML::addBnpDownload(const string &url, const string &action, const s
|
|
|
|
|
|
|
|
|
|
|
|
void CGroupHTML::initBnpDownload()
|
|
|
|
void CGroupHTML::initBnpDownload()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!_TrustedDomain)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef LOG_DL
|
|
|
|
#ifdef LOG_DL
|
|
|
|
nlwarning("Init Bnp Download");
|
|
|
|
nlwarning("Init Bnp Download");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -452,7 +462,7 @@ void CGroupHTML::addText (const char * buf, int len)
|
|
|
|
// for (i=0; i<(uint)len; i++)
|
|
|
|
// for (i=0; i<(uint)len; i++)
|
|
|
|
// inputString[i] = buf[i];
|
|
|
|
// inputString[i] = buf[i];
|
|
|
|
|
|
|
|
|
|
|
|
if (_ParsingLua)
|
|
|
|
if (_ParsingLua && _TrustedDomain)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// we are parsing a lua script
|
|
|
|
// we are parsing a lua script
|
|
|
|
_LuaScript += inputString;
|
|
|
|
_LuaScript += inputString;
|
|
|
@ -523,12 +533,12 @@ void CGroupHTML::addLink (uint element_number, uint /* attribute_number */, HTCh
|
|
|
|
if (present[MY_HTML_A_HREF] && value[MY_HTML_A_HREF])
|
|
|
|
if (present[MY_HTML_A_HREF] && value[MY_HTML_A_HREF])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string suri = value[MY_HTML_A_HREF];
|
|
|
|
string suri = value[MY_HTML_A_HREF];
|
|
|
|
if(suri.find("ah:") == 0)
|
|
|
|
if(_TrustedDomain && suri.find("ah:") == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// in ah: command we don't respect the uri standard so the HTAnchor_address doesn't work correctly
|
|
|
|
// in ah: command we don't respect the uri standard so the HTAnchor_address doesn't work correctly
|
|
|
|
_Link.push_back (suri);
|
|
|
|
_Link.push_back (suri);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (suri[0] == '#')
|
|
|
|
else if (_TrustedDomain && suri[0] == '#')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Direct url (hack for lua beginElement)
|
|
|
|
// Direct url (hack for lua beginElement)
|
|
|
|
_Link.push_back (suri.substr(1));
|
|
|
|
_Link.push_back (suri.substr(1));
|
|
|
@ -822,7 +832,7 @@ void CGroupHTML::beginElement (uint element_number, const BOOL *present, const c
|
|
|
|
_A.push_back(true);
|
|
|
|
_A.push_back(true);
|
|
|
|
|
|
|
|
|
|
|
|
// Quick help
|
|
|
|
// Quick help
|
|
|
|
if (present[MY_HTML_A_Z_ACTION_SHORTCUT] && value[MY_HTML_A_Z_ACTION_SHORTCUT])
|
|
|
|
if (_TrustedDomain && present[MY_HTML_A_Z_ACTION_SHORTCUT] && value[MY_HTML_A_Z_ACTION_SHORTCUT])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Get the action category
|
|
|
|
// Get the action category
|
|
|
|
string category;
|
|
|
|
string category;
|
|
|
@ -1532,6 +1542,8 @@ void CGroupHTML::endElement (uint element_number)
|
|
|
|
_IgnoreText = false;
|
|
|
|
_IgnoreText = false;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case HTML_OBJECT:
|
|
|
|
case HTML_OBJECT:
|
|
|
|
|
|
|
|
if (_TrustedDomain)
|
|
|
|
|
|
|
|
{
|
|
|
|
if (_ObjectType=="application/ryzom-data")
|
|
|
|
if (_ObjectType=="application/ryzom-data")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!_ObjectData.empty())
|
|
|
|
if (!_ObjectData.empty())
|
|
|
@ -1546,6 +1558,8 @@ void CGroupHTML::endElement (uint element_number)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_Object = false;
|
|
|
|
_Object = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1556,7 +1570,7 @@ void CGroupHTML::beginUnparsedElement(const char *buffer, int length)
|
|
|
|
if (stricmp(str.c_str(), "lua") == 0)
|
|
|
|
if (stricmp(str.c_str(), "lua") == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// we receive an embeded lua script
|
|
|
|
// we receive an embeded lua script
|
|
|
|
_ParsingLua = true;
|
|
|
|
_ParsingLua = _TrustedDomain; // Only parse lua if TrustedDomain
|
|
|
|
_LuaScript = "";
|
|
|
|
_LuaScript = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1567,7 +1581,7 @@ void CGroupHTML::endUnparsedElement(const char *buffer, int length)
|
|
|
|
string str(buffer, buffer+length);
|
|
|
|
string str(buffer, buffer+length);
|
|
|
|
if (stricmp(str.c_str(), "lua") == 0)
|
|
|
|
if (stricmp(str.c_str(), "lua") == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (_ParsingLua)
|
|
|
|
if (_ParsingLua && _TrustedDomain)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_ParsingLua = false;
|
|
|
|
_ParsingLua = false;
|
|
|
|
// execute the embeded lua script
|
|
|
|
// execute the embeded lua script
|
|
|
@ -2894,7 +2908,7 @@ void CGroupHTML::handle ()
|
|
|
|
|
|
|
|
|
|
|
|
// Init LibWWW
|
|
|
|
// Init LibWWW
|
|
|
|
initLibWWW();
|
|
|
|
initLibWWW();
|
|
|
|
setCurrentDomain(finalUrl);
|
|
|
|
_TrustedDomain = isTrustedDomain(setCurrentDomain(finalUrl));
|
|
|
|
|
|
|
|
|
|
|
|
// Get the final URL
|
|
|
|
// Get the final URL
|
|
|
|
C3WSmartPtr uri = HTParse(finalUrl.c_str(), NULL, PARSE_ALL);
|
|
|
|
C3WSmartPtr uri = HTParse(finalUrl.c_str(), NULL, PARSE_ALL);
|
|
|
@ -3045,7 +3059,7 @@ void CGroupHTML::handle ()
|
|
|
|
|
|
|
|
|
|
|
|
// Init LibWWW
|
|
|
|
// Init LibWWW
|
|
|
|
initLibWWW();
|
|
|
|
initLibWWW();
|
|
|
|
setCurrentDomain(_URL);
|
|
|
|
_TrustedDomain = isTrustedDomain(setCurrentDomain(_URL));
|
|
|
|
|
|
|
|
|
|
|
|
// Get the final URL
|
|
|
|
// Get the final URL
|
|
|
|
C3WSmartPtr uri = HTParse(_URL.c_str(), NULL, PARSE_ALL);
|
|
|
|
C3WSmartPtr uri = HTParse(_URL.c_str(), NULL, PARSE_ALL);
|
|
|
|