Add support for io.element.call:/?url=some-encoded-url uri
This commit is contained in:
parent
0c421bdadd
commit
acbdac70be
3 changed files with 41 additions and 0 deletions
|
|
@ -53,6 +53,14 @@
|
|||
<data android:scheme="element" />
|
||||
<data android:host="call" />
|
||||
</intent-filter>
|
||||
<!-- Custom scheme to handle urls from other domains in the format: io.element.call:/?url=https%3A%2F%2Felement.io -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="io.element.call" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
<service android:name=".CallForegroundService" android:enabled="true" android:foregroundServiceType="mediaPlayback" />
|
||||
|
|
|
|||
|
|
@ -38,6 +38,16 @@ object CallIntentDataParser {
|
|||
internalUri.scheme in validHttpSchemes && !internalUri.host.isNullOrBlank()
|
||||
}
|
||||
}
|
||||
scheme == "io.element.call" && parsedUrl.host == null -> {
|
||||
// We use this custom scheme to load arbitrary URLs for other instances of Element Call,
|
||||
// so we can only verify it's an HTTP/HTTPs URL with a non-empty host
|
||||
parsedUrl.getQueryParameter("url")
|
||||
?.let { URLDecoder.decode(it, "utf-8") }
|
||||
?.takeIf {
|
||||
val internalUri = Uri.parse(it)
|
||||
internalUri.scheme in validHttpSchemes && !internalUri.host.isNullOrBlank()
|
||||
}
|
||||
}
|
||||
// This should never be possible, but we still need to take into account the possibility
|
||||
else -> null
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue