preparing multisite settings, fix #141
This commit is contained in:
@@ -60,6 +60,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
async followers (req, res) {
|
||||
const settings = settingsController.settings
|
||||
const name = req.params.name
|
||||
const page = req.query.page
|
||||
log.debug(`Retrieve ${name} followers`)
|
||||
@@ -76,20 +77,20 @@ module.exports = {
|
||||
log.debug('No pagination')
|
||||
return res.json({
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: `${config.baseurl}/federation/u/${name}/followers`,
|
||||
id: `${settings.baseurl}/federation/u/${name}/followers`,
|
||||
type: 'OrderedCollection',
|
||||
totalItems: followers.length,
|
||||
first: `${config.baseurl}/federation/u/${name}/followers?page=true`
|
||||
first: `${settings.baseurl}/federation/u/${name}/followers?page=true`
|
||||
// last: `${config.baseurl}/federation/u/${name}/followers?page=true`,
|
||||
// orderedItems: followers.map(f => f.ap_id)
|
||||
})
|
||||
}
|
||||
return res.json({
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: `${config.baseurl}/federation/u/${name}/followers?page=${page}`,
|
||||
id: `${settings.baseurl}/federation/u/${name}/followers?page=${page}`,
|
||||
type: 'OrderedCollectionPage',
|
||||
totalItems: followers.length,
|
||||
partOf: `${config.baseurl}/federation/u/${name}/followers`,
|
||||
partOf: `${settings.baseurl}/federation/u/${name}/followers`,
|
||||
orderedItems: followers.map(f => f.ap_id)
|
||||
})
|
||||
},
|
||||
@@ -109,32 +110,32 @@ module.exports = {
|
||||
}
|
||||
|
||||
const events = await Event.findAll({ include: [{ model: Tag, required: false }, Place], limit: 10 })
|
||||
log.debug(`${config.baseurl} Inside ${name} outbox, should return all events from this instance: ${events.length}`)
|
||||
log.debug(`${settings.baseurl} Inside ${name} outbox, should return all events from this instance: ${events.length}`)
|
||||
|
||||
// https://www.w3.org/TR/activitypub/#outbox
|
||||
res.type('application/activity+json; charset=utf-8')
|
||||
if (!page) {
|
||||
return res.json({
|
||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||
id: `${config.baseurl}/federation/u/${name}/outbox`,
|
||||
id: `${settings.baseurl}/federation/u/${name}/outbox`,
|
||||
type: 'OrderedCollection',
|
||||
totalItems: events.length,
|
||||
first: {
|
||||
id: `${config.baseurl}/federation/u/${name}/outbox?page=true`,
|
||||
id: `${settings.baseurl}/federation/u/${name}/outbox?page=true`,
|
||||
type: 'OrderedCollectionPage',
|
||||
// totalItems: events.length,
|
||||
partOf: `${config.baseurl}/federation/u/${name}/outbox`,
|
||||
// prev: `${config.baseurl}/federation/u/${name}/outbox`,
|
||||
// next: page !== 'last' && `${config.baseurl}/federation/u/${name}/outbox?page=last`,
|
||||
partOf: `${settings.baseurl}/federation/u/${name}/outbox`,
|
||||
// prev: `${settings.baseurl}/federation/u/${name}/outbox`,
|
||||
// next: page !== 'last' && `${settings.baseurl}/federation/u/${name}/outbox?page=last`,
|
||||
orderedItems: page === 'last'
|
||||
? []
|
||||
: events.map(e => ({
|
||||
id: `${config.baseurl}/federation/m/${e.id}#create`,
|
||||
id: `${settings.baseurl}/federation/m/${e.id}#create`,
|
||||
type: 'Create',
|
||||
to: ['https://www.w3.org/ns/activitystreams#Public'],
|
||||
cc: [`${config.baseurl}/federation/u/${name}/followers`],
|
||||
cc: [`${settings.baseurl}/federation/u/${name}/followers`],
|
||||
published: dayjs(e.createdAt).utc().format(),
|
||||
actor: `${config.baseurl}/federation/u/${name}`,
|
||||
actor: `${settings.baseurl}/federation/u/${name}`,
|
||||
object: e.toAP(name, settings.instance_locale)
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user