mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: add timestamp to most activity ids
This commit is contained in:
@@ -130,8 +130,8 @@ Helpers.resolveLocalId = async (input) => {
|
|||||||
|
|
||||||
let activityData = {};
|
let activityData = {};
|
||||||
if (hash.startsWith('#activity')) {
|
if (hash.startsWith('#activity')) {
|
||||||
const [, activity, data] = hash.split('/', 3);
|
const [, activity, data, timestamp] = hash.split('/', 4);
|
||||||
activityData = { activity, data };
|
activityData = { activity, data, timestamp };
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://bb.devnull.land/cid/2#activity/follow/activitypub@community.nodebb.org│
|
// https://bb.devnull.land/cid/2#activity/follow/activitypub@community.nodebb.org│
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ inbox.create = async (req) => {
|
|||||||
const followers = await activitypub.notes.getCategoryFollowers(cid);
|
const followers = await activitypub.notes.getCategoryFollowers(cid);
|
||||||
if (followers.length) {
|
if (followers.length) {
|
||||||
await activitypub.send('cid', cid, followers, {
|
await activitypub.send('cid', cid, followers, {
|
||||||
id: `${object.id}#activity/announce`,
|
id: `${object.id}#activity/announce/${Date.now()}`,
|
||||||
type: 'Announce',
|
type: 'Announce',
|
||||||
to: [`${nconf.get('url')}/category/${cid}/followers`],
|
to: [`${nconf.get('url')}/category/${cid}/followers`],
|
||||||
cc: [activitypub._constants.publicAddress],
|
cc: [activitypub._constants.publicAddress],
|
||||||
@@ -281,7 +281,7 @@ inbox.follow = async (req) => {
|
|||||||
|
|
||||||
user.onFollow(actor, id);
|
user.onFollow(actor, id);
|
||||||
activitypub.send('uid', id, actor, {
|
activitypub.send('uid', id, actor, {
|
||||||
id: `${nconf.get('url')}/${type}/${id}#activity/accept:follow/${handle}`,
|
id: `${nconf.get('url')}/${type}/${id}#activity/accept:follow/${handle}/${Date.now()}`,
|
||||||
type: 'Accept',
|
type: 'Accept',
|
||||||
object: {
|
object: {
|
||||||
id: followId,
|
id: followId,
|
||||||
@@ -308,7 +308,7 @@ inbox.follow = async (req) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
activitypub.send('cid', id, actor, {
|
activitypub.send('cid', id, actor, {
|
||||||
id: `${nconf.get('url')}/${type}/${id}#activity/accept:follow/${handle}`,
|
id: `${nconf.get('url')}/${type}/${id}#activity/accept:follow/${handle}/${Date.now()}`,
|
||||||
type: 'Accept',
|
type: 'Accept',
|
||||||
object: {
|
object: {
|
||||||
id: followId,
|
id: followId,
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
|||||||
const followers = await activitypub.notes.getCategoryFollowers(cid);
|
const followers = await activitypub.notes.getCategoryFollowers(cid);
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
await activitypub.send('cid', cid, followers, {
|
await activitypub.send('cid', cid, followers, {
|
||||||
id: `${object.id}#activity/announce`,
|
id: `${object.id}#activity/announce/${Date.now()}`,
|
||||||
type: 'Announce',
|
type: 'Announce',
|
||||||
to: [`${nconf.get('url')}/category/${cid}/followers`],
|
to: [`${nconf.get('url')}/category/${cid}/followers`],
|
||||||
cc: [activitypub._constants.publicAddress],
|
cc: [activitypub._constants.publicAddress],
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ activitypubApi.unfollow = enabledCheck(async (caller, { type, id, actor }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await activitypub.send(type, id, [actor], {
|
await activitypub.send(type, id, [actor], {
|
||||||
id: `${nconf.get('url')}/${type}/${id}#activity/undo:follow/${handle}`,
|
id: `${nconf.get('url')}/${type}/${id}#activity/undo:follow/${handle}/${Date.now()}`,
|
||||||
type: 'Undo',
|
type: 'Undo',
|
||||||
object,
|
object,
|
||||||
});
|
});
|
||||||
@@ -146,14 +146,14 @@ activitypubApi.create.note = enabledCheck(async (caller, { pid }) => {
|
|||||||
|
|
||||||
const payloads = {
|
const payloads = {
|
||||||
create: {
|
create: {
|
||||||
id: `${object.id}#activity/create`,
|
id: `${object.id}#activity/create/${Date.now()}`,
|
||||||
type: 'Create',
|
type: 'Create',
|
||||||
to,
|
to,
|
||||||
cc,
|
cc,
|
||||||
object,
|
object,
|
||||||
},
|
},
|
||||||
announce: {
|
announce: {
|
||||||
id: `${object.id}#activity/announce`,
|
id: `${object.id}#activity/announce/${Date.now()}`,
|
||||||
type: 'Announce',
|
type: 'Announce',
|
||||||
to: [activitypub._constants.publicAddress],
|
to: [activitypub._constants.publicAddress],
|
||||||
cc: [`${nconf.get('url')}/category/${cid}/followers`],
|
cc: [`${nconf.get('url')}/category/${cid}/followers`],
|
||||||
@@ -277,7 +277,7 @@ activitypubApi.undo.like = enabledCheck(async (caller, { pid }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await activitypub.send('uid', caller.uid, [uid], {
|
await activitypub.send('uid', caller.uid, [uid], {
|
||||||
id: `${nconf.get('url')}/uid/${caller.uid}#activity/undo:like/${encodeURIComponent(pid)}`,
|
id: `${nconf.get('url')}/uid/${caller.uid}#activity/undo:like/${encodeURIComponent(pid)}/${Date.now()}`,
|
||||||
type: 'Undo',
|
type: 'Undo',
|
||||||
object: {
|
object: {
|
||||||
actor: `${nconf.get('url')}/uid/${caller.uid}`,
|
actor: `${nconf.get('url')}/uid/${caller.uid}`,
|
||||||
@@ -318,7 +318,7 @@ activitypubApi.undo.flag = enabledCheck(async (caller, flag) => {
|
|||||||
const reason = flag.reason ||
|
const reason = flag.reason ||
|
||||||
(flag.reports && flag.reports.filter(report => report.reporter.uid === caller.uid).at(-1).value);
|
(flag.reports && flag.reports.filter(report => report.reporter.uid === caller.uid).at(-1).value);
|
||||||
await activitypub.send('uid', caller.uid, reportedIds, {
|
await activitypub.send('uid', caller.uid, reportedIds, {
|
||||||
id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/undo:flag/${caller.uid}`,
|
id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/undo:flag/${caller.uid}/${Date.now()}`,
|
||||||
type: 'Undo',
|
type: 'Undo',
|
||||||
object: {
|
object: {
|
||||||
id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/flag/${caller.uid}`,
|
id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/flag/${caller.uid}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user