diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:51:30 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-21 15:51:30 +0200 |
commit | a24bd1ed41b43790bab6ba789580bb4e85f07d85 (patch) | |
tree | a54b0f6c921ba83a6e909cd0ced325b2d4b8863c /server/lib | |
parent | 5f26f13b3c16ac5ae0a3b0a7142d84a9528cf565 (diff) | |
parent | c63830f15403ac4e750829f27d8bbbdc9a59282c (diff) | |
download | PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.gz PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.tar.zst PeerTube-a24bd1ed41b43790bab6ba789580bb4e85f07d85.zip |
Merge branch 'next' into develop
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/actors/refresh.ts | 2 | ||||
-rw-r--r-- | server/lib/activitypub/crawl.ts | 3 | ||||
-rw-r--r-- | server/lib/activitypub/follow.ts | 17 | ||||
-rw-r--r-- | server/lib/activitypub/playlists/refresh.ts | 2 | ||||
-rw-r--r-- | server/lib/activitypub/videos/refresh.ts | 2 | ||||
-rw-r--r-- | server/lib/client-html.ts | 2 | ||||
-rw-r--r-- | server/lib/job-queue/handlers/activitypub-cleaner.ts | 2 | ||||
-rw-r--r-- | server/lib/moderation.ts | 2 |
8 files changed, 24 insertions, 8 deletions
diff --git a/server/lib/activitypub/actors/refresh.ts b/server/lib/activitypub/actors/refresh.ts index b2fe3932f..0acaa9f62 100644 --- a/server/lib/activitypub/actors/refresh.ts +++ b/server/lib/activitypub/actors/refresh.ts | |||
@@ -4,7 +4,7 @@ import { PeerTubeRequestError } from '@server/helpers/requests' | |||
4 | import { ActorLoadByUrlType } from '@server/lib/model-loaders' | 4 | import { ActorLoadByUrlType } from '@server/lib/model-loaders' |
5 | import { ActorModel } from '@server/models/actor/actor' | 5 | import { ActorModel } from '@server/models/actor/actor' |
6 | import { MActorAccountChannelId, MActorFull } from '@server/types/models' | 6 | import { MActorAccountChannelId, MActorFull } from '@server/types/models' |
7 | import { HttpStatusCode } from '@shared/core-utils' | 7 | import { HttpStatusCode } from '@shared/models' |
8 | import { fetchRemoteActor } from './shared' | 8 | import { fetchRemoteActor } from './shared' |
9 | import { APActorUpdater } from './updater' | 9 | import { APActorUpdater } from './updater' |
10 | import { getUrlFromWebfinger } from './webfinger' | 10 | import { getUrlFromWebfinger } from './webfinger' |
diff --git a/server/lib/activitypub/crawl.ts b/server/lib/activitypub/crawl.ts index cd117f571..28ff5225a 100644 --- a/server/lib/activitypub/crawl.ts +++ b/server/lib/activitypub/crawl.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | import { retryTransactionWrapper } from '@server/helpers/database-utils' | ||
1 | import * as Bluebird from 'bluebird' | 2 | import * as Bluebird from 'bluebird' |
2 | import { URL } from 'url' | 3 | import { URL } from 'url' |
3 | import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub' | 4 | import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub' |
@@ -51,7 +52,7 @@ async function crawlCollectionPage <T> (argUrl: string, handler: HandlerFunction | |||
51 | } | 52 | } |
52 | } | 53 | } |
53 | 54 | ||
54 | if (cleaner) await cleaner(startDate) | 55 | if (cleaner) await retryTransactionWrapper(cleaner, startDate) |
55 | } | 56 | } |
56 | 57 | ||
57 | export { | 58 | export { |
diff --git a/server/lib/activitypub/follow.ts b/server/lib/activitypub/follow.ts index c1bd667e0..741b54df5 100644 --- a/server/lib/activitypub/follow.ts +++ b/server/lib/activitypub/follow.ts | |||
@@ -31,6 +31,21 @@ async function autoFollowBackIfNeeded (actorFollow: MActorFollowActors, transact | |||
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | // If we only have an host, use a default account handle | ||
35 | function getRemoteNameAndHost (handleOrHost: string) { | ||
36 | let name = SERVER_ACTOR_NAME | ||
37 | let host = handleOrHost | ||
38 | |||
39 | const splitted = handleOrHost.split('@') | ||
40 | if (splitted.length === 2) { | ||
41 | name = splitted[0] | ||
42 | host = splitted[1] | ||
43 | } | ||
44 | |||
45 | return { name, host } | ||
46 | } | ||
47 | |||
34 | export { | 48 | export { |
35 | autoFollowBackIfNeeded | 49 | autoFollowBackIfNeeded, |
50 | getRemoteNameAndHost | ||
36 | } | 51 | } |
diff --git a/server/lib/activitypub/playlists/refresh.ts b/server/lib/activitypub/playlists/refresh.ts index ef3cb3fe4..493e8c7ec 100644 --- a/server/lib/activitypub/playlists/refresh.ts +++ b/server/lib/activitypub/playlists/refresh.ts | |||
@@ -2,7 +2,7 @@ import { logger, loggerTagsFactory } from '@server/helpers/logger' | |||
2 | import { PeerTubeRequestError } from '@server/helpers/requests' | 2 | import { PeerTubeRequestError } from '@server/helpers/requests' |
3 | import { JobQueue } from '@server/lib/job-queue' | 3 | import { JobQueue } from '@server/lib/job-queue' |
4 | import { MVideoPlaylist, MVideoPlaylistOwner } from '@server/types/models' | 4 | import { MVideoPlaylist, MVideoPlaylistOwner } from '@server/types/models' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/models' |
6 | import { createOrUpdateVideoPlaylist } from './create-update' | 6 | import { createOrUpdateVideoPlaylist } from './create-update' |
7 | import { fetchRemoteVideoPlaylist } from './shared' | 7 | import { fetchRemoteVideoPlaylist } from './shared' |
8 | 8 | ||
diff --git a/server/lib/activitypub/videos/refresh.ts b/server/lib/activitypub/videos/refresh.ts index a7b82f286..3af08acf4 100644 --- a/server/lib/activitypub/videos/refresh.ts +++ b/server/lib/activitypub/videos/refresh.ts | |||
@@ -4,7 +4,7 @@ import { ActorFollowScoreCache } from '@server/lib/files-cache' | |||
4 | import { VideoLoadByUrlType } from '@server/lib/model-loaders' | 4 | import { VideoLoadByUrlType } from '@server/lib/model-loaders' |
5 | import { VideoModel } from '@server/models/video/video' | 5 | import { VideoModel } from '@server/models/video/video' |
6 | import { MVideoAccountLightBlacklistAllFiles, MVideoThumbnail } from '@server/types/models' | 6 | import { MVideoAccountLightBlacklistAllFiles, MVideoThumbnail } from '@server/types/models' |
7 | import { HttpStatusCode } from '@shared/core-utils' | 7 | import { HttpStatusCode } from '@shared/models' |
8 | import { fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared' | 8 | import { fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared' |
9 | import { APVideoUpdater } from './updater' | 9 | import { APVideoUpdater } from './updater' |
10 | 10 | ||
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 72194416d..c5d39445b 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts | |||
@@ -5,7 +5,7 @@ import validator from 'validator' | |||
5 | import { escapeHTML } from '@shared/core-utils/renderer' | 5 | import { escapeHTML } from '@shared/core-utils/renderer' |
6 | import { HTMLServerConfig } from '@shared/models' | 6 | import { HTMLServerConfig } from '@shared/models' |
7 | import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/core-utils/i18n/i18n' | 7 | import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/core-utils/i18n/i18n' |
8 | import { HttpStatusCode } from '../../shared/core-utils/miscs/http-error-codes' | 8 | import { HttpStatusCode } from '../../shared/models/http/http-error-codes' |
9 | import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos' | 9 | import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos' |
10 | import { isTestInstance, sha256 } from '../helpers/core-utils' | 10 | import { isTestInstance, sha256 } from '../helpers/core-utils' |
11 | import { logger } from '../helpers/logger' | 11 | import { logger } from '../helpers/logger' |
diff --git a/server/lib/job-queue/handlers/activitypub-cleaner.ts b/server/lib/job-queue/handlers/activitypub-cleaner.ts index 1caca1dcc..56e2b0ceb 100644 --- a/server/lib/job-queue/handlers/activitypub-cleaner.ts +++ b/server/lib/job-queue/handlers/activitypub-cleaner.ts | |||
@@ -12,7 +12,7 @@ import { AP_CLEANER_CONCURRENCY } from '@server/initializers/constants' | |||
12 | import { VideoModel } from '@server/models/video/video' | 12 | import { VideoModel } from '@server/models/video/video' |
13 | import { VideoCommentModel } from '@server/models/video/video-comment' | 13 | import { VideoCommentModel } from '@server/models/video/video-comment' |
14 | import { VideoShareModel } from '@server/models/video/video-share' | 14 | import { VideoShareModel } from '@server/models/video/video-share' |
15 | import { HttpStatusCode } from '@shared/core-utils' | 15 | import { HttpStatusCode } from '@shared/models' |
16 | import { logger } from '../../../helpers/logger' | 16 | import { logger } from '../../../helpers/logger' |
17 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' | 17 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' |
18 | 18 | ||
diff --git a/server/lib/moderation.ts b/server/lib/moderation.ts index 14e00518e..a42ab5b7f 100644 --- a/server/lib/moderation.ts +++ b/server/lib/moderation.ts | |||
@@ -23,7 +23,7 @@ import { ActivityCreate } from '../../shared/models/activitypub' | |||
23 | import { VideoObject } from '../../shared/models/activitypub/objects' | 23 | import { VideoObject } from '../../shared/models/activitypub/objects' |
24 | import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object' | 24 | import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object' |
25 | import { LiveVideoCreate, VideoCreate, VideoImportCreate } from '../../shared/models/videos' | 25 | import { LiveVideoCreate, VideoCreate, VideoImportCreate } from '../../shared/models/videos' |
26 | import { VideoCommentCreate } from '../../shared/models/videos/comment/video-comment.model' | 26 | import { VideoCommentCreate } from '../../shared/models/videos/comment' |
27 | import { ActorModel } from '../models/actor/actor' | 27 | import { ActorModel } from '../models/actor/actor' |
28 | import { UserModel } from '../models/user/user' | 28 | import { UserModel } from '../models/user/user' |
29 | import { VideoModel } from '../models/video/video' | 29 | import { VideoModel } from '../models/video/video' |