SL-19609 Urls aren't dispatched according to the indicated grid

master
Andrey Kleshchev 2023-04-18 23:33:19 +03:00 committed by akleshchev
parent 1742976f4e
commit daca555592
34 changed files with 131 additions and 73 deletions

View File

@ -35,6 +35,7 @@
#include "llcommandhandler.h"
#include "llslurl.h"
#include "llurldispatcher.h"
#include "llviewernetwork.h"
#include "llviewerobject.h"
#include "llviewerobjectlist.h"
#include "llviewerregion.h"
@ -148,7 +149,7 @@ void LLAgentListener::requestTeleport(LLSD const & event_data) const
params.append(event_data["x"]);
params.append(event_data["y"]);
params.append(event_data["z"]);
LLCommandDispatcher::dispatch("teleport", params, LLSD(), NULL, "clicked", true);
LLCommandDispatcher::dispatch("teleport", params, LLSD(), LLGridManager::getInstance()->getGrid(), NULL, "clicked", true);
// *TODO - lookup other LLCommandHandlers for "agent", "classified", "event", "group", "floater", "parcel", "login", login_refresh", "balance", "chat"
// should we just compose LLCommandHandler and LLDispatchListener?
}

View File

@ -147,7 +147,10 @@ public:
// requests will be throttled from a non-trusted browser
LLAppearanceHandler() : LLCommandHandler("appearance", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
// support secondlife:///app/appearance/show, but for now we just
// make all secondlife:///app/appearance SLapps behave this way
@ -4472,8 +4475,10 @@ public:
// not allowed from outside the app
LLWearFolderHandler() : LLCommandHandler("wear_folder", UNTRUSTED_BLOCK) { }
bool handle(const LLSD& tokens, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
LLSD::UUID folder_uuid;

View File

@ -43,7 +43,7 @@ public:
// requests will be throttled from a non-trusted browser
LLBuyCurrencyHTMLHandler() : LLCommandHandler( "buycurrencyhtml", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
std::string action( "" );
if ( params.size() >= 1 )

View File

@ -82,7 +82,7 @@ public:
// requests will be throttled from a non-trusted browser
LLObjectIMHandler() : LLCommandHandler("objectim", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (params.size() < 1)
{

View File

@ -57,7 +57,7 @@ class LLObjectHandler : public LLCommandHandler
public:
LLObjectHandler() : LLCommandHandler("object", UNTRUSTED_BLOCK) { }
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (params.size() < 2) return false;

View File

@ -64,7 +64,7 @@ void LLCommandDispatcherListener::dispatch(const LLSD& params) const
// But for testing, allow a caller to specify untrusted.
trusted_browser = params["trusted"].asBoolean();
}
LLCommandDispatcher::dispatch(params["cmd"], params["params"], params["query"], NULL,
LLCommandDispatcher::dispatch(params["cmd"], params["params"], params["query"], "", NULL,
"clicked", trusted_browser);
}

View File

@ -60,6 +60,7 @@ public:
bool dispatch(const std::string& cmd,
const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web,
const std::string& nav_type,
bool trusted_browser);
@ -96,6 +97,7 @@ void LLCommandHandlerRegistry::add(const char* cmd,
bool LLCommandHandlerRegistry::dispatch(const std::string& cmd,
const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web,
const std::string& nav_type,
bool trusted_browser)
@ -163,7 +165,7 @@ bool LLCommandHandlerRegistry::dispatch(const std::string& cmd,
}
}
if (!info.mHandler) return false;
return info.mHandler->handle(params, query_map, web);
return info.mHandler->handle(params, query_map, grid, web);
}
void LLCommandHandlerRegistry::notifySlurlBlocked()
@ -218,12 +220,13 @@ LLCommandHandler::~LLCommandHandler()
bool LLCommandDispatcher::dispatch(const std::string& cmd,
const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web,
const std::string& nav_type,
bool trusted_browser)
{
return LLCommandHandlerRegistry::instance().dispatch(
cmd, params, query_map, web, nav_type, trusted_browser);
cmd, params, query_map, grid, web, nav_type, trusted_browser);
}
static std::string lookup(LLCommandHandler::EUntrustedAccess value);

View File

@ -42,7 +42,7 @@ public:
LLFooHandler() : LLCommandHandler("foo", UNTRUSTED_BLOCK) { }
// Your code here
bool handle(const LLSD& tokens, const LLSD& query_map,
bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid,
LLMediaCtrl* web)
{
if (tokens.size() < 1) return false;
@ -88,6 +88,7 @@ public:
virtual bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web) = 0;
// For URL secondlife:///app/foo/bar/baz?cat=1&dog=2
// @params - array of "bar", "baz", possibly empty
@ -104,6 +105,7 @@ public:
static bool dispatch(const std::string& cmd,
const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web,
const std::string& nav_type,
bool trusted_browser);

View File

@ -43,8 +43,10 @@ class LLEventHandler : public LLCommandHandler
public:
// requires trusted browser to trigger
LLEventHandler() : LLCommandHandler("event", UNTRUSTED_THROTTLE) { }
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (params.size() < 2)
{

View File

@ -92,8 +92,10 @@ class LLExperienceHandler : public LLCommandHandler
public:
LLExperienceHandler() : LLCommandHandler("experience", UNTRUSTED_THROTTLE) { }
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if(params.size() != 2 || params[1].asString() != "profile")
return false;

View File

@ -49,7 +49,7 @@ LLFloater* get_parent_floater(LLView* view)
}
bool LLFloaterHandler::handle(const LLSD &params, const LLSD &query_map, LLMediaCtrl *web)
bool LLFloaterHandler::handle(const LLSD &params, const LLSD &query_map, const std::string& grid, LLMediaCtrl *web)
{
if (params.size() < 1) return false;
LLFloater* floater = NULL;

View File

@ -33,7 +33,7 @@ class LLFloaterHandler
{
public:
LLFloaterHandler() : LLCommandHandler("floater", UNTRUSTED_BLOCK) { }
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web);
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web);
};
#endif

View File

@ -901,8 +901,10 @@ public:
LLChatCommandHandler() : LLCommandHandler("chat", UNTRUSTED_BLOCK) { }
// Your code here
bool handle(const LLSD& tokens, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
bool retval = false;
// Need at least 2 tokens to have a valid message.

View File

@ -46,7 +46,7 @@ class LLSearchHandler : public LLCommandHandler
public:
// requires trusted browser to trigger
LLSearchHandler() : LLCommandHandler("search", UNTRUSTED_CLICK_ONLY) { }
bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableSearch"))
{

View File

@ -124,8 +124,10 @@ public:
// requires trusted browser to trigger
LLWorldMapHandler() : LLCommandHandler("worldmap", UNTRUSTED_CLICK_ONLY ) { }
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableWorldMap"))
{
@ -163,7 +165,10 @@ public:
{
}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableWorldMap"))
{

View File

@ -78,8 +78,10 @@ public:
return true;
}
bool handle(const LLSD& tokens, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (LLStartUp::getStartupState() < STATE_STARTED)
{

View File

@ -87,6 +87,7 @@ void LLLoginHandler::parse(const LLSD& queryMap)
bool LLLoginHandler::handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
// do nothing if we are already logged in

View File

@ -35,7 +35,7 @@ class LLLoginHandler : public LLCommandHandler
public:
// allow from external browsers
LLLoginHandler() : LLCommandHandler("login", UNTRUSTED_ALLOW) { }
/*virtual*/ bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web);
/*virtual*/ bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web);
// Fill in our internal fields from a SLURL like
// secondlife:///app/login?first=Bob&last=Dobbs

View File

@ -1665,7 +1665,7 @@ class LLMetricSystemHandler : public LLCommandHandler
public:
LLMetricSystemHandler() : LLCommandHandler("metricsystem", UNTRUSTED_CLICK_ONLY) { }
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
// change height units TRUE for meters and FALSE for feet
BOOL new_value = (gSavedSettings.getBOOL("HeightUnits") == FALSE) ? TRUE : FALSE;

View File

@ -97,7 +97,7 @@ class LLLoginLocationAutoHandler : public LLCommandHandler
public:
// don't allow from external browsers
LLLoginLocationAutoHandler() : LLCommandHandler("location_login", UNTRUSTED_BLOCK) { }
bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
{

View File

@ -91,8 +91,10 @@ class LLParcelHandler : public LLCommandHandler
public:
// requires trusted browser to trigger
LLParcelHandler() : LLCommandHandler("parcel", UNTRUSTED_THROTTLE) { }
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (params.size() < 2)
{

View File

@ -460,8 +460,10 @@ public:
// requires trusted browser to trigger
LLProfileHandler() : LLCommandHandler("profile", UNTRUSTED_THROTTLE) { }
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (params.size() < 1) return false;
std::string agent_name = params[0];
@ -508,8 +510,10 @@ public:
return false;
}
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (params.size() < 2) return false;
LLUUID avatar_id;

View File

@ -106,7 +106,7 @@ public:
return true;
}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (LLStartUp::getStartupState() < STATE_STARTED)
{

View File

@ -87,8 +87,10 @@ public:
return true;
}
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (LLStartUp::getStartupState() < STATE_STARTED)
{

View File

@ -38,7 +38,7 @@ public:
{
}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableAvatarShare"))
{

View File

@ -729,7 +729,7 @@ class LLBalanceHandler : public LLCommandHandler
public:
// Requires "trusted" browser/URL source
LLBalanceHandler() : LLCommandHandler("balance", UNTRUSTED_BLOCK) { }
bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& tokens, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (tokens.size() == 1
&& tokens[0].asString() == "request")

View File

@ -97,6 +97,8 @@ private:
// Called by LLWorldMap when a region name has been resolved to a
// location in-world, used by places-panel display.
static bool handleGrid(const LLSLURL& slurl);
friend class LLTeleportHandler;
};
@ -155,7 +157,7 @@ bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl,
LL_INFOS() << "cmd: " << slurl.getAppCmd() << " path: " << slurl.getAppPath() << " query: " << slurl.getAppQuery() << LL_ENDL;
const LLSD& query_map = LLURI::queryMap(slurl.getAppQuery());
bool handled = LLCommandDispatcher::dispatch(
slurl.getAppCmd(), slurl.getAppPath(), query_map, web, nav_type, trusted_browser);
slurl.getAppCmd(), slurl.getAppPath(), query_map, slurl.getGrid(), web, nav_type, trusted_browser);
// alert if we didn't handle this secondlife:///app/ SLURL
// (but still return true because it is a valid app SLURL)
@ -184,6 +186,11 @@ bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, const std::string
return true;
}
if (!handleGrid(slurl))
{
return true;
}
// Request a region handle by name
LLWorldMapMessage::getInstance()->sendNamedRegionRequest(slurl.getRegion(),
LLURLDispatcherImpl::regionNameCallback,
@ -202,31 +209,39 @@ void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const LLSLURL& s
}
}
bool LLURLDispatcherImpl::handleGrid(const LLSLURL& slurl)
{
if (LLGridManager::getInstance()->getGrid(slurl.getGrid())
!= LLGridManager::getInstance()->getGrid())
{
LLSD args;
args["SLURL"] = slurl.getLocationString();
args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
std::string grid_label =
LLGridManager::getInstance()->getGridLabel(slurl.getGrid());
if (!grid_label.empty())
{
args["GRID"] = grid_label;
}
else
{
args["GRID"] = slurl.getGrid();
}
LLNotificationsUtil::add("CantTeleportToGrid", args);
return false;
}
return true;
}
/* static */
void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
{
// we can't teleport cross grid at this point
if( LLGridManager::getInstance()->getGrid(slurl.getGrid())
!= LLGridManager::getInstance()->getGrid())
{
LLSD args;
args["SLURL"] = slurl.getLocationString();
args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
std::string grid_label =
LLGridManager::getInstance()->getGridLabel(slurl.getGrid());
if(!grid_label.empty())
{
args["GRID"] = grid_label;
}
else
{
args["GRID"] = slurl.getGrid();
}
LLNotificationsUtil::add("CantTeleportToGrid", args);
return;
}
if (!handleGrid(slurl))
{
// we can't teleport cross grid at this point
return;
}
LLVector3d global_pos = from_region_handle(region_handle);
global_pos += LLVector3d(slurl.getPosition());
@ -274,8 +289,10 @@ public:
&LLTeleportHandler::from_event);
}
bool handle(const LLSD& tokens, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& tokens,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
// construct a "normal" SLURL, resolve the region to
// a global position, and teleport to it
@ -297,7 +314,7 @@ public:
LLSD payload;
payload["region_name"] = region_name;
payload["callback_url"] = LLSLURL(region_name, coords).getSLURLString();
payload["callback_url"] = LLSLURL(grid, region_name, coords).getSLURLString();
LLNotificationsUtil::add("TeleportViaSLAPP", args, payload);
return true;

View File

@ -270,6 +270,7 @@ public:
bool handle(
const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web) override
{
if (params.size() != 1)

View File

@ -45,7 +45,7 @@ public:
// requests will be throttled from a non-trusted browser
LLHelpHandler() : LLCommandHandler("help", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
LLViewerHelp* vhelp = LLViewerHelp::getInstance();
if (! vhelp)

View File

@ -234,8 +234,10 @@ public:
// requires trusted browser to trigger
LLInventoryHandler() : LLCommandHandler("inventory", UNTRUSTED_CLICK_ONLY) { }
bool handle(const LLSD& params, const LLSD& query_map,
LLMediaCtrl* web)
bool handle(const LLSD& params,
const LLSD& query_map,
const std::string& grid,
LLMediaCtrl* web)
{
if (params.size() < 1)
{

View File

@ -131,8 +131,8 @@ class LLRegionHandler : public LLCommandHandler
public:
// requests will be throttled from a non-trusted browser
LLRegionHandler() : LLCommandHandler("region", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
// make sure that we at least have a region name
int num_params = params.size();
@ -143,6 +143,10 @@ public:
// build a secondlife://{PLACE} SLurl from this SLapp
std::string url = "secondlife://";
if (!grid.empty())
{
url += grid + "/secondlife/";
}
boost::regex name_rx("[A-Za-z0-9()_%]+");
boost::regex coord_rx("[0-9]+");
for (int i = 0; i < num_params; i++)

View File

@ -38,7 +38,7 @@ public:
{
}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (!LLUI::getInstance()->mSettingGroups["config"]->getBOOL("EnableVoiceCall"))
{

View File

@ -53,7 +53,7 @@ public:
// requests will be throttled from a non-trusted browser
LLVoiceHandler() : LLCommandHandler("voice", UNTRUSTED_THROTTLE) {}
bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web)
{
if (params[0].asString() == "effects")
{

View File

@ -50,6 +50,7 @@
#include "lltextureview.h"
#include "lltracker.h"
#include "llviewercamera.h"
#include "llviewernetwork.h"
#include "llviewertexture.h"
#include "llviewertexturelist.h"
#include "llviewerregion.h"
@ -1829,7 +1830,7 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask )
// Invoke the event details floater if someone is clicking on an event.
LLSD params(LLSD::emptyArray());
params.append(event_id);
LLCommandDispatcher::dispatch("event", params, LLSD(), NULL, "clicked", true);
LLCommandDispatcher::dispatch("event", params, LLSD(), LLGridManager::getInstance()->getGrid(), NULL, "clicked", true);
break;
}
case MAP_ITEM_LAND_FOR_SALE: