import cors from 'cors'
import express from 'express'
+import { activityPubCollectionPagination } from '@server/lib/activitypub/collection'
+import { activityPubContextify } from '@server/lib/activitypub/context'
import { getServerActor } from '@server/models/application/application'
import { MAccountId, MActorId, MChannelId, MVideoId } from '@server/types/models'
import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos'
import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
-import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub'
import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers/constants'
import { audiencify, getAudience } from '../../lib/activitypub/audience'
import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send'
// ---------------------------------------------------------------------------
-async function actorFollowing (req: express.Request, actor: MActorId) {
+function actorFollowing (req: express.Request, actor: MActorId) {
const handler = (start: number, count: number) => {
return ActorFollowModel.listAcceptedFollowingUrlsForApi([ actor.id ], undefined, start, count)
}
return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page)
}
-async function actorFollowers (req: express.Request, actor: MActorId) {
+function actorFollowers (req: express.Request, actor: MActorId) {
const handler = (start: number, count: number) => {
return ActorFollowModel.listAcceptedFollowerUrlsForAP([ actor.id ], undefined, start, count)
}
return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page)
}
-async function actorPlaylists (req: express.Request, options: { account: MAccountId } | { channel: MChannelId }) {
+function actorPlaylists (req: express.Request, options: { account: MAccountId } | { channel: MChannelId }) {
const handler = (start: number, count: number) => {
return VideoPlaylistModel.listPublicUrlsOfForAP(options, start, count)
}
import express from 'express'
+import { activityPubCollectionPagination } from '@server/lib/activitypub/collection'
+import { activityPubContextify } from '@server/lib/activitypub/context'
import { MActorLight } from '@server/types/models'
import { Activity } from '../../../shared/models/activitypub/activity'
import { VideoPrivacy } from '../../../shared/models/videos'
-import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub'
import { logger } from '../../helpers/logger'
import { buildAudience } from '../../lib/activitypub/audience'
import { buildAnnounceActivity, buildCreateActivity } from '../../lib/activitypub/send'
--- /dev/null
+import { signJsonLDObject } from '@server/helpers/peertube-crypto'
+import { MActor } from '@server/types/models'
+import { ContextType } from '@shared/models'
+import { activityPubContextify } from './context'
+
+function buildSignedActivity <T> (byActor: MActor, data: T, contextType?: ContextType) {
+ const activity = activityPubContextify(data, contextType)
+
+ return signJsonLDObject(byActor, activity)
+}
+
+function getAPId (object: string | { id: string }) {
+ if (typeof object === 'string') return object
+
+ return object.id
+}
+
+export {
+ buildSignedActivity,
+ getAPId
+}
-
-import { checkUrlsSameHost, getAPId } from '@server/helpers/activitypub'
import { retryTransactionWrapper } from '@server/helpers/database-utils'
import { logger } from '@server/helpers/logger'
import { JobQueue } from '@server/lib/job-queue'
import { ActorLoadByUrlType, loadActorByUrl } from '@server/lib/model-loaders'
import { MActor, MActorAccountChannelId, MActorAccountChannelIdActor, MActorAccountId, MActorFullActor } from '@server/types/models'
import { ActivityPubActor } from '@shared/models'
+import { getAPId } from '../activity'
+import { checkUrlsSameHost } from '../url'
import { refreshActorIfNeeded } from './refresh'
import { APActorCreator, fetchRemoteActor } from './shared'
-
-import { checkUrlsSameHost } from '@server/helpers/activitypub'
import { sanitizeAndCheckActorObject } from '@server/helpers/custom-validators/activitypub/actor'
import { logger } from '@server/helpers/logger'
import { doJSONRequest } from '@server/helpers/requests'
import { ActivityPubActor, ActivityPubOrderedCollection } from '@shared/models'
+import { checkUrlsSameHost } from '../../url'
async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode: number, actorObject: ActivityPubActor }> {
logger.info('Fetching remote actor %s.', actorUrl)
--- /dev/null
+import Bluebird from 'bluebird'
+import validator from 'validator'
+import { pageToStartAndCount } from '@server/helpers/core-utils'
+import { ACTIVITY_PUB } from '@server/initializers/constants'
+import { ResultList } from '@shared/models'
+
+type ActivityPubCollectionPaginationHandler = (start: number, count: number) => Bluebird<ResultList<any>> | Promise<ResultList<any>>
+
+async function activityPubCollectionPagination (
+ baseUrl: string,
+ handler: ActivityPubCollectionPaginationHandler,
+ page?: any,
+ size = ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE
+) {
+ if (!page || !validator.isInt(page)) {
+ // We just display the first page URL, we only need the total items
+ const result = await handler(0, 1)
+
+ return {
+ id: baseUrl,
+ type: 'OrderedCollectionPage',
+ totalItems: result.total,
+ first: result.data.length === 0
+ ? undefined
+ : baseUrl + '?page=1'
+ }
+ }
+
+ const { start, count } = pageToStartAndCount(page, size)
+ const result = await handler(start, count)
+
+ let next: string | undefined
+ let prev: string | undefined
+
+ // Assert page is a number
+ page = parseInt(page, 10)
+
+ // There are more results
+ if (result.total > page * size) {
+ next = baseUrl + '?page=' + (page + 1)
+ }
+
+ if (page > 1) {
+ prev = baseUrl + '?page=' + (page - 1)
+ }
+
+ return {
+ id: baseUrl + '?page=' + page,
+ type: 'OrderedCollectionPage',
+ prev,
+ next,
+ partOf: baseUrl,
+ orderedItems: result.data,
+ totalItems: result.total
+ }
+}
+
+// ---------------------------------------------------------------------------
+
+export {
+ activityPubCollectionPagination
+}
-import Bluebird from 'bluebird'
-import { URL } from 'url'
-import validator from 'validator'
-import { ContextType } from '@shared/models/activitypub/context'
-import { ResultList } from '../../shared/models'
-import { ACTIVITY_PUB, REMOTE_SCHEME } from '../initializers/constants'
-import { MActor, MVideoWithHost } from '../types/models'
-import { pageToStartAndCount } from './core-utils'
-import { signJsonLDObject } from './peertube-crypto'
+import { ContextType } from '@shared/models'
function getContextData (type: ContextType) {
const context: any[] = [
return Object.assign({}, data, getContextData(type))
}
-type ActivityPubCollectionPaginationHandler = (start: number, count: number) => Bluebird<ResultList<any>> | Promise<ResultList<any>>
-async function activityPubCollectionPagination (
- baseUrl: string,
- handler: ActivityPubCollectionPaginationHandler,
- page?: any,
- size = ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE
-) {
- if (!page || !validator.isInt(page)) {
- // We just display the first page URL, we only need the total items
- const result = await handler(0, 1)
-
- return {
- id: baseUrl,
- type: 'OrderedCollectionPage',
- totalItems: result.total,
- first: result.data.length === 0
- ? undefined
- : baseUrl + '?page=1'
- }
- }
-
- const { start, count } = pageToStartAndCount(page, size)
- const result = await handler(start, count)
-
- let next: string | undefined
- let prev: string | undefined
-
- // Assert page is a number
- page = parseInt(page, 10)
-
- // There are more results
- if (result.total > page * size) {
- next = baseUrl + '?page=' + (page + 1)
- }
-
- if (page > 1) {
- prev = baseUrl + '?page=' + (page - 1)
- }
-
- return {
- id: baseUrl + '?page=' + page,
- type: 'OrderedCollectionPage',
- prev,
- next,
- partOf: baseUrl,
- orderedItems: result.data,
- totalItems: result.total
- }
-
-}
-
-function buildSignedActivity <T> (byActor: MActor, data: T, contextType?: ContextType) {
- const activity = activityPubContextify(data, contextType)
-
- return signJsonLDObject(byActor, activity)
-}
-
-function getAPId (object: string | { id: string }) {
- if (typeof object === 'string') return object
-
- return object.id
-}
-
-function checkUrlsSameHost (url1: string, url2: string) {
- const idHost = new URL(url1).host
- const actorHost = new URL(url2).host
-
- return idHost && actorHost && idHost.toLowerCase() === actorHost.toLowerCase()
-}
-
-function buildRemoteVideoBaseUrl (video: MVideoWithHost, path: string, scheme?: string) {
- if (!scheme) scheme = REMOTE_SCHEME.HTTP
-
- const host = video.VideoChannel.Actor.Server.host
-
- return scheme + '://' + host + path
-}
-
-// ---------------------------------------------------------------------------
-
export {
- checkUrlsSameHost,
- getAPId,
- activityPubContextify,
- activityPubCollectionPagination,
- buildSignedActivity,
- buildRemoteVideoBaseUrl
+ getContextData,
+ activityPubContextify
}
import { map } from 'bluebird'
-import { getAPId } from '@server/helpers/activitypub'
import { isArray } from '@server/helpers/custom-validators/misc'
import { logger, loggerTagsFactory } from '@server/helpers/logger'
import { CRAWL_REQUEST_CONCURRENCY } from '@server/initializers/constants'
import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'
import { FilteredModelAttributes } from '@server/types'
import { MThumbnail, MVideoPlaylist, MVideoPlaylistFull, MVideoPlaylistVideosLength } from '@server/types/models'
-import { AttributesOnly } from '@shared/typescript-utils'
import { PlaylistObject } from '@shared/models'
+import { AttributesOnly } from '@shared/typescript-utils'
+import { getAPId } from '../activity'
import { getOrCreateAPActor } from '../actors'
import { crawlCollectionPage } from '../crawl'
import { getOrCreateAPVideo } from '../videos'
-import { getAPId } from '@server/helpers/activitypub'
import { VideoPlaylistModel } from '@server/models/video/video-playlist'
import { MVideoPlaylistFullSummary } from '@server/types/models'
import { APObject } from '@shared/models'
+import { getAPId } from '../activity'
import { createOrUpdateVideoPlaylist } from './create-update'
import { scheduleRefreshIfNeeded } from './refresh'
import { fetchRemoteVideoPlaylist } from './shared'
import { isArray } from 'lodash'
-import { checkUrlsSameHost } from '@server/helpers/activitypub'
import { isPlaylistElementObjectValid, isPlaylistObjectValid } from '@server/helpers/custom-validators/activitypub/playlist'
import { logger, loggerTagsFactory } from '@server/helpers/logger'
import { doJSONRequest } from '@server/helpers/requests'
import { PlaylistElementObject, PlaylistObject } from '@shared/models'
+import { checkUrlsSameHost } from '../../url'
async function fetchRemoteVideoPlaylist (playlistUrl: string): Promise<{ statusCode: number, playlistObject: PlaylistObject }> {
const lTags = loggerTagsFactory('ap', 'video-playlist', playlistUrl)
+import { getAPId } from '@server/lib/activitypub/activity'
import { ActivityAnnounce } from '../../../../shared/models/activitypub'
import { retryTransactionWrapper } from '../../../helpers/database-utils'
+import { logger } from '../../../helpers/logger'
import { sequelizeTypescript } from '../../../initializers/database'
import { VideoShareModel } from '../../../models/video/video-share'
-import { forwardVideoRelatedActivity } from '../send/shared/send-utils'
-import { getOrCreateAPVideo } from '../videos'
-import { Notifier } from '../../notifier'
-import { logger } from '../../../helpers/logger'
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { MActorSignature, MVideoAccountLightBlacklistAllFiles } from '../../../types/models'
-import { getAPId } from '@server/helpers/activitypub'
+import { Notifier } from '../../notifier'
+import { forwardVideoRelatedActivity } from '../send/shared/send-utils'
+import { getOrCreateAPVideo } from '../videos'
async function processAnnounceActivity (options: APProcessorOptions<ActivityAnnounce>) {
const { activity, byActor: actorAnnouncer } = options
import { VideoCommentModel } from '@server/models/video/video-comment'
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
import { AbuseObject, AbuseState, ActivityCreate, ActivityFlag } from '@shared/models'
-import { getAPId } from '../../../helpers/activitypub'
import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger'
import { sequelizeTypescript } from '../../../initializers/database'
+import { getAPId } from '../../../lib/activitypub/activity'
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { MAccountDefault, MActorSignature, MCommentOwnerVideo } from '../../../types/models'
import { getServerActor } from '@server/models/application/application'
import { ActivityFollow } from '../../../../shared/models/activitypub'
-import { getAPId } from '../../../helpers/activitypub'
import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger'
import { CONFIG } from '../../../initializers/config'
import { sequelizeTypescript } from '../../../initializers/database'
+import { getAPId } from '../../../lib/activitypub/activity'
import { ActorModel } from '../../../models/actor/actor'
import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { VideoModel } from '@server/models/video/video'
import { ActivityLike } from '../../../../shared/models/activitypub'
-import { getAPId } from '../../../helpers/activitypub'
import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { sequelizeTypescript } from '../../../initializers/database'
+import { getAPId } from '../../../lib/activitypub/activity'
import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { MActorSignature } from '../../../types/models'
import { StatsManager } from '@server/lib/stat-manager'
import { Activity, ActivityType } from '../../../../shared/models/activitypub'
-import { checkUrlsSameHost, getAPId } from '../../../helpers/activitypub'
import { logger } from '../../../helpers/logger'
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { MActorDefault, MActorSignature } from '../../../types/models'
+import { getAPId } from '../activity'
import { getOrCreateAPActor } from '../actors'
+import { checkUrlsSameHost } from '../url'
import { processAcceptActivity } from './process-accept'
import { processAnnounceActivity } from './process-announce'
import { processCreateActivity } from './process-create'
import { map } from 'bluebird'
import { Transaction } from 'sequelize'
import { getServerActor } from '@server/models/application/application'
-import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub'
import { logger, loggerTagsFactory } from '../../helpers/logger'
import { doJSONRequest } from '../../helpers/requests'
import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants'
import { VideoShareModel } from '../../models/video/video-share'
import { MChannelActorLight, MVideo, MVideoAccountLight, MVideoId } from '../../types/models/video'
+import { getAPId } from './activity'
import { getOrCreateAPActor } from './actors'
import { sendUndoAnnounce, sendVideoAnnounce } from './send'
-import { getLocalVideoAnnounceActivityPubUrl } from './url'
+import { checkUrlsSameHost, getLocalVideoAnnounceActivityPubUrl } from './url'
const lTags = loggerTagsFactory('share')
-import { WEBSERVER } from '../../initializers/constants'
+import { REMOTE_SCHEME, WEBSERVER } from '../../initializers/constants'
import {
MAbuseFull,
MAbuseId,
MVideoId,
MVideoPlaylistElement,
MVideoUrl,
- MVideoUUID
+ MVideoUUID,
+ MVideoWithHost
} from '../../types/models'
import { MVideoFileVideoUUID } from '../../types/models/video/video-file'
import { MVideoPlaylist, MVideoPlaylistUUID } from '../../types/models/video/video-playlist'
abuse.FlaggedAccount.Actor.url
}
+// ---------------------------------------------------------------------------
+
+function buildRemoteVideoBaseUrl (video: MVideoWithHost, path: string, scheme?: string) {
+ if (!scheme) scheme = REMOTE_SCHEME.HTTP
+
+ const host = video.VideoChannel.Actor.Server.host
+
+ return scheme + '://' + host + path
+}
+
+// ---------------------------------------------------------------------------
+
+function checkUrlsSameHost (url1: string, url2: string) {
+ const idHost = new URL(url1).host
+ const actorHost = new URL(url2).host
+
+ return idHost && actorHost && idHost.toLowerCase() === actorHost.toLowerCase()
+}
+
+// ---------------------------------------------------------------------------
+
export {
getLocalVideoActivityPubUrl,
getLocalVideoPlaylistActivityPubUrl,
getLocalVideoCommentsActivityPubUrl,
getLocalVideoLikesActivityPubUrl,
getLocalVideoDislikesActivityPubUrl,
- getAbuseTargetUrl
+
+ getAbuseTargetUrl,
+ checkUrlsSameHost,
+ buildRemoteVideoBaseUrl
}
import { map } from 'bluebird'
-import { checkUrlsSameHost } from '../../helpers/activitypub'
import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments'
import { logger } from '../../helpers/logger'
import { doJSONRequest } from '../../helpers/requests'
import { VideoCommentModel } from '../../models/video/video-comment'
import { MCommentOwner, MCommentOwnerVideo, MVideoAccountLightBlacklistAllFiles } from '../../types/models/video'
import { getOrCreateAPActor } from './actors'
+import { checkUrlsSameHost } from './url'
import { getOrCreateAPVideo } from './videos'
type ResolveThreadParams = {
-import { getAPId } from '@server/helpers/activitypub'
import { retryTransactionWrapper } from '@server/helpers/database-utils'
import { JobQueue } from '@server/lib/job-queue'
import { loadVideoByUrl, VideoLoadByUrlType } from '@server/lib/model-loaders'
import { MVideoAccountLightBlacklistAllFiles, MVideoImmutable, MVideoThumbnail } from '@server/types/models'
import { APObject } from '@shared/models'
+import { getAPId } from '../activity'
import { refreshVideoIfNeeded } from './refresh'
import { APVideoCreator, fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared'
import { Transaction } from 'sequelize/types'
-import { checkUrlsSameHost } from '@server/helpers/activitypub'
import { deleteAllModels, filterNonExistingModels } from '@server/helpers/database-utils'
import { logger, LoggerTagsFn } from '@server/helpers/logger'
import { updatePlaceholderThumbnail, updateVideoMiniatureFromUrl } from '@server/lib/thumbnail'
import { MStreamingPlaylistFilesVideo, MThumbnail, MVideoCaption, MVideoFile, MVideoFullLight, MVideoThumbnail } from '@server/types/models'
import { ActivityTagObject, ThumbnailType, VideoObject, VideoStreamingPlaylistType } from '@shared/models'
import { getOrCreateAPActor } from '../../actors'
+import { checkUrlsSameHost } from '../../url'
import {
getCaptionAttributesFromObject,
getFileAttributesFromUrl,
import { Transaction } from 'sequelize/types'
-import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub'
import { isAPVideoTrackerUrlObject } from '@server/helpers/custom-validators/activitypub/videos'
import { isArray } from '@server/helpers/custom-validators/misc'
import { REMOTE_SCHEME } from '@server/initializers/constants'
import { TrackerModel } from '@server/models/server/tracker'
import { MVideo, MVideoWithHost } from '@server/types/models'
import { ActivityTrackerUrlObject, VideoObject } from '@shared/models'
+import { buildRemoteVideoBaseUrl } from '../../url'
function getTrackerUrls (object: VideoObject, video: MVideoWithHost) {
let wsFound = false
-import { checkUrlsSameHost } from '@server/helpers/activitypub'
import { sanitizeAndCheckVideoTorrentObject } from '@server/helpers/custom-validators/activitypub/videos'
import { logger, loggerTagsFactory } from '@server/helpers/logger'
import { doJSONRequest } from '@server/helpers/requests'
import { VideoObject } from '@shared/models'
+import { checkUrlsSameHost } from '../../url'
const lTags = loggerTagsFactory('ap', 'video')
import { map } from 'bluebird'
import { Job } from 'bull'
-import { checkUrlsSameHost } from '@server/helpers/activitypub'
import {
isAnnounceActivityValid,
isDislikeActivityValid,
import { sanitizeAndCheckVideoCommentObject } from '@server/helpers/custom-validators/activitypub/video-comments'
import { doJSONRequest, PeerTubeRequestError } from '@server/helpers/requests'
import { AP_CLEANER } from '@server/initializers/constants'
+import { checkUrlsSameHost } from '@server/lib/activitypub/url'
import { Redis } from '@server/lib/redis'
import { VideoModel } from '@server/models/video/video'
import { VideoCommentModel } from '@server/models/video/video-comment'
import { buildDigest } from '@server/helpers/peertube-crypto'
+import { buildSignedActivity } from '@server/lib/activitypub/activity'
import { getServerActor } from '@server/models/application/application'
import { ContextType } from '@shared/models/activitypub/context'
-import { buildSignedActivity } from '../../../../helpers/activitypub'
import { ACTIVITY_PUB, HTTP_SIGNATURE } from '../../../../initializers/constants'
import { ActorModel } from '../../../../models/actor/actor'
import { MActor } from '../../../../types/models'
import { NextFunction, Request, Response } from 'express'
-import { getAPId } from '@server/helpers/activitypub'
import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor'
+import { getAPId } from '@server/lib/activitypub/activity'
import { ActivityDelete, ActivityPubSignature, HttpStatusCode } from '@shared/models'
import { logger } from '../helpers/logger'
import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto'
Table,
UpdatedAt
} from 'sequelize-typescript'
+import { activityPubContextify } from '@server/lib/activitypub/context'
import { getBiggestActorImage } from '@server/lib/actor-image'
import { ModelCache } from '@server/models/model-cache'
import { getLowercaseExtension } from '@shared/core-utils'
import { ActivityIconObject, ActivityPubActorType, ActorImageType } from '@shared/models'
import { AttributesOnly } from '@shared/typescript-utils'
-import { activityPubContextify } from '../../helpers/activitypub'
import {
isActorFollowersCountValid,
isActorFollowingCountValid,
UpdatedAt
} from 'sequelize-typescript'
import validator from 'validator'
-import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub'
import { logger } from '@server/helpers/logger'
import { extractVideo } from '@server/helpers/video'
+import { buildRemoteVideoBaseUrl } from '@server/lib/activitypub/url'
import { getHLSPublicFileUrl, getWebTorrentPublicFileUrl } from '@server/lib/object-storage'
import { getFSTorrentFilePath } from '@server/lib/paths'
import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoWithHost } from '@server/types/models'
Table,
UpdatedAt
} from 'sequelize-typescript'
+import { activityPubCollectionPagination } from '@server/lib/activitypub/collection'
import { MAccountId, MChannelId } from '@server/types/models'
import { buildPlaylistEmbedPath, buildPlaylistWatchPath, pick } from '@shared/core-utils'
import { buildUUID, uuidToShort } from '@shared/extra-utils'
import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
import { VideoPlaylistType } from '../../../shared/models/videos/playlist/video-playlist-type.model'
import { VideoPlaylist } from '../../../shared/models/videos/playlist/video-playlist.model'
-import { activityPubCollectionPagination } from '../../helpers/activitypub'
import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
import {
isVideoPlaylistDescriptionValid,
import { cloneDeep } from 'lodash'
import { buildRequestStub } from '@server/tests/shared'
import { buildAbsoluteFixturePath } from '@shared/core-utils'
-import { buildSignedActivity } from '../../../helpers/activitypub'
import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../../../helpers/peertube-crypto'
+import { buildSignedActivity } from '../../../lib/activitypub/activity'
describe('Test activity pub helpers', function () {
describe('When checking the Linked Signature', function () {
import 'mocha'
import * as chai from 'chai'
-import { activityPubContextify, buildSignedActivity } from '@server/helpers/activitypub'
import { buildDigest } from '@server/helpers/peertube-crypto'
import { HTTP_SIGNATURE } from '@server/initializers/constants'
+import { buildSignedActivity } from '@server/lib/activitypub/activity'
+import { activityPubContextify } from '@server/lib/activitypub/context'
import { buildGlobalHeaders } from '@server/lib/job-queue/handlers/utils/activitypub-http-utils'
import { makeFollowRequest, makePOSTAPRequest } from '@server/tests/shared'
import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'
-import { activityPubContextify } from '@server/helpers/activitypub'
import { buildDigest } from '@server/helpers/peertube-crypto'
import { doRequest } from '@server/helpers/requests'
import { ACTIVITY_PUB, HTTP_SIGNATURE } from '@server/initializers/constants'
+import { activityPubContextify } from '@server/lib/activitypub/context'
export function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) {
const options = {