improve outbox
This commit is contained in:
@@ -42,7 +42,7 @@ module.exports = {
|
|||||||
icon: {
|
icon: {
|
||||||
type: 'Image',
|
type: 'Image',
|
||||||
mediaType: 'image/png',
|
mediaType: 'image/png',
|
||||||
url: config.baseurl + '/favicon.ico'
|
url: config.baseurl + '/logo.png'
|
||||||
},
|
},
|
||||||
publicKey: {
|
publicKey: {
|
||||||
id: `${config.baseurl}/federation/u/${name}#main-key`,
|
id: `${config.baseurl}/federation/u/${name}#main-key`,
|
||||||
@@ -97,7 +97,7 @@ module.exports = {
|
|||||||
if (!name) { return res.status(400).send('Bad request.') }
|
if (!name) { return res.status(400).send('Bad request.') }
|
||||||
if (name !== req.settings.instance_name) { return res.status(404).send(`No record found for ${name}`) }
|
if (name !== req.settings.instance_name) { return res.status(404).send(`No record found for ${name}`) }
|
||||||
|
|
||||||
const events = await Event.findAll({ include: [Tag, Place] })
|
const events = await Event.findAll({ include: [{ model: Tag, required: false }, Place] })
|
||||||
|
|
||||||
debug('Inside outbox, should return all events from this user')
|
debug('Inside outbox, should return all events from this user')
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ module.exports = {
|
|||||||
res.type('application/activity+json; charset=utf-8')
|
res.type('application/activity+json; charset=utf-8')
|
||||||
if (!page) {
|
if (!page) {
|
||||||
return res.json({
|
return res.json({
|
||||||
'@context': ['https://www.w3.org/ns/activitystreams'],
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
id: `${config.baseurl}/federation/u/${name}/outbox`,
|
id: `${config.baseurl}/federation/u/${name}/outbox`,
|
||||||
type: 'OrderedCollection',
|
type: 'OrderedCollection',
|
||||||
totalItems: events.length,
|
totalItems: events.length,
|
||||||
@@ -121,16 +121,16 @@ module.exports = {
|
|||||||
type: 'OrderedCollectionPage',
|
type: 'OrderedCollectionPage',
|
||||||
totalItems: events.length,
|
totalItems: events.length,
|
||||||
partOf: `${config.baseurl}/federation/u/${name}/outbox`,
|
partOf: `${config.baseurl}/federation/u/${name}/outbox`,
|
||||||
orderedItems: events.map(e => ({ ...e.toAP(name, req.settings.locale), actor: `${config.baseurl}/federation/u/${name}` }))
|
orderedItems:
|
||||||
// user.events.map(e => ({
|
events.map(e => ({
|
||||||
// id: `${config.baseurl}/federation/m/${e.id}#create`,
|
id: `${config.baseurl}/federation/m/${e.id}#create`,
|
||||||
// type: 'Create',
|
type: 'Create',
|
||||||
// to: ['https://www.w3.org/ns/activitystreams#Public'],
|
to: ['https://www.w3.org/ns/activitystreams#Public'],
|
||||||
// cc: [`${config.baseurl}/federation/u/${user.username}/followers`],
|
cc: [`${config.baseurl}/federation/u/${name}/followers`],
|
||||||
// published: e.createdAt,
|
published: e.createdAt,
|
||||||
// actor: `${config.baseurl}/federation/u/${user.username}`,
|
actor: `${config.baseurl}/federation/u/${name}`,
|
||||||
// object: e.toNoteAP(user.username)
|
object: e.toAP(name, req.settings.locale)
|
||||||
// }))
|
}))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user