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
|
else return null
|
||||||
return o
|
return o
|
||||||
},
|
},
|
||||||
apRandomURL: () => {
|
apRandomURL: (masks) => {
|
||||||
return 'https://'+apex.domain+'/'+crypto.randomUUID()
|
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))
|
if ([false, undefined, null].includes(to))
|
||||||
return false
|
return false
|
||||||
|
|
||||||
const id = utils.apRandomURL()
|
const ids = utils.apRandomURL(['s/:id', 'o/:id'])
|
||||||
var payload = {
|
var payload = {
|
||||||
id: id+'#activity',
|
id: ids[0],
|
||||||
type: 'Create',
|
type: 'Create',
|
||||||
actor: actor.id,
|
actor: actor.id,
|
||||||
to: [ to.url ],
|
to: [ to.url ],
|
||||||
object: {
|
object: {
|
||||||
id,
|
id: ids[1],
|
||||||
type: 'Note',
|
type: 'Note',
|
||||||
content: html,
|
content: html,
|
||||||
attributedTo: actor.id,
|
attributedTo: actor.id,
|
||||||
|
|
Loading…
Reference in New Issue