1
0
Fork 0

Fix embed url

This commit is contained in:
Chocobozzz 2020-07-10 11:13:41 +02:00
parent 1fdf8edb77
commit 72493e44e9
No known key found for this signature in database
GPG key ID: 583A612D890159BE
6 changed files with 17 additions and 7 deletions

View file

@ -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,

View file

@ -1,6 +1,6 @@
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

View file

@ -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'
}

View file

@ -2,5 +2,5 @@ export const environment = {
production: false,
hmr: true,
apiUrl: '',
embedUrl: 'http://localhost:9000/videos/embed'
embedUrl: 'http://localhost:9000'
}

View file

@ -2,5 +2,5 @@ export const environment = {
production: true,
hmr: false,
apiUrl: '',
embedUrl: '/videos/embed'
embedUrl: ''
}

View file

@ -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'
}