This commit is contained in:
les
2019-08-25 14:34:26 +02:00
parent 0de68b5054
commit 0eb41a1e12
13 changed files with 48 additions and 105 deletions

View File

@@ -21,7 +21,6 @@ router.get('/m/:event_id', async (req, res) => {
const event_id = req.params.event_id
if (req.accepts('html')) return res.redirect(301, `/event/${event_id}`)
console.error('Not asked for html!')
const event = await Event.findByPk(req.params.event_id, { include: [ User ] })
if (!event) return res.status(404).send('Not found')
return res.json(event.toAP(event.user.username))

View File

@@ -58,7 +58,6 @@ module.exports = {
where: { username: name }
})
if (!user) return res.status(404).send(`No record found for ${name}`)
console.error('Inside outbox, should return all events from this user')
@@ -68,9 +67,7 @@ module.exports = {
'@context': 'https://www.w3.org/ns/activitystreams',
id: `${config.baseurl}/federation/u/${name}/outbox`,
type: 'OrderedCollection',
// summary: `${user.username} outbox`,
totalItems: user.events.length,
// orderedItems: user.events.map(e => e.toAP(user.username))
first: {
id: `${config.baseurl}/federation/u/${name}/outbox?page=true`,
type: 'OrderedCollectionPage',
@@ -78,7 +75,6 @@ module.exports = {
partOf: `${config.baseurl}/federation/u/${name}/outbox`,
orderedItems: user.events.map(e => e.toAP(user.username))
}
// last: `${config.baseurl}/federation/u/${name}/outbox?page=true`
}
res.type('application/activity+json; charset=utf-8')
return res.json(ret)

View File

@@ -94,6 +94,14 @@ router.get('/nodeinfo', async (req, res) => {
})
router.use('/host-meta', (req, res) => {
res.type('application/xml')
res.send(`<?xml version="1.0" encoding="UTF-8"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
<Link rel="lrdd" type="application/xrd+xml" template="${config.baseurl}/.well-known/webfinger?resource={uri}"/>
</XRD>`)
})
// Handle 404
router.use(function(req, res) {
res.status(404).send('404: Page not Found')