feat: show room avatar when is DM
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
/*
|
||||
* Created by sweetbread
|
||||
* Copyright (c) 2025. All rights reserved.
|
||||
* Last modified 03.03.2025, 15:40
|
||||
*/
|
||||
|
||||
package ru.risdeveau.pixeldragon.api
|
||||
@@ -28,9 +27,11 @@ suspend fun getHomeserver(url: String): String? {
|
||||
return homeserver
|
||||
}
|
||||
|
||||
fun mxcToUrl(mxc: String): String {
|
||||
val pattern = Regex("mxc://([-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6})/([a-zA-Z]+)")
|
||||
fun mxcToUrl(mxc: String): String? {
|
||||
val pattern = Regex("mxc://([-a-zA-Z0-9@:%._+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6})/([a-zA-Z0-9]+)")
|
||||
val match = pattern.find(mxc)
|
||||
|
||||
if ((match?.groupValues[1] == null) or (match?.groupValues[2] == null)) return null
|
||||
|
||||
return "$homeserver/_matrix/client/v1/media/download/${match?.groupValues[1]}/${match?.groupValues[2]}"
|
||||
}
|
||||
Reference in New Issue
Block a user