From f3ec6295ee13564ad4234d3134b0997920a59338 Mon Sep 17 00:00:00 2001
From: Armin Weatherwax
Date: Mon, 21 Mar 2011 00:15:28 +0100
Subject: several embedded browser proxy fixes and one small cookie fix
* split xmlrpc and web browser proxy setting into 2 settings
(because the login service might refuse to let you in using TOR)
* fix web proxy to be used not only for the browser floater but also for login screen and parcel media.
Backported for that the setProxyConfig method from Viewer-external(last gpl+floss version)
* fix: no clear cookies button
* todo: cookies need work
note to devs of other viewers: if you find this useful feel free to apply my part to "lgpl v2.1 only" code without need to ask (thats all but setProxyConfig, which is anyway also released under lgpl by LL ).
---
linden/indra/newview/app_settings/settings.xml | 35 ++++++++++++++++++++
linden/indra/newview/llpanelnetwork.cpp | 24 ++++++++++++++
linden/indra/newview/llpanelnetwork.h | 1 +
linden/indra/newview/llpanelweb.cpp | 13 ++++++--
linden/indra/newview/llviewermedia.cpp | 38 ++++++++++++++++++++++
linden/indra/newview/llviewermedia.h | 5 +++
linden/indra/newview/llxmlrpctransaction.cpp | 6 ++--
.../xui/en-us/panel_preferences_network.xml | 27 +++++++++++++++
.../default/xui/en-us/panel_preferences_web.xml | 4 +++
9 files changed, 147 insertions(+), 6 deletions(-)
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index 2a508ee..c381d99 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -2311,6 +2311,41 @@
Value
0
+
+ XMLRPCProxyAddress
+
+ Comment
+ Address for the XMLRPC Web Proxy
+ Persist
+ 1
+ Type
+ String
+ Value
+
+
+ XMLRPCProxyEnabled
+
+ Comment
+ Use XMLRPC Proxy
+ Persist
+ 1
+ Type
+ Boolean
+ Value
+ 0
+
+ XMLRPCProxyPort
+
+ Comment
+ Port of the XMLRPC Proxy
+ Persist
+ 1
+ Type
+ S32
+ Value
+ 3128
+
+
AllowIdleAFK
Comment
diff --git a/linden/indra/newview/llpanelnetwork.cpp b/linden/indra/newview/llpanelnetwork.cpp
index 2edd1a1..16b9a76 100644
--- a/linden/indra/newview/llpanelnetwork.cpp
+++ b/linden/indra/newview/llpanelnetwork.cpp
@@ -64,6 +64,14 @@ BOOL LLPanelNetwork::postBuild()
childSetValue("connection_port_enabled", gSavedSettings.getBOOL("ConnectionPortEnabled"));
childSetValue("connection_port", (F32)gSavedSettings.getU32("ConnectionPort"));
+ childSetCommitCallback("xmlrpc_proxy_enabled", onCommitXMLRPCProxyEnabled, this);
+ childSetValue("xmlrpc_proxy_enabled", gSavedSettings.getBOOL("XMLRPCProxyEnabled"));
+ childSetValue("xmlrpc_proxy_editor", gSavedSettings.getString("XMLRPCProxyAddress"));
+ childSetValue("xmlrpc_proxy_port", gSavedSettings.getS32("XMLRPCProxyPort"));
+ childSetEnabled("xmlrpc_proxy_text_label", gSavedSettings.getBOOL("XMLRPCProxyEnabled"));
+ childSetEnabled("xmlrpc_proxy_editor", gSavedSettings.getBOOL("XMLRPCProxyEnabled"));
+ childSetEnabled("xmlrpc_proxy_port", gSavedSettings.getBOOL("XMLRPCProxyEnabled"));
+
return TRUE;
}
@@ -79,6 +87,10 @@ void LLPanelNetwork::apply()
gSavedSettings.setF32("ThrottleBandwidthKBPS", childGetValue("max_bandwidth").asReal());
gSavedSettings.setBOOL("ConnectionPortEnabled", childGetValue("connection_port_enabled"));
gSavedSettings.setU32("ConnectionPort", childGetValue("connection_port").asInteger());
+
+ gSavedSettings.setBOOL("XMLRPCProxyEnabled", childGetValue("xmlrpc_proxy_enabled"));
+ gSavedSettings.setString("XMLRPCProxyAddress", childGetValue("xmlrpc_proxy_editor"));
+ gSavedSettings.setS32("XMLRPCProxyPort", childGetValue("xmlrpc_proxy_port"));
}
void LLPanelNetwork::cancel()
@@ -144,3 +156,15 @@ void LLPanelNetwork::onCommitPort(LLUICtrl* ctrl, void* data)
self->childSetEnabled("connection_port", check->get());
LLNotifications::instance().add("ChangeConnectionPort");
}
+
+// static
+void LLPanelNetwork::onCommitXMLRPCProxyEnabled(LLUICtrl* ctrl, void* data)
+{
+ LLPanelNetwork* self = (LLPanelNetwork*)data;
+ LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl;
+
+ if (!self || !check) return;
+ self->childSetEnabled("xmlrpc_proxy_editor", check->get());
+ self->childSetEnabled("xmlrpc_proxy_port", check->get());
+ self->childSetEnabled("xmlrpc_proxy_text_label", check->get());
+}
\ No newline at end of file
diff --git a/linden/indra/newview/llpanelnetwork.h b/linden/indra/newview/llpanelnetwork.h
index 3a3d857..900158a 100644
--- a/linden/indra/newview/llpanelnetwork.h
+++ b/linden/indra/newview/llpanelnetwork.h
@@ -51,6 +51,7 @@ private:
static void onClickSetCache(void*);
static void onClickResetCache(void*);
static void onCommitPort(LLUICtrl* ctrl, void*);
+ static void onCommitXMLRPCProxyEnabled(LLUICtrl* ctrl, void* data);
};
#endif
diff --git a/linden/indra/newview/llpanelweb.cpp b/linden/indra/newview/llpanelweb.cpp
index 6f9bd7a..93441dd 100644
--- a/linden/indra/newview/llpanelweb.cpp
+++ b/linden/indra/newview/llpanelweb.cpp
@@ -69,6 +69,7 @@ BOOL LLPanelWeb::postBuild()
childSetValue("use_external_browser", value);
childSetValue("cookies_enabled", gSavedSettings.getBOOL("BrowserCookiesEnabled"));
+ childSetAction("clear_cookies", onClickClearCookies,this);
childSetValue("web_proxy_enabled", gSavedSettings.getBOOL("BrowserProxyEnabled"));
childSetValue("web_proxy_editor", gSavedSettings.getString("BrowserProxyAddress"));
@@ -102,9 +103,15 @@ LLPanelWeb::~LLPanelWeb()
void LLPanelWeb::apply()
{
gSavedSettings.setBOOL("BrowserCookiesEnabled", childGetValue("cookies_enabled"));
- gSavedSettings.setBOOL("BrowserProxyEnabled", childGetValue("web_proxy_enabled"));
- gSavedSettings.setString("BrowserProxyAddress", childGetValue("web_proxy_editor"));
- gSavedSettings.setS32("BrowserProxyPort", childGetValue("web_proxy_port"));
+
+ bool proxy_enable = childGetValue("web_proxy_enabled");
+ std::string proxy_address = childGetValue("web_proxy_editor");
+ int proxy_port = childGetValue("web_proxy_port");
+ gSavedSettings.setBOOL("BrowserProxyEnabled", proxy_enable);
+ gSavedSettings.setString("BrowserProxyAddress", proxy_address);
+ gSavedSettings.setS32("BrowserProxyPort", proxy_port);
+ LLViewerMedia::setProxyConfig(proxy_enable, proxy_address, proxy_port);
+
if (gHippoGridManager->getConnectedGrid()->isSecondLife())
{
gSavedSettings.setString("SearchURLQuery", childGetValue("world_search_editor"));
diff --git a/linden/indra/newview/llviewermedia.cpp b/linden/indra/newview/llviewermedia.cpp
index f0faedf..c228468 100644
--- a/linden/indra/newview/llviewermedia.cpp
+++ b/linden/indra/newview/llviewermedia.cpp
@@ -267,6 +267,23 @@ std::string LLViewerMedia::getCurrentUserAgent()
return codec.str();
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::setProxyConfig(bool enable, const std::string &host, int port)
+{
+ // Set the proxy config for all loaded plugins
+ impl_list::iterator iter = sViewerMediaImplList.begin();
+ impl_list::iterator end = sViewerMediaImplList.end();
+ for (; iter != end; iter++)
+ {
+ LLViewerMediaImpl* pimpl = *iter;
+ if(pimpl->mMediaSource)
+ {
+ pimpl->mMediaSource->proxy_setup(enable, host, port);
+ }
+ }
+}
//////////////////////////////////////////////////////////////////////////////////////////
// static
@@ -395,6 +412,19 @@ LLViewerMediaImpl::~LLViewerMediaImpl()
LLViewerMedia::removeMedia(this);
}
+//static
+void LLViewerMediaImpl::setProxy(LLPluginClassMedia* media_source)
+{
+ // pass proxy settings to browser
+ bool proxy_enabled = gSavedSettings.getBOOL( "BrowserProxyEnabled" );
+ std::string proxy_address = gSavedSettings.getString("BrowserProxyAddress");
+ S32 proxy_port = gSavedSettings.getS32("BrowserProxyPort");
+ media_source->proxy_setup(proxy_enabled, proxy_address, proxy_port);
+ LL_DEBUGS("Media") << "Proxy: " << (proxy_enabled ? "enabled" : "not enabled")
+ << " Address: " << proxy_address
+ << " Port: " << proxy_port << LL_ENDL;
+}
+
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::initializeMedia(const std::string& mime_type)
{
@@ -411,6 +441,11 @@ bool LLViewerMediaImpl::initializeMedia(const std::string& mime_type)
}
}
+ if(mMediaSource)
+ {
+ setProxy(mMediaSource);
+ }
+
// play();
return (mMediaSource != NULL);
}
@@ -508,6 +543,8 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" );
media_source->setJavascriptEnabled( javascript_enabled );
+ setProxy(media_source);
+
if (media_source->init(launcher_name, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins")))
{
return media_source;
@@ -741,6 +778,7 @@ void LLViewerMediaImpl::navigateHome()
//////////////////////////////////////////////////////////////////////////////////////////
void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mime_type, bool rediscover_type)
{
+
if(rediscover_type)
{
diff --git a/linden/indra/newview/llviewermedia.h b/linden/indra/newview/llviewermedia.h
index afda426..ee5fef4 100644
--- a/linden/indra/newview/llviewermedia.h
+++ b/linden/indra/newview/llviewermedia.h
@@ -79,6 +79,10 @@ class LLViewerMedia
static void removeMedia(LLViewerMediaImpl* media);
static LLViewerMediaImpl* getMediaImplFromTextureID(const LLUUID& texture_id);
static std::string getCurrentUserAgent();
+
+ // Set the proxy config for all loaded plugins
+ static void setProxyConfig(bool enable, const std::string &host, int port);
+
static void updateBrowserUserAgent();
static bool handleSkinCurrentChanged(const LLSD& /*newvalue*/);
static bool textureHasMedia(const LLUUID& texture_id);
@@ -109,6 +113,7 @@ public:
void createMediaSource();
void destroyMediaSource();
void setMediaType(const std::string& media_type);
+ static void setProxy(LLPluginClassMedia* media_source);
bool initializeMedia(const std::string& mime_type);
bool initializePlugin(const std::string& media_type);
LLPluginClassMedia* getMediaPlugin() { return mMediaSource; }
diff --git a/linden/indra/newview/llxmlrpctransaction.cpp b/linden/indra/newview/llxmlrpctransaction.cpp
index 058946e..675ba42 100644
--- a/linden/indra/newview/llxmlrpctransaction.cpp
+++ b/linden/indra/newview/llxmlrpctransaction.cpp
@@ -226,10 +226,10 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
mCurlRequest = new LLCurlEasyRequest();
}
- if (gSavedSettings.getBOOL("BrowserProxyEnabled"))
+ if (gSavedSettings.getBOOL("XMLRPCProxyEnabled"))
{
- mProxyAddress = gSavedSettings.getString("BrowserProxyAddress");
- S32 port = gSavedSettings.getS32 ( "BrowserProxyPort" );
+ mProxyAddress = gSavedSettings.getString("XMLRPCProxyAddress");
+ S32 port = gSavedSettings.getS32 ( "XMLRPCProxyPort" );
// tell curl about the settings
mCurlRequest->setoptString(CURLOPT_PROXY, mProxyAddress);
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml
index 1e4ded6..86aa353 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_network.xml
@@ -64,4 +64,31 @@
increment="1" initial_val="13000" label="Port number:" label_width="75"
left_delta="20" max_val="13050" min_val="13000" mouse_opaque="true"
name="connection_port" width="150" />
+
+ XMLRPC Proxy (Login, Land- and Money purchase):
+
+
+
+ Address:
+
+
+
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_web.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_web.xml
index 46283bb..727b142 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_web.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_web.xml
@@ -34,6 +34,10 @@
font="SansSerifSmall" height="16" initial_value="false"
label="Accept cookies from sites" left="140" mouse_opaque="true"
name="cookies_enabled" radio_style="false" width="256" />
+
getTE(mPick.mObjectFace);
+ viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(tep->getID());
+ if (tep && media_impl.notNull() && media_impl->hasMedia())
+ {
+ LL_DEBUGS("DoubleClicks") << "Double clicked running parcel media" << LL_ENDL;
+ return FALSE;
+ }
}
std::string action = gSavedSettings.getString("DoubleClickAction");
@@ -938,19 +946,16 @@ static bool handle_media_click(const LLPickInfo& pick)
if (tep
&& media_impl.notNull()
&& media_impl->hasMedia()
- && gSavedSettings.getBOOL("MediaOnAPrimUI"))
+ /*&& gSavedSettings.getBOOL("MediaOnAPrimUI")*/)
{
LLObjectSelectionHandle selection = LLViewerMediaFocus::getInstance()->getSelection();
if (! selection->contains(pick.getObject(), pick.mObjectFace))
{
LLViewerMediaFocus::getInstance()->setFocusFace(TRUE, pick.getObject(), pick.mObjectFace, media_impl);
}
- else
- {
- media_impl->mouseDown(pick.mXYCoords.mX, pick.mXYCoords.mY);
- media_impl->mouseCapture(); // the mouse-up will happen when capture is lost
- }
+ media_impl->mouseDown(pick.mXYCoords.mX, pick.mXYCoords.mY);
+ media_impl->mouseCapture(); // the mouse-up will happen when capture is lost
return true;
}
diff --git a/linden/indra/newview/llviewermediafocus.cpp b/linden/indra/newview/llviewermediafocus.cpp
index 2e372a1..c81cd76 100644
--- a/linden/indra/newview/llviewermediafocus.cpp
+++ b/linden/indra/newview/llviewermediafocus.cpp
@@ -48,6 +48,7 @@
#include "llparcel.h"
#include "llviewerparcelmgr.h"
#include "llweb.h"
+#include "llviewercontrol.h"//gSavedSettings
//
// LLViewerMediaFocus
//
@@ -99,7 +100,7 @@ void LLViewerMediaFocus::setFocusFace( BOOL b, LLPointer objectp
LLSelectMgr::getInstance()->selectObjectOnly(objectp, face);
mFocus = LLSelectMgr::getInstance()->getSelection();
- if(mMediaHUD.get() && ! parcel->getMediaPreventCameraZoom())
+ if(gSavedSettings.getBOOL("MediaOnAPrimUI") && mMediaHUD.get() && ! parcel->getMediaPreventCameraZoom())
{
mMediaHUD.get()->resetZoomLevel();
mMediaHUD.get()->nextZoomLevel();
@@ -224,14 +225,20 @@ void LLViewerMediaFocus::setMouseOverFlag(bool b, viewer_media_t media_impl)
{
if (b && media_impl.notNull())
{
- if(! mMediaHUD.get())
+
+ if(! mMediaHUD.get() && gSavedSettings.getBOOL("MediaOnAPrimUI"))
{
LLPanelMediaHUD* media_hud = new LLPanelMediaHUD(mMediaImpl);
mMediaHUD = media_hud->getHandle();
gHUDView->addChild(media_hud);
}
- mMediaHUD.get()->setMediaImpl(media_impl);
+
+ if(mMediaHUD.get())
+ {
+ mMediaHUD.get()->setMediaImpl(media_impl);
+ }
mMediaImpl = media_impl;
+
}
mMouseOverFlag = b;
}
@@ -281,7 +288,10 @@ void LLViewerMediaFocus::update()
{
if (mMediaHUD.get())
{
- if(mFocus.notNull() || mMouseOverFlag || mMediaHUD.get()->isMouseOver())
+ if(gSavedSettings.getBOOL("MediaOnAPrimUI")
+ &&(mFocus.notNull()
+ || mMouseOverFlag
+ || mMediaHUD.get()->isMouseOver() ) )
{
// mMediaHUD.get()->setVisible(true);
mMediaHUD.get()->updateShape();
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml
index c6bb938..1f208e8 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml
@@ -42,6 +42,11 @@
initial_value="true" label="Automatically play media" left="162"
mouse_opaque="true" name="auto_streaming_video" radio_style="false"
width="338" />
+
Value
Random
+ LastConnectedGrid
+
+ Comment
+ Last grid actually connected to
+ Persist
+ 1
+ Type
+ String
+ Value
+
+
LastSelectedGrid
Comment
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index c9cdc8f..bcac095 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -1243,6 +1243,20 @@ bool idle_startup()
hashed_mac.finalize();
hashed_mac.hex_digest(hashed_mac_string);
+ // Don't report crashes if the grid we crashed in
+ // is different from the grid we log in
+ eLastExecEvent last_exec_event = LAST_EXEC_NORMAL;
+ {
+ std::string current_grid = gHippoGridManager->getCurrentGrid()->getGridNick();
+ std::string last_grid = gSavedSettings.getString("LastConnectedGrid");
+ LL_DEBUGS("AppInit") << "current grid: " << current_grid
+ << " Last Connected Grid: " << last_grid << LL_ENDL;
+ if( last_grid == current_grid )
+ {
+ last_exec_event = gLastExecEvent;
+ }
+ }
+
// TODO if statement here to use web_login_key
if(web_login_key.isNull()){
sAuthUriNum = llclamp(sAuthUriNum, 0, (S32)sAuthUris.size()-1);
@@ -1257,7 +1271,7 @@ bool idle_startup()
gSkipOptionalUpdate,
gAcceptTOS,
gAcceptCriticalMessage,
- gLastExecEvent,
+ last_exec_event,
requested_options,
hashed_mac_string,
LLAppViewer::instance()->getSerialNumber());
@@ -1272,7 +1286,7 @@ bool idle_startup()
gSkipOptionalUpdate,
gAcceptTOS,
gAcceptCriticalMessage,
- gLastExecEvent,
+ last_exec_event,
requested_options,
hashed_mac_string,
LLAppViewer::instance()->getSerialNumber());
@@ -1510,6 +1524,11 @@ bool idle_startup()
if(successful_login)
{
+ {
+ std::string current_grid = gHippoGridManager->getConnectedGrid()->getGridNick();
+ gSavedSettings.setString("LastConnectedGrid", current_grid);
+ }
+
std::string text;
text = LLUserAuth::getInstance()->getResponse("udp_blacklist");
if(!text.empty())
--
cgit v1.1
From 5f00d4c76e952fa865dc7cbc63fd17bf6a3c0c7b Mon Sep 17 00:00:00 2001
From: Armin Weatherwax
Date: Tue, 22 Mar 2011 11:39:09 +0100
Subject: Don't try to fetch grid list from empty url in GridUpdateList
---
linden/indra/newview/hippogridmanager.cpp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/linden/indra/newview/hippogridmanager.cpp b/linden/indra/newview/hippogridmanager.cpp
index d56214c..74c9997 100644
--- a/linden/indra/newview/hippogridmanager.cpp
+++ b/linden/indra/newview/hippogridmanager.cpp
@@ -799,7 +799,17 @@ void HippoGridManager::loadFromFile()
parseFile(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "default_grids.xml"), !mGridInfo.empty());
// merge grid info from web site, if newer. Force load, if list of grids is empty.
if (gSavedSettings.getBOOL("CheckForGridUpdates"))
- parseUrl(gSavedSettings.getString("GridUpdateList"), !mGridInfo.empty());
+ {
+ std::string update_list = gSavedSettings.getString("GridUpdateList");
+ if (!update_list.empty())
+ {
+ parseUrl(update_list, !mGridInfo.empty());
+ }
+ else
+ {
+ llwarns << "\"CheckForGridUpdates\" is set to true, but \"GridUpdateList\" contains no URL to fetch the grid info from. Skipping." << llendl;
+ }
+ }
std::string last_grid = gSavedSettings.getString("LastSelectedGrid");
if (last_grid.empty()) last_grid = gSavedSettings.getString("DefaultGrid");
--
cgit v1.1