From e1dbbd0213dd96e28aec2c5e6d9fd821ab144e48 Mon Sep 17 00:00:00 2001 From: Cho Date: Fri, 26 Apr 2013 21:26:38 +0100 Subject: removed internal browser hack for getting auth code in favor of SLApp-only approach --- indra/newview/llappviewer.cpp | 15 ++++----- indra/newview/llpanelpeople.cpp | 67 +++++------------------------------------ indra/newview/llpanelpeople.h | 2 +- 3 files changed, 16 insertions(+), 68 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 53c694eaca..31f7f61396 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2577,19 +2577,20 @@ bool LLAppViewer::initConfiguration() // What can happen is that someone can use IE (or potentially // other browsers) and do the rough equivalent of command // injection and steal passwords. Phoenix. SL-55321 + LLSLURL option_slurl; if(clp.hasOption("url")) { - LLStartUp::setStartSLURL(LLSLURL(clp.getOption("url")[0])); + option_slurl = LLSLURL(clp.getOption("url")[0]); + LLStartUp::setStartSLURL(option_slurl); if(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION) { LLGridManager::getInstance()->setGridChoice(LLStartUp::getStartSLURL().getGrid()); - - } + } } else if(clp.hasOption("slurl")) { - LLSLURL start_slurl(clp.getOption("slurl")[0]); - LLStartUp::setStartSLURL(start_slurl); + option_slurl = LLSLURL(clp.getOption("slurl")[0]); + LLStartUp::setStartSLURL(option_slurl); } const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent"); @@ -2686,10 +2687,10 @@ bool LLAppViewer::initConfiguration() // it relies on checking a marker file which will not work when running // out of different directories - if (LLStartUp::getStartSLURL().isValid() && + if (option_slurl.isValid() && (gSavedSettings.getBOOL("SLURLPassToOtherInstance"))) { - if (sendURLToOtherInstance(LLStartUp::getStartSLURL().getSLURLString())) + if (sendURLToOtherInstance(option_slurl.getSLURLString())) { // successfully handed off URL to existing instance, exit return false; diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index ab8d090cb6..86303cee70 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -113,6 +113,7 @@ public: if (mPanelPeople) { mPanelPeople->connectToFacebook(query_map["code"]); + mPanelPeople = NULL; return true; } } @@ -970,46 +971,7 @@ void LLPanelPeople::updateRecentList() void LLPanelPeople::updateFbcTestList() { - if (mFbcTestBrowserHandle.get()) - { - // get the current browser url (from the title bar, of course!) - std::string url = mFbcTestBrowserHandle.get()->getTitle(); - - // if the browser has redirected from facebook - if (url.find(getFacebookRedirectURL()) == 0) - { - // find the auth code in the url - std::string begin_string = "code="; - std::string end_string = "#"; - size_t begin_index = begin_string.length() + url.find(begin_string, getFacebookRedirectURL().length()); - size_t end_index = url.find(end_string, begin_index); - - // extract the auth code from the url - std::string auth_code; - if (end_index != std::string::npos) - { - auth_code = url.substr(begin_index, end_index - begin_index); - } - else - { - auth_code = url.substr(begin_index); - } - llinfos << "extracted code " << auth_code << " from url " << url << llendl; - - // finish authenticating on the server - connectToFacebook(auth_code); - - // close the browser window - mFbcTestBrowserHandle.get()->die(); - - // get rid of the handle - mFbcTestBrowserHandle = LLHandle(); - - // stop updating - mFbcTestListUpdater->setActive(false); - } - } - else if (mTryToConnectToFbc) + if (mTryToConnectToFbc) { // try to reconnect to facebook! tryToReconnectToFacebook(); @@ -1693,19 +1655,10 @@ bool LLPanelPeople::isAccordionCollapsedByUser(const std::string& name) return isAccordionCollapsedByUser(getChild(name)); } -void LLPanelPeople::openFacebookWeb(LLFloaterWebContent::Params& p) +void LLPanelPeople::openFacebookWeb(std::string url) { gFacebookConnectHandler.mPanelPeople = this; - LLUrlAction::openURLExternal(p.url); - - LLFloater* browser = LLFloaterReg::showInstance("web_content", p); - - if (browser) - { - // start checking the browser to see if the data is available yet - mFbcTestBrowserHandle = browser->getHandle(); - mFbcTestListUpdater->setActive(true); - } + LLUrlAction::openURLExternal(url); } void LLPanelPeople::showFacebookFriends(const LLSD& friends) @@ -1827,9 +1780,7 @@ public: // show the facebook login page if not connected yet if (status == 404 && mShowLoginIfNotConnected) { - LLFloaterWebContent::Params p; - p.url("https://www.facebook.com/dialog/oauth?client_id=565771023434202&redirect_uri=" + mPanelPeople->getFacebookRedirectURL()); - mPanelPeople->openFacebookWeb(p); + mPanelPeople->openFacebookWeb("https://www.facebook.com/dialog/oauth?client_id=565771023434202&redirect_uri=" + mPanelPeople->getFacebookRedirectURL()); } } } @@ -1914,16 +1865,12 @@ void LLPanelPeople::onLoginFbcButtonClicked() void LLPanelPeople::onFacebookAppRequestClicked() { - LLFloaterWebContent::Params p; - p.url("http://www.facebook.com/dialog/apprequests?app_id=565771023434202&message=Test&redirect_uri=" + getFacebookRedirectURL()); - openFacebookWeb(p); + openFacebookWeb("http://www.facebook.com/dialog/apprequests?app_id=565771023434202&message=Test&redirect_uri=" + getFacebookRedirectURL()); } void LLPanelPeople::onFacebookAppSendClicked() { - LLFloaterWebContent::Params p; - p.url("https://www.facebook.com/dialog/send?app_id=565771023434202&name=Join Second Life!&link=https://join.secondlife.com&redirect_uri=" + getFacebookRedirectURL()); - openFacebookWeb(p); + openFacebookWeb("https://www.facebook.com/dialog/send?app_id=565771023434202&name=Join Second Life!&link=https://join.secondlife.com&redirect_uri=" + getFacebookRedirectURL()); } static LLFastTimer::DeclareTimer FTM_AVATAR_LIST_TEST("avatar list test"); diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 497871bedb..95105309d2 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -62,7 +62,7 @@ public: static void idle(void * user_data); - void openFacebookWeb(LLFloaterWebContent::Params& p); + void openFacebookWeb(std::string url); void showFacebookFriends(const LLSD& friends); void addTestParticipant(); void addParticipantToModel(LLPersonTabModel * session_model, const LLUUID& agent_id, const std::string& name); -- cgit v1.2.3