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