Change IDs for activity and object in api.me.sendNote
This commit is contained in:
parent
eec496c253
commit
e5abc50884
|
@ -37,7 +37,19 @@ module.exports = {
|
|||
else return null
|
||||
return o
|
||||
},
|
||||
apRandomURL: () => {
|
||||
return 'https://'+apex.domain+'/'+crypto.randomUUID()
|
||||
apRandomURL: (masks) => {
|
||||
masks = masks || [':id']
|
||||
if (typeof masks === 'string')
|
||||
masks = [ masks ]
|
||||
var result = []
|
||||
const id = crypto.randomUUID()
|
||||
for (var i = 0; i < masks.length; i++)
|
||||
result.push(`https://${apex.domain}/`
|
||||
+masks[i].replaceAll(':id', id))
|
||||
if (result.length === 0)
|
||||
return null
|
||||
if (result.length === 1)
|
||||
return result[0]
|
||||
return result
|
||||
},
|
||||
}
|
||||
|
|
|
@ -127,14 +127,14 @@ async function sendNote(from, to, html, modc) {
|
|||
if ([false, undefined, null].includes(to))
|
||||
return false
|
||||
|
||||
const id = utils.apRandomURL()
|
||||
const ids = utils.apRandomURL(['s/:id', 'o/:id'])
|
||||
var payload = {
|
||||
id: id+'#activity',
|
||||
id: ids[0],
|
||||
type: 'Create',
|
||||
actor: actor.id,
|
||||
to: [ to.url ],
|
||||
object: {
|
||||
id,
|
||||
id: ids[1],
|
||||
type: 'Note',
|
||||
content: html,
|
||||
attributedTo: actor.id,
|
||||
|
|
Loading…
Reference in New Issue