webig.patch

ulukyn, 12/20/2011 01:24 am

Download (9.2 kB)

b/code/ryzom/client/src/client_cfg.cpp
426 426
	PatchUrl = "";
427 427
	PatchVersion = "";
428 428
	PatchServer = "";
429
	RingReleaseNotePath = "http://atys.ryzom.com/releasenotes_ring/index.php";
430
	ReleaseNotePath = "http://atys.ryzom.com/releasenotes/index.php";
429

  
430
	WebIgMainDomain = "atys.ryzom.com";
431
	WebIgTrustedDomains.push_back(WebIgMainDomain);
432

  
433
	RingReleaseNotePath = "http://"+WebIgMainDomain+"/releasenotes_ring/index.php";
434
	ReleaseNotePath = "http://"+WebIgMainDomain+"/releasenotes/index.php";
435

  
431 436

  
432 437
	///////////////
433 438
	// ANIMATION //
......
1040 1045
	READ_STRING_DEV(ReleaseNotePath)
1041 1046
	READ_STRING_FV(PatchServer)
1042 1047

  
1048
	////////////////////////
1049
	// WEBIG //
1050
	READ_STRING_DEV(WebIgMainDomain);
1051
	READ_STRINGVECTOR_FV(WebIgTrustedDomains);
1052

  
1043 1053
	///////////////
1044 1054
	// ANIMATION //
1045 1055
	// AnimatedAngleThreshold
b/code/ryzom/client/src/client_cfg.h
292 292
	std::string		RingReleaseNotePath;
293 293
	std::string		ReleaseNotePath;
294 294

  
295
	std::string		WebIgMainDomain;
296
	std::vector<string>	WebIgTrustedDomains;
297

  
295 298

  
296 299
	///////////////
297 300
	// ANIMATION //
b/code/ryzom/client/src/interface_v3/action_handler_ui.cpp
416 416
					nlwarning("%s is not a group html", window.c_str());
417 417
					return;
418 418
				}
419
				pGH->setURL("http://atys.ryzom.com/start/index.php?app="+webapp);
419
				pGH->setURL("http://"+ClientCfg.WebIgMainDomain+"/start/index.php?app="+webapp);
420 420
			}
421 421
		}
422 422
		else
b/code/ryzom/client/src/interface_v3/group_html.cpp
62 62

  
63 63
CGroupHTML *CGroupHTML::_ConnectingLock = NULL;
64 64
extern CActionsContext ActionsContext;
65 65

  
66
// Check if domain is on TrustedDomain
67
bool CGroupHTML::isTrustedDomain(const string &domain) {
68
	vector<string>::iterator it;
69
	it = find (ClientCfg.WebIgTrustedDomains.begin(), ClientCfg.WebIgTrustedDomains.end(), domain);
70
	return it != ClientCfg.WebIgTrustedDomains.end();
71
}
72

  
66 73
// Get an url and return the local filename with the path where the url image should be
67 74
string CGroupHTML::localImageName(const string &url)
68 75
{
......
215 222

  
216 223
void CGroupHTML::initBnpDownload()
217 224
{
225
	if (!_TrustedDomain)
226
		return;
227
		
218 228
#ifdef LOG_DL
219 229
	nlwarning("Init Bnp Download");
220 230
#endif
......
452 496
//		for (i=0; i<(uint)len; i++)
453 497
//			inputString[i] = buf[i];
454 498

  
455
		if (_ParsingLua)
499
		if (_ParsingLua && _TrustedDomain)
456 500
		{
457 501
			// we are parsing a lua script
458 502
			_LuaScript += inputString;
......
515 559
// ***************************************************************************
516 560

  
517 561
void CGroupHTML::addLink (uint element_number, uint /* attribute_number */, HTChildAnchor *anchor, const BOOL *present, const char **value)
518
{
562
{
519 563
	if (_Browsing)
520 564
	{
521 565
		if (element_number == HTML_A)
......
523 567
			if (present[MY_HTML_A_HREF] && value[MY_HTML_A_HREF])
524 568
			{
525 569
				string suri = value[MY_HTML_A_HREF];
526
				if(suri.find("ah:") == 0)
570
				if(_TrustedDomain && suri.find("ah:") == 0)
527 571
				{
528 572
					// in ah: command we don't respect the uri standard so the HTAnchor_address doesn't work correctly
529 573
					_Link.push_back (suri);
530 574
				}
......
527 571
				{
528 572
					// in ah: command we don't respect the uri standard so the HTAnchor_address doesn't work correctly
529 573
					_Link.push_back (suri);
530 574
				}
531
				else if (suri[0] == '#')
575
				else if (_TrustedDomain && suri[0] == '#')
532 576
				{
533 577
					// Direct url (hack for lua beginElement)
534 578
					_Link.push_back (suri.substr(1));	
......
820 884
			_TextColor.push_back(LinkColor);
821 885
			_GlobalColor.push_back(LinkColorGlobalColor);
822 886
			_A.push_back(true);
823 887

  
824 888
			// Quick help
825
			if (present[MY_HTML_A_Z_ACTION_SHORTCUT] && value[MY_HTML_A_Z_ACTION_SHORTCUT])
889
			if (_TrustedDomain && present[MY_HTML_A_Z_ACTION_SHORTCUT] && value[MY_HTML_A_Z_ACTION_SHORTCUT])
826 890
			{
827 891
				// Get the action category
828 892
				string category;
......
833 897
				string params;
834 898
				if (present[MY_HTML_A_Z_ACTION_PARAMS] && value[MY_HTML_A_Z_ACTION_PARAMS])
835 899
					params = value[MY_HTML_A_Z_ACTION_PARAMS];
836

  
900
				
837 901
				// Get the action descriptor
838 902
				CActionsManager *actionManager = ActionsContext.getActionsManager (category);
839 903
				if (actionManager)
......
1532 1686
			_IgnoreText = false;
1533 1687
			break;
1534 1688
		case HTML_OBJECT:
1535
			if (_ObjectType=="application/ryzom-data")
1536
			{
1537
				if (!_ObjectData.empty())
1689
			if (_TrustedDomain) {
1690
				if (_ObjectType=="application/ryzom-data")
1538 1691
				{
......
1538 1691
				{
1539
					if (addBnpDownload(_ObjectData, _ObjectAction, _ObjectScript, _ObjectMD5Sum))
1692
					if (!_ObjectData.empty())
1540 1693
					{
......
1540 1693
					{
1541
						CInterfaceManager *pIM = CInterfaceManager::getInstance();
1542
						pIM->executeLuaScript(_ObjectScript, true);
1694
						if (addBnpDownload(_ObjectData, _ObjectAction, _ObjectScript, _ObjectMD5Sum))
1695
						{
1696
							CInterfaceManager *pIM = CInterfaceManager::getInstance();
1697
							pIM->executeLuaScript(_ObjectScript, true);
1698
						}
1699
						_ObjectScript = "";
1543 1700
					}
......
1543 1700
					}
1544
					_ObjectScript = "";
1545 1701
				}
......
1545 1701
				}
1702
				_Object = false;
1546 1703
			}
......
1546 1703
			}
1547
			_Object = false;
1704
			break;
1548 1705
		}
1549 1706
	}
1550 1707
}
......
1556 1713
	if (stricmp(str.c_str(), "lua") == 0)
1557 1714
	{
1558 1715
		// we receive an embeded lua script
1559
		_ParsingLua = true;
1716
		_ParsingLua = _TrustedDomain; // Only parse lua if TrustedDomain
1560 1717
		_LuaScript = "";
1561 1718
	}
1562 1719
}
......
1567 1724
	string str(buffer, buffer+length);
1568 1725
	if (stricmp(str.c_str(), "lua") == 0)
1569 1726
	{
1570
		if (_ParsingLua)
1727
		if (_ParsingLua && _TrustedDomain)
1571 1728
		{
1572 1729
			_ParsingLua = false;
1573 1730
			// execute the embeded lua script
......
2894 3077

  
2895 3078
				// Init LibWWW
2896 3079
				initLibWWW();
2897
				setCurrentDomain(finalUrl);
3080
				_TrustedDomain = isTrustedDomain(setCurrentDomain(finalUrl));
2898 3081

  
2899 3082
				// Get the final URL
2900 3083
				C3WSmartPtr uri = HTParse(finalUrl.c_str(), NULL, PARSE_ALL);
......
3045 3228

  
3046 3229
				// Init LibWWW
3047 3230
				initLibWWW();
3048
				setCurrentDomain(_URL);
3231
				_TrustedDomain = isTrustedDomain(setCurrentDomain(_URL));
3049 3232

  
3050 3233
				// Get the final URL
3051 3234
				C3WSmartPtr uri = HTParse(_URL.c_str(), NULL, PARSE_ALL);
b/code/ryzom/client/src/interface_v3/group_html.h
281 290
	// Current URL
282 291
	std::string		_URL;
283 292

  
293
	// Current DOMAIN
294
	bool		_TrustedDomain;
295

  
284 296
	// Title prefix
285 297
	ucstring		_TitlePrefix;
286 298

  
......
579 600
	void checkImageDownload();
580 601
	void addImageDownload(const std::string &url, CViewBase *img);
581 602
	std::string localImageName(const std::string &url);
603
	
604
	bool isTrustedDomain(const std::string &domain);
582 605

  
583 606

  
584 607

  
b/code/ryzom/client/src/interface_v3/group_html_webig.cpp
203 203
		nlSleep(1*60*1000);
204 204
		while (true)
205 205
		{
206
			string url = "http://atys.ryzom.com/start/index.php?app=notif&rnd="+randomString();
207
			//string url = "http://ryapp.bmsite.net/app_mail.php?page=ajax/inbox/unread&rnd="+randomString();
206
			string url = "http://"+ClientCfg.WebIgMainDomain+"/start/index.php?app=notif&rnd="+randomString();
208 207
			addWebIGParams(url);
209 208
			get(url);
210 209
			nlSleep(10*60*1000);
b/code/ryzom/client/src/libwww.cpp
520 520

  
521 521
// ***************************************************************************
522 522

  
523
void setCurrentDomain(const std::string &url)
523
const std::string &setCurrentDomain(const std::string &url)
524 524
{
525 525
	if(url.find("http://") == 0)
526 526
	{
......
532 532
		HTTPCurrentDomain.clear();
533 533
//		nlinfo("****cd: clear the domain");
534 534
	}
535
	return HTTPCurrentDomain;
535 536
}
536 537

  
537 538
void initLibWWW()
b/code/ryzom/client/src/libwww.h
35 35
void initLibWWW();
36 36

  
37 37
// Get an url and setup a local domain
38
void setCurrentDomain(const std::string &url);
38
const std::string &setCurrentDomain(const std::string &url);
39 39

  
40 40
extern std::string CurrentCookie;
41 41

  
b/code/ryzom/client/src/net_manager.cpp
3253 3253
			if(i != digitMaxEnd)
3254 3254
			{
3255 3255
				ucstring web_app = contentStr.substr(digitStart, i-digitStart);
3256
				contentStr = ucstring("http://atys.ryzom.com/start/")+web_app+ucstring(".php?")+contentStr.substr(i+1);
3256
				contentStr = ucstring("http://"+ClientCfg.WebIgMainDomain+"/start/")+web_app+ucstring(".php?")+contentStr.substr(i+1);
3257 3257
			}
3258 3258
			else
3259 3259
			{