1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2024-09-20 20:47:30 +00:00
bibliogram/src/site/api/feed.js

17 lines
592 B
JavaScript
Raw Normal View History

2020-01-14 14:38:33 +00:00
const constants = require("../../lib/constants")
const {fetchUser} = require("../../lib/collectors")
const {render} = require("pinski/plugins")
module.exports = [
{route: `/u/(${constants.external.username_regex})/rss.xml`, methods: ["GET"], code: async ({url, fill}) => {
const user = await fetchUser(fill[0])
2020-01-26 15:15:53 +00:00
const content = await user.timeline.fetchFeed()
const xml = content.xml()
2020-01-14 14:38:33 +00:00
return {
statusCode: 200,
contentType: "application/rss+xml", // see https://stackoverflow.com/questions/595616/what-is-the-correct-mime-type-to-use-for-an-rss-feed
2020-01-26 15:15:53 +00:00
content: xml
2020-01-14 14:38:33 +00:00
}
}}
]