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
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()
)
}
nationCache
)
- val mostRecentComment = comments.firstOrNull()?.submittedAt
+ val mostRecentComment = comments.firstOrNull()?.let { it.lastEdit ?: it.submittedAt }
return RssChannel(
title = "Recent Comments | The Hour of Decision",
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)