aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-27 14:32:44 +0200
committerChocobozzz <me@florianbigard.com>2021-08-27 15:12:22 +0200
commit41fb13c330de629df2d23379209e79c7af0f2e9a (patch)
tree73bc5a90566406b3910f142beae2a879c1e4265d /server/lib/activitypub
parent40e7ed0714f96c01e16de3ac971a4b28116294e1 (diff)
downloadPeerTube-41fb13c330de629df2d23379209e79c7af0f2e9a.tar.gz
PeerTube-41fb13c330de629df2d23379209e79c7af0f2e9a.tar.zst
PeerTube-41fb13c330de629df2d23379209e79c7af0f2e9a.zip
esModuleInterop to true
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r--server/lib/activitypub/actors/webfinger.ts2
-rw-r--r--server/lib/activitypub/crawl.ts6
-rw-r--r--server/lib/activitypub/playlists/create-update.ts6
-rw-r--r--server/lib/activitypub/share.ts4
-rw-r--r--server/lib/activitypub/video-comments.ts4
-rw-r--r--server/lib/activitypub/video-rates.ts4
-rw-r--r--server/lib/activitypub/videos/shared/object-to-model-attributes.ts2
7 files changed, 14 insertions, 14 deletions
diff --git a/server/lib/activitypub/actors/webfinger.ts b/server/lib/activitypub/actors/webfinger.ts
index 1c7ec4717..5532f05bd 100644
--- a/server/lib/activitypub/actors/webfinger.ts
+++ b/server/lib/activitypub/actors/webfinger.ts
@@ -1,4 +1,4 @@
1import * as WebFinger from 'webfinger.js' 1import WebFinger from 'webfinger.js'
2import { isProdInstance } from '@server/helpers/core-utils' 2import { isProdInstance } from '@server/helpers/core-utils'
3import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc' 3import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc'
4import { REQUEST_TIMEOUT, WEBSERVER } from '@server/initializers/constants' 4import { REQUEST_TIMEOUT, WEBSERVER } from '@server/initializers/constants'
diff --git a/server/lib/activitypub/crawl.ts b/server/lib/activitypub/crawl.ts
index 28ff5225a..336129b82 100644
--- a/server/lib/activitypub/crawl.ts
+++ b/server/lib/activitypub/crawl.ts
@@ -1,13 +1,13 @@
1import { retryTransactionWrapper } from '@server/helpers/database-utils' 1import Bluebird from 'bluebird'
2import * as Bluebird from 'bluebird'
3import { URL } from 'url' 2import { URL } from 'url'
3import { retryTransactionWrapper } from '@server/helpers/database-utils'
4import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub' 4import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub'
5import { logger } from '../../helpers/logger' 5import { logger } from '../../helpers/logger'
6import { doJSONRequest } from '../../helpers/requests' 6import { doJSONRequest } from '../../helpers/requests'
7import { ACTIVITY_PUB, WEBSERVER } from '../../initializers/constants' 7import { ACTIVITY_PUB, WEBSERVER } from '../../initializers/constants'
8 8
9type HandlerFunction<T> = (items: T[]) => (Promise<any> | Bluebird<any>) 9type HandlerFunction<T> = (items: T[]) => (Promise<any> | Bluebird<any>)
10type CleanerFunction = (startedDate: Date) => (Promise<any> | Bluebird<any>) 10type CleanerFunction = (startedDate: Date) => Promise<any>
11 11
12async function crawlCollectionPage <T> (argUrl: string, handler: HandlerFunction<T>, cleaner?: CleanerFunction) { 12async function crawlCollectionPage <T> (argUrl: string, handler: HandlerFunction<T>, cleaner?: CleanerFunction) {
13 let url = argUrl 13 let url = argUrl
diff --git a/server/lib/activitypub/playlists/create-update.ts b/server/lib/activitypub/playlists/create-update.ts
index ea3e61ac5..b152d709c 100644
--- a/server/lib/activitypub/playlists/create-update.ts
+++ b/server/lib/activitypub/playlists/create-update.ts
@@ -1,4 +1,4 @@
1import * as Bluebird from 'bluebird' 1import { map } from 'bluebird'
2import { getAPId } from '@server/helpers/activitypub' 2import { getAPId } from '@server/helpers/activitypub'
3import { isArray } from '@server/helpers/custom-validators/misc' 3import { isArray } from '@server/helpers/custom-validators/misc'
4import { logger, loggerTagsFactory } from '@server/helpers/logger' 4import { logger, loggerTagsFactory } from '@server/helpers/logger'
@@ -24,7 +24,7 @@ import {
24const lTags = loggerTagsFactory('ap', 'video-playlist') 24const lTags = loggerTagsFactory('ap', 'video-playlist')
25 25
26async function createAccountPlaylists (playlistUrls: string[]) { 26async function createAccountPlaylists (playlistUrls: string[]) {
27 await Bluebird.map(playlistUrls, async playlistUrl => { 27 await map(playlistUrls, async playlistUrl => {
28 try { 28 try {
29 const exists = await VideoPlaylistModel.doesPlaylistExist(playlistUrl) 29 const exists = await VideoPlaylistModel.doesPlaylistExist(playlistUrl)
30 if (exists === true) return 30 if (exists === true) return
@@ -140,7 +140,7 @@ async function rebuildVideoPlaylistElements (elementUrls: string[], playlist: MV
140async function buildElementsDBAttributes (elementUrls: string[], playlist: MVideoPlaylist) { 140async function buildElementsDBAttributes (elementUrls: string[], playlist: MVideoPlaylist) {
141 const elementsToCreate: FilteredModelAttributes<VideoPlaylistElementModel>[] = [] 141 const elementsToCreate: FilteredModelAttributes<VideoPlaylistElementModel>[] = []
142 142
143 await Bluebird.map(elementUrls, async elementUrl => { 143 await map(elementUrls, async elementUrl => {
144 try { 144 try {
145 const { elementObject } = await fetchRemotePlaylistElement(elementUrl) 145 const { elementObject } = await fetchRemotePlaylistElement(elementUrl)
146 146
diff --git a/server/lib/activitypub/share.ts b/server/lib/activitypub/share.ts
index 1ff01a175..b18761174 100644
--- a/server/lib/activitypub/share.ts
+++ b/server/lib/activitypub/share.ts
@@ -1,4 +1,4 @@
1import * as Bluebird from 'bluebird' 1import { map } from 'bluebird'
2import { Transaction } from 'sequelize' 2import { Transaction } from 'sequelize'
3import { getServerActor } from '@server/models/application/application' 3import { getServerActor } from '@server/models/application/application'
4import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub' 4import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub'
@@ -38,7 +38,7 @@ async function changeVideoChannelShare (
38} 38}
39 39
40async function addVideoShares (shareUrls: string[], video: MVideoId) { 40async function addVideoShares (shareUrls: string[], video: MVideoId) {
41 await Bluebird.map(shareUrls, async shareUrl => { 41 await map(shareUrls, async shareUrl => {
42 try { 42 try {
43 await addVideoShare(shareUrl, video) 43 await addVideoShare(shareUrl, video)
44 } catch (err) { 44 } catch (err) {
diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts
index 6b7f9504f..2a14790fe 100644
--- a/server/lib/activitypub/video-comments.ts
+++ b/server/lib/activitypub/video-comments.ts
@@ -1,4 +1,4 @@
1import * as Bluebird from 'bluebird' 1import { map } from 'bluebird'
2import { checkUrlsSameHost } from '../../helpers/activitypub' 2import { checkUrlsSameHost } from '../../helpers/activitypub'
3import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments' 3import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments'
4import { logger } from '../../helpers/logger' 4import { logger } from '../../helpers/logger'
@@ -18,7 +18,7 @@ type ResolveThreadParams = {
18type ResolveThreadResult = Promise<{ video: MVideoAccountLightBlacklistAllFiles, comment: MCommentOwnerVideo, commentCreated: boolean }> 18type ResolveThreadResult = Promise<{ video: MVideoAccountLightBlacklistAllFiles, comment: MCommentOwnerVideo, commentCreated: boolean }>
19 19
20async function addVideoComments (commentUrls: string[]) { 20async function addVideoComments (commentUrls: string[]) {
21 return Bluebird.map(commentUrls, async commentUrl => { 21 return map(commentUrls, async commentUrl => {
22 try { 22 try {
23 await resolveThread({ url: commentUrl, isVideo: false }) 23 await resolveThread({ url: commentUrl, isVideo: false })
24 } catch (err) { 24 } catch (err) {
diff --git a/server/lib/activitypub/video-rates.ts b/server/lib/activitypub/video-rates.ts
index 9fb97ef84..04aa5eae9 100644
--- a/server/lib/activitypub/video-rates.ts
+++ b/server/lib/activitypub/video-rates.ts
@@ -1,4 +1,4 @@
1import * as Bluebird from 'bluebird' 1import { map } from 'bluebird'
2import { Transaction } from 'sequelize' 2import { Transaction } from 'sequelize'
3import { doJSONRequest } from '@server/helpers/requests' 3import { doJSONRequest } from '@server/helpers/requests'
4import { VideoRateType } from '../../../shared/models/videos' 4import { VideoRateType } from '../../../shared/models/videos'
@@ -15,7 +15,7 @@ import { getVideoDislikeActivityPubUrlByLocalActor, getVideoLikeActivityPubUrlBy
15const lTags = loggerTagsFactory('ap', 'video-rate', 'create') 15const lTags = loggerTagsFactory('ap', 'video-rate', 'create')
16 16
17async function createRates (ratesUrl: string[], video: MVideo, rate: VideoRateType) { 17async function createRates (ratesUrl: string[], video: MVideo, rate: VideoRateType) {
18 await Bluebird.map(ratesUrl, async rateUrl => { 18 await map(ratesUrl, async rateUrl => {
19 try { 19 try {
20 await createRate(rateUrl, video, rate) 20 await createRate(rateUrl, video, rate)
21 } catch (err) { 21 } catch (err) {
diff --git a/server/lib/activitypub/videos/shared/object-to-model-attributes.ts b/server/lib/activitypub/videos/shared/object-to-model-attributes.ts
index bd9ed45a9..62354ab56 100644
--- a/server/lib/activitypub/videos/shared/object-to-model-attributes.ts
+++ b/server/lib/activitypub/videos/shared/object-to-model-attributes.ts
@@ -1,5 +1,5 @@
1import { maxBy, minBy } from 'lodash' 1import { maxBy, minBy } from 'lodash'
2import * as magnetUtil from 'magnet-uri' 2import magnetUtil from 'magnet-uri'
3import { basename } from 'path' 3import { basename } from 'path'
4import { isAPVideoFileUrlMetadataObject } from '@server/helpers/custom-validators/activitypub/videos' 4import { isAPVideoFileUrlMetadataObject } from '@server/helpers/custom-validators/activitypub/videos'
5import { isVideoFileInfoHashValid } from '@server/helpers/custom-validators/videos' 5import { isVideoFileInfoHashValid } from '@server/helpers/custom-validators/videos'