ActivityPub-federated video streaming platform using P2P directly in your web browser
Allow embed to be displayed on instance
Chocobozzz636bee55e1e2
diff --git a/packages/tests/src/api/videos/video-embed-privacy.ts b/packages/tests/src/api/videos/video-embed-privacy.tsindex 2927002b11..c01e8445ec 100644--- a/packages/tests/src/api/videos/video-embed-privacy.ts+++ b/packages/tests/src/api/videos/video-embed-privacy.ts@@ -106,6 +106,19 @@ describe('Test video embed privacy', function () {}})+ it('Should check if embed is allowed on origin instance', async function () {+ {+ const result = await servers[0].videoEmbedPrivacy.isDomainAllowed({ videoId, domain: servers[0].host })+ expect(result).to.deep.equal({ domainAllowed: true, userBypassAllowed: null })+ }++ {+ // Port is missing+ const result = await servers[0].videoEmbedPrivacy.isDomainAllowed({ videoId, domain: servers[0].hostname, token: null })+ expect(result).to.deep.equal({ domainAllowed: false, userBypassAllowed: false })+ }+ })+it('Should add some domains to video embed privacy', async function () {await servers[0].videoEmbedPrivacy.update({videoId,diff --git a/server/core/controllers/api/videos/embed-privacy.ts b/server/core/controllers/api/videos/embed-privacy.tsindex f327294ab5..6fddde722b 100644--- a/server/core/controllers/api/videos/embed-privacy.ts+++ b/server/core/controllers/api/videos/embed-privacy.ts@@ -9,7 +9,7 @@ import {} from '@peertube/peertube-models'import { getAuthUser } from '@server/helpers/express-utils.js'import { logger, loggerTagsFactory } from '@server/helpers/logger.js'-import { VIDEO_EMBED_PRIVACY_POLICIES } from '@server/initializers/constants.js'+import { VIDEO_EMBED_PRIVACY_POLICIES, WEBSERVER } from '@server/initializers/constants.js'import { federateVideoIfNeeded } from '@server/lib/activitypub/videos/index.js'import { checkCanManageVideo } from '@server/middlewares/validators/shared/videos.js'import { VideoChannelActivityModel } from '@server/models/video/video-channel-activity.js'@@ -74,8 +74,9 @@ async function getVideoEmbedPrivacy (req: express.Request, res: express.Responseasync function isVideoEmbedOnDomainAllowed (req: express.Request, res: express.Response) {const video = res.locals.videoWithBlacklist+ const isOnInstance = req.query.domain === WEBSERVER.HOST- const domainAllowed = video.embedPrivacyPolicy === VideoEmbedPrivacyPolicy.ALL_ALLOWED+ const domainAllowed = video.embedPrivacyPolicy === VideoEmbedPrivacyPolicy.ALL_ALLOWED || isOnInstance? true: await VideoEmbedPrivacyDomainModel.isDomainAllowed(video.id, req.query.domain)