1
0
mirror of https://github.com/accelforce/Yuito synced 2024-12-22 13:24:46 +01:00

Update LinkHelper.kt

Add URL formats used by Bookwyrm
This commit is contained in:
Mike Barnes 2023-08-07 19:39:54 +10:00 committed by GitHub
parent 846289b8cc
commit 28fd9911b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -284,6 +284,8 @@ fun openLinkInCustomTab(uri: Uri, context: Context) {
// https://gts.foo.bar/@goblin/statuses/01GH9XANCJ0TA8Y95VE9H3Y0Q2
// https://gts.foo.bar/@goblin
// 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 {
val uri: URI
try {
@ -304,6 +306,8 @@ fun looksLikeMastodonUrl(urlString: String): Boolean {
it.matches("^/@[^/]+/\\d+$".toRegex()) ||
it.matches("^/users/[^/]+/statuses/\\d+$".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("^/objects/[-a-f0-9]+$".toRegex()) ||
it.matches("^/notes/[a-z0-9]+$".toRegex()) ||