fix: changes in accordance with cdn overhaul
Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
parent
3c2556872c
commit
872940900a
|
|
@ -181,7 +181,7 @@ fun InviteScreen(
|
|||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
GlideImage(
|
||||
model = "$REVOLT_FILES/banners/${invite?.serverBanner?.id}",
|
||||
model = "$REVOLT_FILES/banners/${invite?.serverBanner?.id}/${invite?.serverBanner?.filename}",
|
||||
contentScale = ContentScale.Crop,
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
|
|
@ -206,7 +206,7 @@ fun InviteScreen(
|
|||
) {
|
||||
if (invite?.serverIcon != null) {
|
||||
RemoteImage(
|
||||
url = "$REVOLT_FILES/icons/${invite.serverIcon.id}?max_side=256",
|
||||
url = "$REVOLT_FILES/icons/${invite.serverIcon.id}/${invite.serverIcon.filename}",
|
||||
description = viewModel.inviteResult?.value?.serverName
|
||||
?: stringResource(id = R.string.unknown),
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -205,7 +205,6 @@ class MainActivityViewModel @Inject constructor(
|
|||
|
||||
try {
|
||||
Log.d("MainActivity", "Onboarding state is complete, logging in")
|
||||
throw Exception("Test")
|
||||
RevoltAPI.loginAs(token)
|
||||
RevoltAPI.setSessionId(id)
|
||||
startWithDestination("chat")
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import chat.revolt.api.schemas.User
|
|||
object ResourceLocations {
|
||||
fun userAvatarUrl(user: User?): String {
|
||||
if (user?.avatar != null) {
|
||||
return "$REVOLT_FILES/avatars/${user.avatar.id}/user.png?max_side=256"
|
||||
return "$REVOLT_FILES/avatars/${user.avatar.id}"
|
||||
}
|
||||
return "/users/${(user?.id ?: "").ifBlank { "0".repeat(26) }}/default_avatar".api()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package chat.revolt.api.routes.microservices.autumn
|
||||
|
||||
import chat.revolt.api.REVOLT_FILES
|
||||
import chat.revolt.api.RevoltAPI
|
||||
import chat.revolt.api.RevoltHttp
|
||||
import chat.revolt.api.RevoltJson
|
||||
import chat.revolt.api.schemas.AutumnError
|
||||
|
|
@ -8,6 +9,7 @@ import chat.revolt.api.schemas.AutumnId
|
|||
import io.ktor.client.plugins.onUpload
|
||||
import io.ktor.client.request.forms.MultiPartFormDataContent
|
||||
import io.ktor.client.request.forms.formData
|
||||
import io.ktor.client.request.header
|
||||
import io.ktor.client.request.post
|
||||
import io.ktor.client.request.setBody
|
||||
import io.ktor.client.statement.bodyAsText
|
||||
|
|
@ -50,6 +52,7 @@ suspend fun uploadToAutumn(
|
|||
}
|
||||
)
|
||||
)
|
||||
header(RevoltAPI.TOKEN_HEADER_NAME, RevoltAPI.sessionToken)
|
||||
onUpload { bytesSentTotal, contentLength ->
|
||||
contentLength?.let { onProgress(bytesSentTotal, it) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ fun MemberListItem(
|
|||
?: user?.id
|
||||
?: userId,
|
||||
avatar = user?.avatar,
|
||||
rawUrl = member?.avatar?.let { "$REVOLT_FILES/avatars/${it.id}?max_side=256" },
|
||||
rawUrl = member?.avatar?.let { "$REVOLT_FILES/avatars/${it.id}" },
|
||||
userId = userId,
|
||||
presence = presenceFromStatus(
|
||||
user?.status?.presence,
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ fun authorAvatarUrl(message: MessageSchema): String? {
|
|||
val member = message.author?.let { RevoltAPI.members.getMember(serverId, it) }
|
||||
?: return null
|
||||
|
||||
return member.avatar?.let { "$REVOLT_FILES/avatars/${it.id}?max_side=256" }
|
||||
return member.avatar?.let { "$REVOLT_FILES/avatars/${it.id}" }
|
||||
}
|
||||
|
||||
fun viewUrlInBrowser(ctx: android.content.Context, url: String) {
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ fun NativeMessageField(
|
|||
userId = item.user.id ?: "",
|
||||
avatar = item.user.avatar,
|
||||
rawUrl = item.member?.avatar?.id?.let {
|
||||
"$REVOLT_FILES/avatars/$it?max_side=64"
|
||||
"$REVOLT_FILES/avatars/$it"
|
||||
},
|
||||
size = SuggestionChipDefaults.IconSize,
|
||||
)
|
||||
|
|
@ -317,7 +317,7 @@ fun NativeMessageField(
|
|||
)
|
||||
} else {
|
||||
RemoteImage(
|
||||
url = "$REVOLT_FILES/emojis/${item.custom?.id}/emoji.gif",
|
||||
url = "$REVOLT_FILES/emojis/${item.custom?.id}",
|
||||
description = null,
|
||||
contentScale = ContentScale.Fit,
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ fun Reaction(
|
|||
CompositionLocalProvider(LocalContentColor provides foreground) {
|
||||
if (emoji.isUlid()) {
|
||||
RemoteImage(
|
||||
url = "$REVOLT_FILES/emojis/${emoji}/emoji.gif",
|
||||
url = "$REVOLT_FILES/emojis/${emoji}",
|
||||
description = null,
|
||||
modifier = Modifier.size(16.dp)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ fun EmojiPicker(
|
|||
)
|
||||
} else {
|
||||
RemoteImage(
|
||||
url = "$REVOLT_FILES/icons/${server.icon.id}/icon.gif?max_side=64",
|
||||
url = "$REVOLT_FILES/icons/${server.icon.id}",
|
||||
description = server.name,
|
||||
modifier = Modifier
|
||||
.clip(CircleShape)
|
||||
|
|
@ -621,7 +621,7 @@ fun ColumnScope.PickerItem(
|
|||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
RemoteImage(
|
||||
url = "$REVOLT_FILES/emojis/${item.emote.id}/emoji.gif",
|
||||
url = "$REVOLT_FILES/emojis/${item.emote.id}",
|
||||
description = item.emote.name,
|
||||
contentScale = ContentScale.Fit,
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ fun UserAvatar(
|
|||
) {
|
||||
if (avatar != null) {
|
||||
RemoteImage(
|
||||
url = rawUrl ?: "$REVOLT_FILES/avatars/${avatar.id}/user.png?max_side=256",
|
||||
url = rawUrl ?: "$REVOLT_FILES/avatars/${avatar.id}",
|
||||
contentScale = ContentScale.Crop,
|
||||
description = stringResource(id = R.string.avatar_alt, username),
|
||||
modifier = Modifier
|
||||
|
|
@ -164,7 +164,7 @@ fun GroupIcon(
|
|||
) {
|
||||
if (icon?.id != null) {
|
||||
RemoteImage(
|
||||
url = rawUrl ?: "$REVOLT_FILES/icons/${icon.id}/group.png",
|
||||
url = rawUrl ?: "$REVOLT_FILES/icons/${icon.id}",
|
||||
contentScale = ContentScale.Crop,
|
||||
description = stringResource(id = R.string.avatar_alt, name),
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ fun MarkdownText(textNode: AstNode, modifier: Modifier = Modifier) {
|
|||
} else {
|
||||
with(LocalDensity.current) {
|
||||
RemoteImage(
|
||||
url = "$REVOLT_FILES/emojis/${id}/emoji.gif",
|
||||
url = "$REVOLT_FILES/emojis/${id}",
|
||||
description = emote.name,
|
||||
contentScale = ContentScale.Fit,
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ fun ChannelSheetHeader(
|
|||
) {
|
||||
if (channelIcon != null) {
|
||||
RemoteImage(
|
||||
url = "$REVOLT_FILES/icons/${channelIcon.id ?: ""}?max_side=48",
|
||||
url = "$REVOLT_FILES/icons/${channelIcon.id ?: ""}",
|
||||
description = null, // decorative
|
||||
contentScale = ContentScale.Crop,
|
||||
height = 48,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ fun StackedUserAvatars(users: List<String>, amount: Int = 3, serverId: String?)
|
|||
userId = userId,
|
||||
username = user?.let { User.resolveDefaultName(it) }
|
||||
?: stringResource(id = R.string.unknown),
|
||||
rawUrl = maybeMember?.avatar?.let { "$REVOLT_FILES/avatars/${it.id}?max_side=256" },
|
||||
rawUrl = maybeMember?.avatar?.let { "$REVOLT_FILES/avatars/${it.id}" },
|
||||
size = 16.dp,
|
||||
modifier = Modifier
|
||||
.offset(
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ fun ChannelSideDrawer(
|
|||
}
|
||||
}) {
|
||||
val icon = serverInList.icon?.id?.let { iconId ->
|
||||
"$REVOLT_FILES/icons/$iconId/server.png?max_side=256"
|
||||
"$REVOLT_FILES/icons/$iconId"
|
||||
}
|
||||
if (icon != null) {
|
||||
RemoteImage(
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ fun ServerOverview(server: Server) {
|
|||
)
|
||||
|
||||
RemoteImage(
|
||||
url = "$REVOLT_FILES/banners/${it.id}",
|
||||
url = "$REVOLT_FILES/banners/${it.id}/${it.filename}",
|
||||
description = null,
|
||||
modifier = Modifier
|
||||
.height(166.dp)
|
||||
|
|
@ -80,7 +80,7 @@ fun ServerOverview(server: Server) {
|
|||
) {
|
||||
server.icon?.let {
|
||||
RemoteImage(
|
||||
url = "$REVOLT_FILES/icons/${it.id}/server.png?max_side=256",
|
||||
url = "$REVOLT_FILES/icons/${it.id}",
|
||||
description = null,
|
||||
modifier = Modifier
|
||||
.clip(CircleShape)
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ fun RawUserOverview(
|
|||
if (background != null) {
|
||||
RemoteImage(
|
||||
url = backgroundUrl
|
||||
?: "$REVOLT_FILES/backgrounds/${if (background is AutumnResource) background.id else null}",
|
||||
?: "$REVOLT_FILES/backgrounds/${if (background is AutumnResource) background.id else null}/${if (background is AutumnResource) background.filename else background}",
|
||||
description = null,
|
||||
modifier = Modifier
|
||||
.height(128.dp)
|
||||
|
|
|
|||
|
|
@ -675,7 +675,7 @@ private fun JBMText(node: ASTNode, modifier: Modifier) {
|
|||
} else {
|
||||
with(LocalDensity.current) {
|
||||
RemoteImage(
|
||||
url = "$REVOLT_FILES/emojis/${id}/emoji.gif",
|
||||
url = "$REVOLT_FILES/emojis/${id}",
|
||||
description = emote.name,
|
||||
contentScale = ContentScale.Fit,
|
||||
modifier = Modifier
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ fun ReactionInfoSheet(messageId: String, emoji: String, onDismiss: () -> Unit) {
|
|||
if (emoji.isUlid()) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
RemoteImage(
|
||||
url = "$REVOLT_FILES/emojis/${emoji}/emoji.gif",
|
||||
url = "$REVOLT_FILES/emojis/${emoji}",
|
||||
description = null,
|
||||
modifier = Modifier.size(16.dp)
|
||||
)
|
||||
|
|
@ -214,7 +214,7 @@ fun ReactionInfoSheet(messageId: String, emoji: String, onDismiss: () -> Unit) {
|
|||
if (current.isUlid()) {
|
||||
val cached = extendedEmojiInfo.find { it.id == current }
|
||||
RemoteImage(
|
||||
url = "$REVOLT_FILES/emojis/$current/emoji.gif",
|
||||
url = "$REVOLT_FILES/emojis/$current",
|
||||
description = cached?.name,
|
||||
contentScale = ContentScale.Fit,
|
||||
modifier = Modifier
|
||||
|
|
|
|||
Loading…
Reference in New Issue