diff options
Diffstat (limited to 'client/src/app/shared/shared-video-miniature/video-miniature.component.ts')
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-miniature.component.ts | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts index e1adbb6ad..f434550dd 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts | |||
@@ -29,6 +29,7 @@ export type MiniatureDisplayOptions = { | |||
29 | blacklistInfo?: boolean | 29 | blacklistInfo?: boolean |
30 | nsfw?: boolean | 30 | nsfw?: boolean |
31 | } | 31 | } |
32 | export type VideoLinkType = 'internal' | 'lazy-load' | 'external' | ||
32 | 33 | ||
33 | @Component({ | 34 | @Component({ |
34 | selector: 'my-video-miniature', | 35 | selector: 'my-video-miniature', |
@@ -55,7 +56,7 @@ export class VideoMiniatureComponent implements OnInit { | |||
55 | @Input() displayVideoActions = true | 56 | @Input() displayVideoActions = true |
56 | @Input() fitWidth = false | 57 | @Input() fitWidth = false |
57 | 58 | ||
58 | @Input() useLazyLoadUrl = false | 59 | @Input() videoLinkType: VideoLinkType = 'internal' |
59 | 60 | ||
60 | @Output() videoBlocked = new EventEmitter() | 61 | @Output() videoBlocked = new EventEmitter() |
61 | @Output() videoUnblocked = new EventEmitter() | 62 | @Output() videoUnblocked = new EventEmitter() |
@@ -85,7 +86,9 @@ export class VideoMiniatureComponent implements OnInit { | |||
85 | playlistElementId?: number | 86 | playlistElementId?: number |
86 | } | 87 | } |
87 | 88 | ||
88 | videoLink: any[] = [] | 89 | videoRouterLink: any[] = [] |
90 | videoHref: string | ||
91 | videoTarget: string | ||
89 | 92 | ||
90 | private ownerDisplayTypeChosen: 'account' | 'videoChannel' | 93 | private ownerDisplayTypeChosen: 'account' | 'videoChannel' |
91 | 94 | ||
@@ -125,18 +128,20 @@ export class VideoMiniatureComponent implements OnInit { | |||
125 | } | 128 | } |
126 | 129 | ||
127 | buildVideoLink () { | 130 | buildVideoLink () { |
128 | if (this.useLazyLoadUrl && this.video.url) { | 131 | if (this.videoLinkType === 'internal' || !this.video.url) { |
129 | const remoteUriConfig = this.serverConfig.search.remoteUri | 132 | this.videoRouterLink = [ '/videos/watch', this.video.uuid ] |
130 | 133 | return | |
131 | // Redirect on the external instance if not allowed to fetch remote data | 134 | } |
132 | const externalRedirect = (!this.authService.isLoggedIn() && !remoteUriConfig.anonymous) || !remoteUriConfig.users | ||
133 | const fromPath = window.location.pathname + window.location.search | ||
134 | 135 | ||
135 | this.videoLink = [ '/search/lazy-load-video', { url: this.video.url, externalRedirect, fromPath } ] | 136 | if (this.videoLinkType === 'external') { |
137 | this.videoRouterLink = null | ||
138 | this.videoHref = this.video.url | ||
139 | this.videoTarget = '_blank' | ||
136 | return | 140 | return |
137 | } | 141 | } |
138 | 142 | ||
139 | this.videoLink = [ '/videos/watch', this.video.uuid ] | 143 | // Lazy load |
144 | this.videoRouterLink = [ '/search/lazy-load-video', { url: this.video.url } ] | ||
140 | } | 145 | } |
141 | 146 | ||
142 | displayOwnerAccount () { | 147 | displayOwnerAccount () { |