summaryrefslogtreecommitdiff
path: root/packages/backend/src
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2023-03-16 10:41:59 +0000
committerGianni Ceccarelli <gceccarelli@veritone.com>2023-10-02 13:31:00 +0100
commitf31f6011115fb345f3bd2c3cf3938abfaabf37de (patch)
tree509955e1ed8fee6b41cacf0b74181c9e38da26c1 /packages/backend/src
parentchore: change name in console output (diff)
downloadsharkey-f31f6011115fb345f3bd2c3cf3938abfaabf37de.tar.gz
sharkey-f31f6011115fb345f3bd2c3cf3938abfaabf37de.tar.bz2
sharkey-f31f6011115fb345f3bd2c3cf3938abfaabf37de.zip
federade quote-notes a bit better
tested against the treehouse mastodon, but should work with others
Diffstat (limited to 'packages/backend/src')
-rw-r--r--packages/backend/src/core/activitypub/ApRendererService.ts3
-rw-r--r--packages/backend/src/core/activitypub/models/ApNoteService.ts6
-rw-r--r--packages/backend/src/core/activitypub/type.ts2
3 files changed, 8 insertions, 3 deletions
diff --git a/packages/backend/src/core/activitypub/ApRendererService.ts b/packages/backend/src/core/activitypub/ApRendererService.ts
index b772f3efd5..43e4ddbf32 100644
--- a/packages/backend/src/core/activitypub/ApRendererService.ts
+++ b/packages/backend/src/core/activitypub/ApRendererService.ts
@@ -437,6 +437,7 @@ export class ApRendererService {
},
_misskey_quote: quote,
quoteUrl: quote,
+ quoteUri: quote,
published: note.createdAt.toISOString(),
to,
cc,
@@ -627,6 +628,8 @@ export class ApRendererService {
sensitive: 'as:sensitive',
Hashtag: 'as:Hashtag',
quoteUrl: 'as:quoteUrl',
+ fedibird: 'http://fedibird.com/ns#',
+ quoteUri: 'fedibird:quoteUri',
// Mastodon
toot: 'http://joinmastodon.org/ns#',
Emoji: 'toot:Emoji',
diff --git a/packages/backend/src/core/activitypub/models/ApNoteService.ts b/packages/backend/src/core/activitypub/models/ApNoteService.ts
index dc544a01d6..2612638420 100644
--- a/packages/backend/src/core/activitypub/models/ApNoteService.ts
+++ b/packages/backend/src/core/activitypub/models/ApNoteService.ts
@@ -205,12 +205,12 @@ export class ApNoteService {
// 引用
let quote: MiNote | undefined | null = null;
- if (note._misskey_quote ?? note.quoteUrl) {
+ if (note._misskey_quote ?? note.quoteUrl ?? note.quoteUri) {
const tryResolveNote = async (uri: string): Promise<
| { status: 'ok'; res: MiNote }
| { status: 'permerror' | 'temperror' }
> => {
- if (!/^https?:/.test(uri)) return { status: 'permerror' };
+ if (typeof uri !== 'string' || !/^https?:/.test(uri)) return { status: 'permerror' };
try {
const res = await this.resolveNote(uri);
if (res == null) return { status: 'permerror' };
@@ -222,7 +222,7 @@ export class ApNoteService {
}
};
- const uris = unique([note._misskey_quote, note.quoteUrl].filter((x): x is string => typeof x === 'string'));
+ const uris = unique([note._misskey_quote, note.quoteUrl, note.quoteUri].filter((x): x is string => typeof x === 'string'));
const results = await Promise.all(uris.map(tryResolveNote));
quote = results.filter((x): x is { status: 'ok', res: MiNote } => x.status === 'ok').map(x => x.res).at(0);
diff --git a/packages/backend/src/core/activitypub/type.ts b/packages/backend/src/core/activitypub/type.ts
index 16ff86e894..e819c9900f 100644
--- a/packages/backend/src/core/activitypub/type.ts
+++ b/packages/backend/src/core/activitypub/type.ts
@@ -118,6 +118,7 @@ export interface IPost extends IObject {
_misskey_quote?: string;
_misskey_content?: string;
quoteUrl?: string;
+ quoteUri?: string;
}
export interface IQuestion extends IObject {
@@ -129,6 +130,7 @@ export interface IQuestion extends IObject {
};
_misskey_quote?: string;
quoteUrl?: string;
+ quoteUri?: string;
oneOf?: IQuestionChoice[];
anyOf?: IQuestionChoice[];
endTime?: Date;