From de94ac86a211dec657332d964693857ec235ce40 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 20 Nov 2020 11:21:08 +0100 Subject: Fix incorrect IDs in AP federation --- server/controllers/api/videos/import.ts | 4 ++-- server/controllers/api/videos/index.ts | 4 ++-- server/controllers/api/videos/live.ts | 4 ++-- server/controllers/api/videos/rate.ts | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'server/controllers/api/videos') diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index 5840cd063..bc5fea7aa 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts @@ -28,7 +28,7 @@ import { getYoutubeDLInfo, getYoutubeDLSubs, YoutubeDLInfo } from '../../../help import { CONFIG } from '../../../initializers/config' import { MIMETYPES } from '../../../initializers/constants' import { sequelizeTypescript } from '../../../initializers/database' -import { getVideoActivityPubUrl } from '../../../lib/activitypub/url' +import { getLocalVideoActivityPubUrl } from '../../../lib/activitypub/url' import { JobQueue } from '../../../lib/job-queue/job-queue' import { createVideoMiniatureFromExisting, createVideoMiniatureFromUrl } from '../../../lib/thumbnail' import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist' @@ -250,7 +250,7 @@ function buildVideo (channelId: number, body: VideoImportCreate, importData: You originallyPublishedAt: body.originallyPublishedAt || importData.originallyPublishedAt } const video = new VideoModel(videoData) - video.url = getVideoActivityPubUrl(video) + video.url = getLocalVideoActivityPubUrl(video) return video } diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index bfebc54ed..b5ff2e72e 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts @@ -5,7 +5,7 @@ import toInt from 'validator/lib/toInt' import { addOptimizeOrMergeAudioJob } from '@server/helpers/video' import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' import { changeVideoChannelShare } from '@server/lib/activitypub/share' -import { getVideoActivityPubUrl } from '@server/lib/activitypub/url' +import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' import { LiveManager } from '@server/lib/live-manager' import { buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' import { getVideoFilePath } from '@server/lib/video-paths' @@ -189,7 +189,7 @@ async function addVideo (req: express.Request, res: express.Response) { videoData.duration = videoPhysicalFile['duration'] // duration was added by a previous middleware const video = new VideoModel(videoData) as MVideoFullLight - video.url = getVideoActivityPubUrl(video) // We use the UUID, so set the URL after building the object + video.url = getLocalVideoActivityPubUrl(video) // We use the UUID, so set the URL after building the object const videoFile = new VideoFileModel({ extname: extname(videoPhysicalFile.filename), diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts index d438b6f3a..a6f00c1bd 100644 --- a/server/controllers/api/videos/live.ts +++ b/server/controllers/api/videos/live.ts @@ -3,7 +3,7 @@ import { v4 as uuidv4 } from 'uuid' import { createReqFiles } from '@server/helpers/express-utils' import { CONFIG } from '@server/initializers/config' import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' -import { getVideoActivityPubUrl } from '@server/lib/activitypub/url' +import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' import { federateVideoIfNeeded } from '@server/lib/activitypub/videos' import { Hooks } from '@server/lib/plugins/hooks' import { buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' @@ -86,7 +86,7 @@ async function addLiveVideo (req: express.Request, res: express.Response) { videoData.duration = 0 const video = new VideoModel(videoData) as MVideoDetails - video.url = getVideoActivityPubUrl(video) // We use the UUID, so set the URL after building the object + video.url = getLocalVideoActivityPubUrl(video) // We use the UUID, so set the URL after building the object const videoLive = new VideoLiveModel() videoLive.saveReplay = videoInfo.saveReplay || false diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts index 3ee365289..df1eddb4f 100644 --- a/server/controllers/api/videos/rate.ts +++ b/server/controllers/api/videos/rate.ts @@ -2,7 +2,7 @@ import * as express from 'express' import { UserVideoRateUpdate } from '../../../../shared' import { logger } from '../../../helpers/logger' import { VIDEO_RATE_TYPES } from '../../../initializers/constants' -import { getRateUrl, sendVideoRateChange } from '../../../lib/activitypub/video-rates' +import { getLocalRateUrl, sendVideoRateChange } from '../../../lib/activitypub/video-rates' import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares' import { AccountModel } from '../../../models/account/account' import { AccountVideoRateModel } from '../../../models/account/account-video-rate' @@ -52,7 +52,7 @@ async function rateVideo (req: express.Request, res: express.Response) { await previousRate.destroy(sequelizeOptions) } else { // Update previous rate previousRate.type = rateType - previousRate.url = getRateUrl(rateType, userAccount.Actor, videoInstance) + previousRate.url = getLocalRateUrl(rateType, userAccount.Actor, videoInstance) await previousRate.save(sequelizeOptions) } } else if (rateType !== 'none') { // There was not a previous rate, insert a new one if there is a rate @@ -60,7 +60,7 @@ async function rateVideo (req: express.Request, res: express.Response) { accountId: accountInstance.id, videoId: videoInstance.id, type: rateType, - url: getRateUrl(rateType, userAccount.Actor, videoInstance) + url: getLocalRateUrl(rateType, userAccount.Actor, videoInstance) } await AccountVideoRateModel.create(query, sequelizeOptions) -- cgit v1.2.3