summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-06-06 17:24:03 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-06-09 11:03:02 -0400
commitb2c72da96c35e630f14f311e13564487d87a1d5c (patch)
tree0c40255e069f255a44a2ec98fa2d1262b885c903
parentaccept fep-044f "quote" in objects (diff)
downloadsharkey-b2c72da96c35e630f14f311e13564487d87a1d5c.tar.gz
sharkey-b2c72da96c35e630f14f311e13564487d87a1d5c.tar.bz2
sharkey-b2c72da96c35e630f14f311e13564487d87a1d5c.zip
pull out ILink interface
-rw-r--r--packages/backend/src/core/activitypub/type.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/backend/src/core/activitypub/type.ts b/packages/backend/src/core/activitypub/type.ts
index cdf4a65baa..554420d670 100644
--- a/packages/backend/src/core/activitypub/type.ts
+++ b/packages/backend/src/core/activitypub/type.ts
@@ -35,6 +35,7 @@ export interface IObject {
mediaType?: string;
url?: ApObject | string;
href?: string;
+ rel?: string | string[];
tag?: IObject | IObject[];
sensitive?: boolean;
}
@@ -55,6 +56,16 @@ export function isAnonymousObject(object: IObject): object is IAnonymousObject {
return object.id === undefined;
}
+export interface ILink extends IObject {
+ '@context'?: string | string[] | Obj | Obj[];
+ type: 'Link' | 'Mention';
+ href: string;
+}
+
+export const isLink = (object: IObject): object is ILink =>
+ (getApType(object) === 'Link' || getApType(object) === 'Link') &&
+ typeof object.href === 'string';
+
/**
* Get array of ActivityStreams Objects id
*/
@@ -307,9 +318,8 @@ export const isPropertyValue = (object: IObject): object is IApPropertyValue =>
'value' in object &&
typeof object.value === 'string';
-export interface IApMention extends IObject {
+export interface IApMention extends ILink {
type: 'Mention';
- href: string;
name: string;
}