From 6b2d684dac30e5f1ea12a3c191dd53ef427c0302 Mon Sep 17 00:00:00 2001 From: Lanius Trolling Date: Thu, 11 Jan 2024 11:06:32 -0500 Subject: [PATCH] Minor tweaks --- src/jvmMain/kotlin/info/mechyrdia/lore/views_rss.kt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/jvmMain/kotlin/info/mechyrdia/lore/views_rss.kt b/src/jvmMain/kotlin/info/mechyrdia/lore/views_rss.kt index f2bd700..2cd2f60 100644 --- a/src/jvmMain/kotlin/info/mechyrdia/lore/views_rss.kt +++ b/src/jvmMain/kotlin/info/mechyrdia/lore/views_rss.kt @@ -3,6 +3,7 @@ package info.mechyrdia.lore import com.mongodb.client.model.Sorts import info.mechyrdia.Configuration import info.mechyrdia.data.* +import io.ktor.http.* import io.ktor.server.application.* import io.ktor.util.* import kotlinx.coroutines.flow.filterNot @@ -63,13 +64,7 @@ fun Appendable.generateRecentPageEdits() { RssItemEnclosure( url = url, length = file.length(), - type = when { - url.endsWith(".png") -> "image/png" - url.endsWith(".gif") -> "image/gif" - url.endsWith(".jpg") || url.endsWith(".jpeg") -> "image/jpeg" - url.endsWith(".svg") -> "image/svg+xml" - else -> "application/octet-stream" - } + type = ContentType.defaultForFile(file).toString() ) } @@ -114,7 +109,7 @@ suspend fun ApplicationCall.recentCommentsRssFeedGenerator(): Appendable.() -> U nationCache ) - val mostRecentComment = comments.firstOrNull()?.submittedAt + val mostRecentComment = comments.firstOrNull()?.let { it.lastEdit ?: it.submittedAt } return RssChannel( title = "Recent Comments | The Hour of Decision", @@ -132,7 +127,7 @@ suspend fun ApplicationCall.recentCommentsRssFeedGenerator(): Appendable.() -> U description = commentToPlainText(comment.contentsRaw), link = "https://mechyrdia.info/comment/view/${comment.id}", author = null, - comments = "https://mechyrdia.info/lore/${comment.submittedIn}#comments", + comments = "https://mechyrdia.info/lore/${comment.submittedIn}#comment-${comment.id}", pubDate = comment.lastEdit ?: comment.submittedAt, categories = listOf( RssCategory(domain = "https://nationstates.net", category = comment.submittedBy.name) -- 2.25.1