val mostRecentChange = pages.firstOrNull()?.stat?.updated
+ val mechyrdiaCategories = listOf(
+ RssCategory(domain = "https://nationstates.net", category = "Mechyrdia")
+ )
+
return RssChannel(
title = "Recently Edited Factbooks | The Hour of Decision",
link = MainDomainName,
pubDate = mostRecentChange,
lastBuildDate = mostRecentChange,
ttl = 30,
- categories = listOf(
- RssCategory(domain = "https://nationstates.net", category = "Mechyrdia")
- ),
+ categories = mechyrdiaCategories,
items = pages.mapSuspend { page ->
val pageLink = page.path.elements.drop(1)
val pageMarkup = FactbookLoader.loadFactbook(pageLink) ?: return@mapSuspend null
author = null,
comments = "$MainDomainName/lore${pageLink.joinToString(separator = "") { "/$it" }}#comments",
enclosure = imageEnclosure,
- pubDate = page.stat.updated
+ pubDate = page.stat.updated,
+ categories = mechyrdiaCategories,
)
}.filterNotNull()
)
val validLimits = 1..100
+ val mechyrdiaCategories = listOf(
+ RssCategory(domain = "https://nationstates.net", category = "Mechyrdia")
+ )
+
if (limit !in validLimits) {
response.status(HttpStatusCode.BadRequest)
pubDate = null,
lastBuildDate = Instant.now(),
ttl = 120,
+ categories = mechyrdiaCategories,
)
}
pubDate = mostRecentComment,
lastBuildDate = mostRecentComment,
ttl = 60,
- categories = listOf(
- RssCategory(domain = "https://nationstates.net", category = "Mechyrdia")
- ),
+ categories = mechyrdiaCategories,
items = comments.map { comment ->
RssItem(
title = "Comment by ${comment.submittedBy.name} on $MainDomainName/${comment.submittedIn}",
author = null,
comments = "$MainDomainName/lore/${comment.submittedIn}#comment-${comment.id}",
pubDate = comment.lastEdit ?: comment.submittedAt,
- categories = listOf(
- RssCategory(domain = "https://nationstates.net", category = comment.submittedBy.name)
- )
+ categories = mechyrdiaCategories + RssCategory(domain = "https://nationstates.net", category = comment.submittedBy.name)
)
}
)