mirror of
https://github.com/etesync/android
synced 2024-11-16 04:49:06 +00:00
Webview: improve whitelist, and include all of the "accounts/" subpath.
This commit is contained in:
parent
e7694924b4
commit
d21a498925
@ -142,10 +142,27 @@ public class WebViewActivity extends AppCompatActivity {
|
|||||||
uri1.getPath().equals(uri2.getPath());
|
uri1.getPath().equals(uri2.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean allowedUris(Uri allowedUris[], Uri uri2) {
|
||||||
|
for (Uri uri : allowedUris) {
|
||||||
|
if (uriEqual(uri, uri2)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean shouldOverrideUrl(Uri uri) {
|
private boolean shouldOverrideUrl(Uri uri) {
|
||||||
if (uriEqual(Constants.faqUri, uri) ||
|
final Uri allowedUris[] = new Uri[]{
|
||||||
uriEqual(Constants.helpUri, uri) ||
|
Constants.faqUri,
|
||||||
uriEqual(Constants.registrationUrl, uri)) {
|
Constants.helpUri,
|
||||||
|
Constants.registrationUrl,
|
||||||
|
};
|
||||||
|
final Uri accountsUri = Constants.webUri.buildUpon().appendEncodedPath("accounts/").build();
|
||||||
|
|
||||||
|
if (allowedUris(allowedUris, uri) ||
|
||||||
|
(uri.getHost().equals(accountsUri.getHost()) &&
|
||||||
|
(uri.getPath().startsWith(accountsUri.getPath())))
|
||||||
|
) {
|
||||||
if (uri.getQueryParameter(QUERY_KEY_EMBEDDED) != null) {
|
if (uri.getQueryParameter(QUERY_KEY_EMBEDDED) != null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user