Update LinkHelper.kt
Add URL formats used by Bookwyrm
This commit is contained in:
parent
846289b8cc
commit
28fd9911b0
1 changed files with 4 additions and 0 deletions
|
@ -284,6 +284,8 @@ fun openLinkInCustomTab(uri: Uri, context: Context) {
|
||||||
// https://gts.foo.bar/@goblin/statuses/01GH9XANCJ0TA8Y95VE9H3Y0Q2
|
// https://gts.foo.bar/@goblin/statuses/01GH9XANCJ0TA8Y95VE9H3Y0Q2
|
||||||
// https://gts.foo.bar/@goblin
|
// https://gts.foo.bar/@goblin
|
||||||
// https://foo.microblog.pub/o/5b64045effd24f48a27d7059f6cb38f5
|
// https://foo.microblog.pub/o/5b64045effd24f48a27d7059f6cb38f5
|
||||||
|
// https://bookwyrm.foo.bar/user/User
|
||||||
|
// https://bookwyrm.foo.bar/user/User/comment/123456
|
||||||
fun looksLikeMastodonUrl(urlString: String): Boolean {
|
fun looksLikeMastodonUrl(urlString: String): Boolean {
|
||||||
val uri: URI
|
val uri: URI
|
||||||
try {
|
try {
|
||||||
|
@ -304,6 +306,8 @@ fun looksLikeMastodonUrl(urlString: String): Boolean {
|
||||||
it.matches("^/@[^/]+/\\d+$".toRegex()) ||
|
it.matches("^/@[^/]+/\\d+$".toRegex()) ||
|
||||||
it.matches("^/users/[^/]+/statuses/\\d+$".toRegex()) ||
|
it.matches("^/users/[^/]+/statuses/\\d+$".toRegex()) ||
|
||||||
it.matches("^/users/\\w+$".toRegex()) ||
|
it.matches("^/users/\\w+$".toRegex()) ||
|
||||||
|
it.matches("^/user/[^/]+/comment/\\d+$".toRegex()) ||
|
||||||
|
it.matches("^/user/\\w+$".toRegex()) ||
|
||||||
it.matches("^/notice/[a-zA-Z0-9]+$".toRegex()) ||
|
it.matches("^/notice/[a-zA-Z0-9]+$".toRegex()) ||
|
||||||
it.matches("^/objects/[-a-f0-9]+$".toRegex()) ||
|
it.matches("^/objects/[-a-f0-9]+$".toRegex()) ||
|
||||||
it.matches("^/notes/[a-z0-9]+$".toRegex()) ||
|
it.matches("^/notes/[a-z0-9]+$".toRegex()) ||
|
||||||
|
|
Loading…
Reference in a new issue