Fix embed url

parent 1fdf8edb
......@@ -45,6 +45,16 @@ function getAbsoluteAPIUrl () {
return absoluteAPIUrl
}
function getAbsoluteEmbedUrl () {
let absoluteEmbedUrl = environment.embedUrl
if (!absoluteEmbedUrl) {
// The Embed is on the same domain
absoluteEmbedUrl = window.location.origin
}
return absoluteEmbedUrl
}
const datePipe = new DatePipe('en')
function dateToHuman (date: string) {
return datePipe.transform(date, 'medium')
......@@ -201,6 +211,7 @@ export {
dateToHuman,
immutableAssign,
objectToFormData,
getAbsoluteEmbedUrl,
objectLineFeedToHtml,
removeElementFromArray,
importModule,
......
import { AuthUser } from '@app/core'
import { User } from '@app/core/users/user.model'
import { durationToString, getAbsoluteAPIUrl } from '@app/helpers'
import { durationToString, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers'
import {
Avatar,
peertubeTranslate,
......@@ -12,7 +12,6 @@ import {
VideoScheduleUpdate,
VideoState
} from '@shared/models'
import { environment } from '../../../../environments/environment'
import { Actor } from '../account/actor.model'
export class Video implements VideoServerModel {
......@@ -118,7 +117,7 @@ export class Video implements VideoServerModel {
this.previewUrl = hash.previewUrl || (absoluteAPIUrl + hash.previewPath)
this.embedPath = hash.embedPath
this.embedUrl = hash.embedUrl || (environment.embedUrl + hash.embedPath)
this.embedUrl = hash.embedUrl || (getAbsoluteEmbedUrl() + hash.embedPath)
this.url = hash.url
......
......@@ -2,5 +2,5 @@ export const environment = {
production: false,
hmr: false,
apiUrl: 'http://localhost:9001',
embedUrl: 'http://localhost:9001/videos/embed'
embedUrl: 'http://localhost:9001'
}
......@@ -2,5 +2,5 @@ export const environment = {
production: false,
hmr: true,
apiUrl: '',
embedUrl: 'http://localhost:9000/videos/embed'
embedUrl: 'http://localhost:9000'
}
......@@ -2,5 +2,5 @@ export const environment = {
production: true,
hmr: false,
apiUrl: '',
embedUrl: '/videos/embed'
embedUrl: ''
}
......@@ -12,5 +12,5 @@ export const environment = {
production: false,
hmr: false,
apiUrl: 'http://localhost:9000',
embedUrl: 'http://localhost:9000/videos/embed'
embedUrl: 'http://localhost:9000'
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment