diff options
Diffstat (limited to 'server/lib/activitypub/activity.ts')
-rw-r--r-- | server/lib/activitypub/activity.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/server/lib/activitypub/activity.ts b/server/lib/activitypub/activity.ts index cccb7b1c1..e6cec1ba7 100644 --- a/server/lib/activitypub/activity.ts +++ b/server/lib/activitypub/activity.ts | |||
@@ -4,6 +4,17 @@ function getAPId (object: string | { id: string }) { | |||
4 | return object.id | 4 | return object.id |
5 | } | 5 | } |
6 | 6 | ||
7 | function getActivityStreamDuration (duration: number) { | ||
8 | // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration | ||
9 | return 'PT' + duration + 'S' | ||
10 | } | ||
11 | |||
12 | function getDurationFromActivityStream (duration: string) { | ||
13 | return parseInt(duration.replace(/[^\d]+/, '')) | ||
14 | } | ||
15 | |||
7 | export { | 16 | export { |
8 | getAPId | 17 | getAPId, |
18 | getActivityStreamDuration, | ||
19 | getDurationFromActivityStream | ||
9 | } | 20 | } |