]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/lib/activitypub/activity.ts
Merge branch 'release/4.2.0' into develop
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / activity.ts
CommitLineData
7e98a7df
C
1function getAPId (object: string | { id: string }) {
2 if (typeof object === 'string') return object
3
4 return object.id
5}
6
b2111066
C
7function getActivityStreamDuration (duration: number) {
8 // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration
9 return 'PT' + duration + 'S'
10}
11
12function getDurationFromActivityStream (duration: string) {
13 return parseInt(duration.replace(/[^\d]+/, ''))
14}
15
7e98a7df 16export {
b2111066
C
17 getAPId,
18 getActivityStreamDuration,
19 getDurationFromActivityStream
7e98a7df 20}