VIDEO_PRIVACIES
} from '../../../initializers'
import { fetchRemoteVideoDescription, getVideoActivityPubUrl, shareVideoByServerAndChannel } from '../../../lib/activitypub'
-import { sendCreateVideo, sendCreateViewToOrigin, sendCreateViewToVideoFollowers, sendUpdateVideo } from '../../../lib/activitypub/send'
+import { sendCreateVideo, sendCreateView, sendUpdateVideo } from '../../../lib/activitypub/send'
import { JobQueue } from '../../../lib/job-queue'
import { Redis } from '../../../lib/redis'
import {
async function viewVideo (req: express.Request, res: express.Response) {
const videoInstance = res.locals.video
- const ip = req.ip
+ const ip = req.headers['x-real-ip'] as string || req.ip
const exists = await Redis.Instance.isViewExists(ip, videoInstance.uuid)
if (exists) {
logger.debug('View for ip %s and video %s already exists.', ip, videoInstance.uuid)
const serverAccount = await getServerActor()
- if (videoInstance.isOwned()) {
- await sendCreateViewToVideoFollowers(serverAccount, videoInstance, undefined)
- } else {
- await sendCreateViewToOrigin(serverAccount, videoInstance, undefined)
- }
+ await sendCreateView(serverAccount, videoInstance, undefined)
return res.status(204).end()
}