Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
80eb5ae1
Commit
80eb5ae1
authored
3 years ago
by
Andrey Kleshchev
Browse files
Options
Downloads
Patches
Plain Diff
SL-15168 Improved uri recognition
parent
2ddbdeb1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/llurlfloaterdispatchhandler.cpp
+31
-25
31 additions, 25 deletions
indra/newview/llurlfloaterdispatchhandler.cpp
with
31 additions
and
25 deletions
indra/newview/llurlfloaterdispatchhandler.cpp
+
31
−
25
View file @
80eb5ae1
...
@@ -52,8 +52,8 @@ const std::string KEY_URI("floater_url");
...
@@ -52,8 +52,8 @@ const std::string KEY_URI("floater_url");
const
std
::
string
KEY_PARAMS
(
"floater_params"
);
const
std
::
string
KEY_PARAMS
(
"floater_params"
);
// Supported floaters, for now it's exact matching, later it might get extended
// Supported floaters, for now it's exact matching, later it might get extended
const
std
::
string
FLOATER_GUIDEBOOK
(
"
secondlife:///
guidebook"
);
// translates to "how_to"
const
std
::
string
FLOATER_GUIDEBOOK
(
"guidebook"
);
// translates to "how_to"
const
std
::
string
FLOATER_WEB_CONTENT
(
"
secondlife:///
browser"
);
// translates to "web_content"
const
std
::
string
FLOATER_WEB_CONTENT
(
"browser"
);
// translates to "web_content"
// Web content universal arguments
// Web content universal arguments
const
std
::
string
KEY_TRUSTED_CONTENT
(
"trusted_content"
);
const
std
::
string
KEY_TRUSTED_CONTENT
(
"trusted_content"
);
...
@@ -68,10 +68,6 @@ const std::string KEY_CAN_CLOSE("can_close");
...
@@ -68,10 +68,6 @@ const std::string KEY_CAN_CLOSE("can_close");
const
std
::
string
KEY_SHOW_PAGE_TITLE
(
"show_page_title"
);
const
std
::
string
KEY_SHOW_PAGE_TITLE
(
"show_page_title"
);
const
std
::
string
KEY_ALLOW_ADRESS_ENTRY
(
"allow_address_entry"
);
// It is not recomended to set this to true if trusted content is allowed
const
std
::
string
KEY_ALLOW_ADRESS_ENTRY
(
"allow_address_entry"
);
// It is not recomended to set this to true if trusted content is allowed
// expected format secondlife:///floater_alias
// intended to be extended to: secondlife:///floater_alias/instance_id
const
boost
::
regex
expression
(
"secondlife:///[^
\n
]{1,256}"
);
LLUrlFloaterDispatchHandler
LLUrlFloaterDispatchHandler
::
sUrlDispatchhandler
;
LLUrlFloaterDispatchHandler
LLUrlFloaterDispatchHandler
::
sUrlDispatchhandler
;
...
@@ -112,7 +108,8 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
...
@@ -112,7 +108,8 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
std
::
string
floater_title
;
std
::
string
floater_title
;
LLSD
command_params
;
LLSD
command_params
;
std
::
string
floater_uri
;
std
::
string
raw_uri
;
std
::
string
floater_identifier
;
if
(
message
.
has
(
KEY_ACTION
)
&&
message
[
KEY_ACTION
].
asString
()
==
VALUE_OPEN_URL
)
if
(
message
.
has
(
KEY_ACTION
)
&&
message
[
KEY_ACTION
].
asString
()
==
VALUE_OPEN_URL
)
{
{
...
@@ -121,14 +118,14 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
...
@@ -121,14 +118,14 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
{
{
floater_title
=
action_data
[
KEY_FLOATER_TITLE
].
asString
();
floater_title
=
action_data
[
KEY_FLOATER_TITLE
].
asString
();
command_params
=
action_data
[
KEY_PARAMS
];
command_params
=
action_data
[
KEY_PARAMS
];
floater
_uri
=
action_data
[
KEY_URI
].
asString
();
raw
_uri
=
action_data
[
KEY_URI
].
asString
();
}
}
}
}
else
if
(
message
.
has
(
KEY_FLOATER_TITLE
))
else
if
(
message
.
has
(
KEY_FLOATER_TITLE
))
{
{
floater_title
=
message
[
KEY_FLOATER_TITLE
].
asString
();
floater_title
=
message
[
KEY_FLOATER_TITLE
].
asString
();
command_params
=
message
[
KEY_PARAMS
];
command_params
=
message
[
KEY_PARAMS
];
floater
_uri
=
message
[
KEY_URI
].
asString
();
raw
_uri
=
message
[
KEY_URI
].
asString
();
}
}
else
else
{
{
...
@@ -136,16 +133,31 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
...
@@ -136,16 +133,31 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
return
false
;
return
false
;
}
}
if
(
floater
_uri
.
find
(
":///"
)
==
std
::
string
::
npos
)
if
(
raw
_uri
.
find
(
":///"
)
==
std
::
string
::
npos
)
{
{
// try unescaping
// try unescaping
floater_uri
=
LLURI
::
unescape
(
floater_uri
);
raw_uri
=
LLURI
::
unescape
(
raw_uri
);
}
LLURI
floater_uri
(
raw_uri
);
if
(
floater_uri
.
scheme
().
empty
()
||
floater_uri
.
scheme
()
!=
"secondlife"
)
{
LL_WARNS
(
"URLFloater"
)
<<
"Received "
<<
raw_uri
<<
" with unexpected scheme in uri: "
<<
floater_uri
<<
LL_ENDL
;
return
false
;
}
}
boost
::
cmatch
what
;
LLSD
path_array
=
floater_uri
.
pathArray
();
if
(
!
boost
::
regex_match
(
floater_uri
.
c_str
(),
what
,
expression
))
S32
path_parts
=
path_array
.
size
();
if
(
path_parts
==
0
)
{
{
LL_WARNS
(
"URLFloater"
)
<<
"Received "
<<
MESSAGE_URL_FLOATER
<<
" with invalid uri: "
<<
floater_uri
<<
LL_ENDL
;
LL_WARNS
(
"URLFloater"
)
<<
"received an empty uri: "
<<
floater_uri
<<
LL_ENDL
;
return
false
;
}
floater_identifier
=
path_array
[
0
];
if
(
floater_identifier
.
size
()
<
3
)
{
LL_WARNS
(
"URLFloater"
)
<<
"received invalid flaoter indentifier: "
<<
floater_identifier
<<
LL_ENDL
;
return
false
;
return
false
;
}
}
...
@@ -162,7 +174,7 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
...
@@ -162,7 +174,7 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
}
}
}
}
if
(
floater_
uri
==
FLOATER_GUIDEBOOK
)
if
(
floater_
identifier
==
FLOATER_GUIDEBOOK
)
{
{
if
(
command_params
.
isMap
())
// by default is undefines
if
(
command_params
.
isMap
())
// by default is undefines
{
{
...
@@ -196,7 +208,7 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
...
@@ -196,7 +208,7 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
instance
->
setCanClose
(
command_params
[
KEY_CAN_CLOSE
].
asBoolean
());
instance
->
setCanClose
(
command_params
[
KEY_CAN_CLOSE
].
asBoolean
());
}
}
}
}
else
if
(
floater_
uri
==
FLOATER_WEB_CONTENT
)
else
if
(
floater_
identifier
==
FLOATER_WEB_CONTENT
)
{
{
if
(
command_params
.
has
(
KEY_URL
))
if
(
command_params
.
has
(
KEY_URL
))
{
{
...
@@ -212,21 +224,15 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
...
@@ -212,21 +224,15 @@ bool LLUrlFloaterDispatchHandler::operator()(const LLDispatcher *, const std::st
}
}
else
else
{
{
LLSD
path_array
=
LLURI
(
floater_uri
).
pathArray
();
if
(
LLFloaterReg
::
isRegistered
(
floater_identifier
))
S32
path_parts
=
path_array
.
size
();
if
(
path_parts
==
0
)
{
LL_INFOS
(
"URLFloater"
)
<<
"received an empty uri: "
<<
floater_uri
<<
LL_ENDL
;
}
else
if
(
LLFloaterReg
::
isRegistered
(
path_array
[
0
]))
{
{
// A valid floater
// A valid floater
LL_INFOS
(
"URLFloater"
)
<<
"Floater "
<<
path_array
[
0
]
<<
" is not supported by llopenfloater or URLFloater"
<<
LL_ENDL
;
LL_INFOS
(
"URLFloater"
)
<<
"Floater "
<<
floater_identifier
<<
" is not supported by llopenfloater or URLFloater"
<<
LL_ENDL
;
}
}
else
else
{
{
// A valid message, but no such flaoter
// A valid message, but no such flaoter
LL_WARNS
(
"URLFloater"
)
<<
"Recieved a command to open unknown floater: "
<<
floater
_uri
<<
LL_ENDL
;
LL_WARNS
(
"URLFloater"
)
<<
"Recieved a command to open unknown floater: "
<<
raw
_uri
<<
LL_ENDL
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment