diff --git a/CMakeLists.txt b/CMakeLists.txt index 71355790e..b1e847dff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,27 +94,27 @@ RYZOM_SETUP_PREFIX_PATHS() #----------------------------------------------------------------------------- # Default values for URL's -SET(RYZOM_CLIENT_CREATE_ACCOUNT_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Create Account URL") -SET(RYZOM_CLIENT_EDIT_ACCOUNT_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Edit Account URL") -SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Forget Password URL") -SET(RYZOM_CLIENT_PATCH_URL "https://cdn.ryzom.dev/open/patch/" CACHE STRING "Ryzom Client Patch URL") -SET(RYZOM_CLIENT_APP_NAME "default") +SET(RYZOM_CLIENT_CREATE_ACCOUNT_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Create Account URL") +SET(RYZOM_CLIENT_EDIT_ACCOUNT_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Edit Account URL") +SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://open.ryzom.dev/ams/" CACHE STRING "Ryzom Client Forget Password URL") +SET(RYZOM_CLIENT_PATCH_URL "https://cdn.ryzom.dev/open/patch/" CACHE STRING "Ryzom Client Patch URL") +SET(RYZOM_CLIENT_APP_NAME "default") -SET(RYZOM_WEBIG_MAIN_URL "https://open.ryzom.dev/" CACHE STRING "Ryzom Client WebIG Main URL") -SET(RYZOM_WEBIG_TRUSTED_DOMAIN "open.ryzom.dev" CACHE STRING "Ryzom Client WebIG Trusted Domain") +SET(RYZOM_CLIENT_RELEASENOTES_URL "https://open.ryzom.dev/releasenotes/index.php" CACHE STRING "Ryzom Client Release Notes URL") +SET(RYZOM_CLIENT_RELEASENOTES_RING_URL "https://open.ryzom.dev/releasenotes_ring/index.php" CACHE STRING "Ryzom Client Release Notes URL") #----------------------------------------------------------------------------- # urls when compiling ryzom live client IF(WITH_RYZOM_LIVE) MESSAGE("Using RYZOM_LIVE urls") - SET(RYZOM_CLIENT_CREATE_ACCOUNT_URL "https://account.ryzom.com/signup/from_client.php") - SET(RYZOM_CLIENT_EDIT_ACCOUNT_URL "https://account.ryzom.com/payment_profile/index.php") - SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://account.ryzom.com/payment_profile/lost_secure_password.php") - SET(RYZOM_CLIENT_PATCH_URL "http://dl.ryzom.com/patch_live") - SET(RYZOM_CLIENT_APP_NAME "ryzom_live") - - SET(RYZOM_WEBIG_MAIN_URL "https://app.ryzom.com/") - SET(RYZOM_WEBIG_TRUSTED_DOMAIN "app.ryzom.com") + SET(RYZOM_CLIENT_CREATE_ACCOUNT_URL "https://account.ryzom.com/signup/from_client.php") + SET(RYZOM_CLIENT_EDIT_ACCOUNT_URL "https://account.ryzom.com/payment_profile/index.php") + SET(RYZOM_CLIENT_FORGET_PASSWORD_URL "https://account.ryzom.com/payment_profile/lost_secure_password.php") + SET(RYZOM_CLIENT_PATCH_URL "http://dl.ryzom.com/patch_live") + SET(RYZOM_CLIENT_APP_NAME "ryzom_live") + +SET(RYZOM_CLIENT_RELEASENOTES_URL "https://app.ryzom.com/releasenotes/index.php") +SET(RYZOM_CLIENT_RELEASENOTES_RING_URL "https://app.ryzom.com/releasenotes_ring/index.php") ENDIF() #----------------------------------------------------------------------------- diff --git a/config.h.cmake b/config.h.cmake index fa6c456b9..110706ee1 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -39,8 +39,8 @@ #cmakedefine RYZOM_CLIENT_PATCH_URL "${RYZOM_CLIENT_PATCH_URL}" #cmakedefine RYZOM_CLIENT_APP_NAME "${RYZOM_CLIENT_APP_NAME}" -#cmakedefine RYZOM_WEBIG_MAIN_URL "${RYZOM_WEBIG_MAIN_URL}" -#cmakedefine RYZOM_WEBIG_TRUSTED_DOMAIN "${RYZOM_WEBIG_TRUSTED_DOMAIN}" +#cmakedefine RYZOM_CLIENT_RELEASENOTES_RING_URL "${RYZOM_CLIENT_RELEASENOTES_RING_URL}" +#cmakedefine RYZOM_CLIENT_RELEASENOTES_URL "${RYZOM_CLIENT_RELEASENOTES_URL}" #cmakedefine AUTHOR "${AUTHOR}" #cmakedefine YEAR "${YEAR}" diff --git a/nel/include/nel/gui/group_html.h b/nel/include/nel/gui/group_html.h index 3c94e7fa9..bb75624ff 100644 --- a/nel/include/nel/gui/group_html.h +++ b/nel/include/nel/gui/group_html.h @@ -70,7 +70,10 @@ namespace NLGUI /// Language code of the browser( e.g.: en, hu ) std::string languageCode; /// List of domains the widget can consider secure. - std::vector< std::string > trustedDomains; + std::vector trustedDomains; + /// Web server + std::string webServer; + std::string webServerDomain; /// Maximum concurrent MultiCurl connections per CGroupHTML instance sint32 curlMaxConnections; diff --git a/nel/src/gui/group_html.cpp b/nel/src/gui/group_html.cpp index 6eeecfdb9..8bddd3f6d 100644 --- a/nel/src/gui/group_html.cpp +++ b/nel/src/gui/group_html.cpp @@ -269,8 +269,11 @@ namespace NLGUI // Check if domain is on TrustedDomain bool CGroupHTML::isTrustedDomain(const string &domain) { + if (domain == options.webServerDomain) + return true; + vector::iterator it; - it = find ( options.trustedDomains.begin(), options.trustedDomains.end(), domain); + it = find(options.trustedDomains.begin(), options.trustedDomains.end(), domain); return it != options.trustedDomains.end(); } @@ -3272,6 +3275,11 @@ namespace NLGUI string finalUrl; bool isLocal = lookupLocalFile (finalUrl, _URL.c_str(), true); + if (!isLocal && _URL.c_str()[0] == '/' && !options.webServer.empty()) + finalUrl = options.webServer + finalUrl; + + // FIXME: In case options.webServer is empty(), can we defer browsing? -Kaetemi + _URL = finalUrl; CUrlParser uri (_URL); diff --git a/ryzom/client/client_default.cfg b/ryzom/client/client_default.cfg index 714ab7644..8cb3dc55a 100644 --- a/ryzom/client/client_default.cfg +++ b/ryzom/client/client_default.cfg @@ -608,9 +608,7 @@ HelpPages = }; // interval in minutes for webig notify thread to run -WebIgMainDomain = "https://classic.ryzom.dev"; WebIgTrustedDomains = { - "classic.ryzom.dev" }; SelectedSlot = 0; diff --git a/ryzom/client/data/gamedev/interfaces_v3/guild.xml b/ryzom/client/data/gamedev/interfaces_v3/guild.xml index c579192e5..f75b9de75 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/guild.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/guild.xml @@ -223,7 +223,7 @@ - + @@ -244,7 +244,7 @@ - + @@ -265,7 +265,7 @@ - + diff --git a/ryzom/client/data/gamedev/interfaces_v3/help.xml b/ryzom/client/data/gamedev/interfaces_v3/help.xml index 09ad5429f..d7043da83 100644 --- a/ryzom/client/data/gamedev/interfaces_v3/help.xml +++ b/ryzom/client/data/gamedev/interfaces_v3/help.xml @@ -223,7 +223,7 @@ - + diff --git a/ryzom/client/src/client_cfg.cpp b/ryzom/client/src/client_cfg.cpp index a80084342..0b6df6a43 100644 --- a/ryzom/client/src/client_cfg.cpp +++ b/ryzom/client/src/client_cfg.cpp @@ -434,14 +434,13 @@ CClientConfig::CClientConfig() #endif PatchVersion.clear(); - WebIgMainDomain = RYZOM_WEBIG_MAIN_URL; // https://open.ryzom.dev/" - WebIgTrustedDomains.push_back(RYZOM_WEBIG_TRUSTED_DOMAIN); // open.ryzom.dev + WebIgTrustedDomains.clear(); CurlMaxConnections = 5; CurlCABundle.clear(); - RingReleaseNotePath = WebIgMainDomain + "/releasenotes_ring/index.php"; - ReleaseNotePath = WebIgMainDomain + "/releasenotes/index.php"; + RingReleaseNotePath = RYZOM_CLIENT_RELEASENOTES_RING_URL; + ReleaseNotePath = RYZOM_CLIENT_RELEASENOTES_URL; /////////////// @@ -1109,10 +1108,6 @@ void CClientConfig::setValues() /////////// // WEBIG // - READ_STRING_FV(WebIgMainDomain); - if (ClientCfg.WebIgMainDomain.find("http://") == std::string::npos - || ClientCfg.WebIgMainDomain.find("https://") == std::string::npos) - ClientCfg.WebIgMainDomain = "http://" + ClientCfg.WebIgMainDomain; READ_STRINGVECTOR_FV(WebIgTrustedDomains); READ_INT_FV(CurlMaxConnections); if (ClientCfg.CurlMaxConnections < 0) diff --git a/ryzom/client/src/client_cfg.h b/ryzom/client/src/client_cfg.h index 882a1ac81..f03cf7152 100644 --- a/ryzom/client/src/client_cfg.h +++ b/ryzom/client/src/client_cfg.h @@ -321,7 +321,6 @@ struct CClientConfig std::string RingReleaseNotePath; std::string ReleaseNotePath; - std::string WebIgMainDomain; std::vector WebIgTrustedDomains; sint32 CurlMaxConnections; diff --git a/ryzom/client/src/interface_v3/action_handler_ui.cpp b/ryzom/client/src/interface_v3/action_handler_ui.cpp index 7495cfa7f..04d3f2c63 100644 --- a/ryzom/client/src/interface_v3/action_handler_ui.cpp +++ b/ryzom/client/src/interface_v3/action_handler_ui.cpp @@ -373,61 +373,17 @@ string urlencode(const string ¶m) // *************************************************************************** class CAHUIShowHide : public IActionHandler { - virtual void execute (CCtrlBase * /* pCaller */, const string &Params) + virtual void execute (CCtrlBase *pCaller, const string &Params) { - string webapp, window = Params; - vector res; - explode(Params, string("|"), res); - if(res[0]=="webig" || res[0]=="mailbox" || res[0]=="guild_forum" || res[0]=="profile") - { - window = "webig"; - if(res[0]=="mailbox") - webapp = "mail"; - else if(res[0]=="guild_forum") - webapp = "forum"; - else if(res[0]=="profile") - webapp = "profile&pname="+urlencode(getParam(Params,"pname"))+"&ptype="+getParam(Params,"ptype"); - else - webapp = "web"; - } - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface", window)); + CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface", Params)); if (pGC == NULL) { - nlwarning("%s is not a container", window.c_str()); + nlwarning("%s is not a container", Params.c_str()); return; - } + } if (!isContainerAuthorized(pGC)) return; - - if(window == "webig") - { - if(pGC->getActive() && currentWebApp == webapp) - { - pGC->setActive(false); - currentWebApp.clear(); - } - else - { - pGC->setActive(true); - currentWebApp = webapp; - } - if(!webapp.empty() && pGC->getActive()) - { - CGroupHTML *pGH = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:webig:content:html")); - if (pGH == NULL) - { - nlwarning("%s is not a group html", window.c_str()); - return; - } - pGH->setURL(ClientCfg.WebIgMainDomain + "/index.php?app=" + webapp); - } - } - else - { - // normal open/close swap - pGC->setActive(!pGC->getActive()); - } + pGC->setActive(!pGC->getActive()); } }; REGISTER_ACTION_HANDLER( CAHUIShowHide, "show_hide" ); diff --git a/ryzom/client/src/interface_v3/group_html_forum.cpp b/ryzom/client/src/interface_v3/group_html_forum.cpp index 37ba77891..c05c08219 100644 --- a/ryzom/client/src/interface_v3/group_html_forum.cpp +++ b/ryzom/client/src/interface_v3/group_html_forum.cpp @@ -120,13 +120,12 @@ string CGroupHTMLForum::home () const void CGroupHTMLForum::handle () { -/* // Do nothing if WebServer is not initialized + // Do nothing if WebServer is not initialized if (!WebServer.empty()) { - Home = WebServer+"forum.php"; + Home = "/webig/forum.php"; CGroupHTML::handle (); } -*/ } // *************************************************************************** diff --git a/ryzom/client/src/interface_v3/group_html_mail.cpp b/ryzom/client/src/interface_v3/group_html_mail.cpp index 61105e085..8a9e2ede8 100644 --- a/ryzom/client/src/interface_v3/group_html_mail.cpp +++ b/ryzom/client/src/interface_v3/group_html_mail.cpp @@ -90,12 +90,11 @@ string CGroupHTMLMail::home () const void CGroupHTMLMail::handle () { // Do nothing if WebServer is not initialized -/* if (!WebServer.empty()) + if (!WebServer.empty()) { - Home = WebServer+"mailbox.php"; + Home = "/webig/mailbox.php"; CGroupHTML::handle (); } -*/ } // *************************************************************************** diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index ea41bc711..f73ca6b07 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -75,6 +75,7 @@ #include "group_skills.h" #include "group_compas.h" #include "nel/gui/group_html.h" +#include // Misc #include "../input.h" @@ -458,6 +459,13 @@ CInterfaceManager* CInterfaceManager::getInstance() return _Instance; } +void setGroupHTMLWebServer(const std::string &webServer) +{ + CUrlParser uri(webServer); + CGroupHTML::options.webServer = webServer; + CGroupHTML::options.webServerDomain = uri.host; +} + // ------------------------------------------------------------------------------------------------ CInterfaceManager::CInterfaceManager() { diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index b27b2d3c4..3ba74ec9f 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -503,6 +503,7 @@ void impulseServerReady(NLMISC::CBitMemStream &impulse) LoginSM.pushEvent(CLoginStateMachine::ev_ready_received); } +void setGroupHTMLWebServer(const std::string &webServer); void impulseShardId(NLMISC::CBitMemStream &impulse) { // received SHARD_ID @@ -515,7 +516,14 @@ void impulseShardId(NLMISC::CBitMemStream &impulse) impulse.serial(webHost); if (!webHost.empty()) { - WebServer = webHost; + if (webHost[webHost.size() - 1] == '/') // strip trailing slash + webHost.resize(webHost.size() - 1); + + if (!webHost.empty()) + { + WebServer = webHost; + setGroupHTMLWebServer(webHost); + } } nlinfo("WEB: Received SHARD_ID %d, web hosted at '%s', using '%s'", shardId, webHost.c_str(), WebServer.c_str()); @@ -3266,43 +3274,12 @@ private: // get the content string (should have been received!) string contentStr; - string titleStr; if(!pSMC->getDynString(_TextId[ContentType], contentStr)) return; - if(!pSMC->getDynString(_TextId[TitleType], titleStr)) - return; - // if the string start with a @{Wxxxx} code, remove it and get the wanted window size sint w = 256; // default size to 256 !! - bool is_webig = false; - - if(contentStr.size()>=6 && contentStr[0]=='W' && contentStr[1]=='E' && contentStr[2]=='B' - && contentStr[3]==' ' && contentStr[4]==':' && contentStr[5]==' ' ) - { - uint i; - const uint digitStart= 6; - const uint digitMaxEnd= (uint)contentStr.size(); - - is_webig = true; - - for(i = digitStart; i < digitMaxEnd; i++) - { - if(contentStr[i] == ' ') - break; - } - if(i != digitMaxEnd) - { - string web_app = contentStr.substr(digitStart, i-digitStart); - contentStr = string(ClientCfg.WebIgMainDomain + "/") + web_app + string("/index.php?") + contentStr.substr((size_t)i + 1); - } - else - { - contentStr.clear(); - i = digitStart; - } - } - else if(contentStr.size()>=5 && contentStr[0]=='@' && contentStr[1]=='{' && contentStr[2]=='W') + if(contentStr.size()>=5 && contentStr[0]=='@' && contentStr[1]=='{' && contentStr[2]=='W') { uint i; const uint digitStart= 3; @@ -3322,45 +3299,9 @@ private: } } - // open the message box window or web ig - CInterfaceManager *pIM= CInterfaceManager::getInstance(); - - if (is_webig) - { - CGroupHTML *groupHtml; - string group = titleStr; - // - group = group.substr(9, group.size()-10); - groupHtml = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:"+group+":content:html")); - if (!groupHtml) - { - groupHtml = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:webig:content:html")); - group = "webig"; - } - - if (groupHtml) - { - CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:"+group)); - if (pGC) - { - if (contentStr.empty()) - { - pGC->setActive(false); - } - else - { - if (group == "webig") - pGC->setActive(true); - string url = contentStr; - addWebIGParams(url, true); - groupHtml->browse(url.c_str()); - CWidgetManager::getInstance()->setTopWindow(pGC); - } - } - } - } - else + // open the message box window { + CInterfaceManager *pIM= CInterfaceManager::getInstance(); CGroupContainer *pGC = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:server_message_box")); if (pGC) {