aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+videos')
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts4
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-edit.component.ts9
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-send.ts8
-rw-r--r--client/src/app/+videos/+video-edit/video-add.component.ts9
-rw-r--r--client/src/app/+videos/+video-watch/recommendations/recent-videos-recommendation.service.ts10
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts35
-rw-r--r--client/src/app/+videos/video-list/trending/video-trending-header.component.ts30
7 files changed, 49 insertions, 56 deletions
diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts
index e48d16527..875911b91 100644
--- a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts
+++ b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts
@@ -4,7 +4,7 @@ import { VIDEO_CAPTION_FILE_VALIDATOR, VIDEO_CAPTION_LANGUAGE_VALIDATOR } from '
4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
5import { VideoCaptionEdit } from '@app/shared/shared-main' 5import { VideoCaptionEdit } from '@app/shared/shared-main'
6import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' 6import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
7import { ServerConfig, VideoConstant } from '@shared/models' 7import { HTMLServerConfig, VideoConstant } from '@shared/models'
8 8
9@Component({ 9@Component({
10 selector: 'my-video-caption-add-modal', 10 selector: 'my-video-caption-add-modal',
@@ -14,7 +14,7 @@ import { ServerConfig, VideoConstant } from '@shared/models'
14 14
15export class VideoCaptionAddModalComponent extends FormReactive implements OnInit { 15export class VideoCaptionAddModalComponent extends FormReactive implements OnInit {
16 @Input() existingCaptions: string[] 16 @Input() existingCaptions: string[]
17 @Input() serverConfig: ServerConfig 17 @Input() serverConfig: HTMLServerConfig
18 18
19 @Output() captionAdded = new EventEmitter<VideoCaptionEdit>() 19 @Output() captionAdded = new EventEmitter<VideoCaptionEdit>()
20 20
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts
index 3d916dbce..52801802b 100644
--- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts
+++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts
@@ -22,10 +22,10 @@ import { FormReactiveValidationMessages, FormValidatorService } from '@app/share
22import { InstanceService } from '@app/shared/shared-instance' 22import { InstanceService } from '@app/shared/shared-instance'
23import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main' 23import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main'
24import { 24import {
25 HTMLServerConfig,
25 LiveVideo, 26 LiveVideo,
26 RegisterClientFormFieldOptions, 27 RegisterClientFormFieldOptions,
27 RegisterClientVideoFieldOptions, 28 RegisterClientVideoFieldOptions,
28 ServerConfig,
29 VideoConstant, 29 VideoConstant,
30 VideoDetails, 30 VideoDetails,
31 VideoPrivacy 31 VideoPrivacy
@@ -84,7 +84,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
84 calendarTimezone: string 84 calendarTimezone: string
85 calendarDateFormat: string 85 calendarDateFormat: string
86 86
87 serverConfig: ServerConfig 87 serverConfig: HTMLServerConfig
88 88
89 pluginFields: PluginField[] = [] 89 pluginFields: PluginField[] = []
90 90
@@ -194,9 +194,8 @@ export class VideoEditComponent implements OnInit, OnDestroy {
194 } 194 }
195 }) 195 })
196 196
197 this.serverConfig = this.serverService.getTmpConfig() 197
198 this.serverService.getConfig() 198 this.serverConfig = this.serverService.getHTMLConfig()
199 .subscribe(config => this.serverConfig = config)
200 199
201 this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id) 200 this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id)
202 201
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-send.ts b/client/src/app/+videos/+video-edit/video-add-components/video-send.ts
index 3614499cd..a185892fe 100644
--- a/client/src/app/+videos/+video-edit/video-add-components/video-send.ts
+++ b/client/src/app/+videos/+video-edit/video-add-components/video-send.ts
@@ -6,7 +6,7 @@ import { listUserChannels } from '@app/helpers'
6import { FormReactive } from '@app/shared/shared-forms' 6import { FormReactive } from '@app/shared/shared-forms'
7import { VideoCaptionEdit, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' 7import { VideoCaptionEdit, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
8import { LoadingBarService } from '@ngx-loading-bar/core' 8import { LoadingBarService } from '@ngx-loading-bar/core'
9import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' 9import { HTMLServerConfig, VideoConstant, VideoPrivacy } from '@shared/models'
10 10
11@Directive() 11@Directive()
12// tslint:disable-next-line: directive-class-suffix 12// tslint:disable-next-line: directive-class-suffix
@@ -28,7 +28,7 @@ export abstract class VideoSend extends FormReactive implements OnInit {
28 protected serverService: ServerService 28 protected serverService: ServerService
29 protected videoService: VideoService 29 protected videoService: VideoService
30 protected videoCaptionService: VideoCaptionService 30 protected videoCaptionService: VideoCaptionService
31 protected serverConfig: ServerConfig 31 protected serverConfig: HTMLServerConfig
32 32
33 abstract canDeactivate (): CanComponentDeactivateResult 33 abstract canDeactivate (): CanComponentDeactivateResult
34 34
@@ -41,9 +41,7 @@ export abstract class VideoSend extends FormReactive implements OnInit {
41 this.firstStepChannelId = this.userVideoChannels[0].id 41 this.firstStepChannelId = this.userVideoChannels[0].id
42 }) 42 })
43 43
44 this.serverConfig = this.serverService.getTmpConfig() 44 this.serverConfig = this.serverService.getHTMLConfig()
45 this.serverService.getConfig()
46 .subscribe(config => this.serverConfig = config)
47 45
48 this.serverService.getVideoPrivacies() 46 this.serverService.getVideoPrivacies()
49 .subscribe( 47 .subscribe(
diff --git a/client/src/app/+videos/+video-edit/video-add.component.ts b/client/src/app/+videos/+video-edit/video-add.component.ts
index d735c936c..8606b8222 100644
--- a/client/src/app/+videos/+video-edit/video-add.component.ts
+++ b/client/src/app/+videos/+video-edit/video-add.component.ts
@@ -1,7 +1,7 @@
1import { Component, HostListener, OnInit, ViewChild } from '@angular/core' 1import { Component, HostListener, OnInit, ViewChild } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { AuthService, AuthUser, CanComponentDeactivate, ServerService } from '@app/core' 3import { AuthService, AuthUser, CanComponentDeactivate, ServerService } from '@app/core'
4import { ServerConfig } from '@shared/models' 4import { HTMLServerConfig } from '@shared/models'
5import { VideoEditType } from './shared/video-edit.type' 5import { VideoEditType } from './shared/video-edit.type'
6import { VideoGoLiveComponent } from './video-add-components/video-go-live.component' 6import { VideoGoLiveComponent } from './video-add-components/video-go-live.component'
7import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component' 7import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component'
@@ -26,7 +26,7 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
26 26
27 activeNav: string 27 activeNav: string
28 28
29 private serverConfig: ServerConfig 29 private serverConfig: HTMLServerConfig
30 30
31 constructor ( 31 constructor (
32 private auth: AuthService, 32 private auth: AuthService,
@@ -42,10 +42,7 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
42 ngOnInit () { 42 ngOnInit () {
43 this.user = this.auth.getUser() 43 this.user = this.auth.getUser()
44 44
45 this.serverConfig = this.serverService.getTmpConfig() 45 this.serverConfig = this.serverService.getHTMLConfig()
46
47 this.serverService.getConfig()
48 .subscribe(config => this.serverConfig = config)
49 46
50 this.user = this.auth.getUser() 47 this.user = this.auth.getUser()
51 48
diff --git a/client/src/app/+videos/+video-watch/recommendations/recent-videos-recommendation.service.ts b/client/src/app/+videos/+video-watch/recommendations/recent-videos-recommendation.service.ts
index 2a851f13a..4654da847 100644
--- a/client/src/app/+videos/+video-watch/recommendations/recent-videos-recommendation.service.ts
+++ b/client/src/app/+videos/+video-watch/recommendations/recent-videos-recommendation.service.ts
@@ -4,7 +4,7 @@ import { Injectable } from '@angular/core'
4import { ServerService, UserService } from '@app/core' 4import { ServerService, UserService } from '@app/core'
5import { Video, VideoService } from '@app/shared/shared-main' 5import { Video, VideoService } from '@app/shared/shared-main'
6import { AdvancedSearch, SearchService } from '@app/shared/shared-search' 6import { AdvancedSearch, SearchService } from '@app/shared/shared-search'
7import { ServerConfig } from '@shared/models' 7import { HTMLServerConfig } from '@shared/models'
8import { RecommendationInfo } from './recommendation-info.model' 8import { RecommendationInfo } from './recommendation-info.model'
9import { RecommendationService } from './recommendations.service' 9import { RecommendationService } from './recommendations.service'
10 10
@@ -15,7 +15,7 @@ import { RecommendationService } from './recommendations.service'
15export class RecentVideosRecommendationService implements RecommendationService { 15export class RecentVideosRecommendationService implements RecommendationService {
16 readonly pageSize = 5 16 readonly pageSize = 5
17 17
18 private config: ServerConfig 18 private config: HTMLServerConfig
19 19
20 constructor ( 20 constructor (
21 private videos: VideoService, 21 private videos: VideoService,
@@ -23,13 +23,11 @@ export class RecentVideosRecommendationService implements RecommendationService
23 private userService: UserService, 23 private userService: UserService,
24 private serverService: ServerService 24 private serverService: ServerService
25 ) { 25 ) {
26 this.config = this.serverService.getTmpConfig() 26 this.config = this.serverService.getHTMLConfig()
27
28 this.serverService.getConfig()
29 .subscribe(config => this.config = config)
30 } 27 }
31 28
32 getRecommendations (recommendation: RecommendationInfo): Observable<Video[]> { 29 getRecommendations (recommendation: RecommendationInfo): Observable<Video[]> {
30
33 return this.fetchPage(1, recommendation) 31 return this.fetchPage(1, recommendation)
34 .pipe( 32 .pipe(
35 map(videos => { 33 map(videos => {
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts
index 540b568ed..51d486ea5 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -28,7 +28,15 @@ import { VideoActionsDisplayType, VideoDownloadComponent } from '@app/shared/sha
28import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' 28import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
29import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' 29import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
30import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' 30import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
31import { PeerTubeProblemDocument, ServerConfig, ServerErrorCode, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models' 31import {
32 HTMLServerConfig,
33 PeerTubeProblemDocument,
34 ServerErrorCode,
35 UserVideoRateType,
36 VideoCaption,
37 VideoPrivacy,
38 VideoState
39} from '@shared/models'
32import { 40import {
33 cleanupVideoWatch, 41 cleanupVideoWatch,
34 getStoredP2PEnabled, 42 getStoredP2PEnabled,
@@ -116,7 +124,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
116 private configSub: Subscription 124 private configSub: Subscription
117 private liveVideosSub: Subscription 125 private liveVideosSub: Subscription
118 126
119 private serverConfig: ServerConfig 127 private serverConfig: HTMLServerConfig
120 128
121 constructor ( 129 constructor (
122 private elementRef: ElementRef, 130 private elementRef: ElementRef,
@@ -163,21 +171,16 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
163 171
164 PeertubePlayerManager.initState() 172 PeertubePlayerManager.initState()
165 173
166 this.serverConfig = this.serverService.getTmpConfig() 174 this.serverConfig = this.serverService.getHTMLConfig()
167 175 if (
168 this.configSub = this.serverService.getConfig() 176 isWebRTCDisabled() ||
169 .subscribe(config => { 177 this.serverConfig.tracker.enabled === false ||
170 this.serverConfig = config 178 getStoredP2PEnabled() === false ||
179 peertubeLocalStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'
180 ) {
181 this.hasAlreadyAcceptedPrivacyConcern = true
182 }
171 183
172 if (
173 isWebRTCDisabled() ||
174 this.serverConfig.tracker.enabled === false ||
175 getStoredP2PEnabled() === false ||
176 peertubeLocalStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'
177 ) {
178 this.hasAlreadyAcceptedPrivacyConcern = true
179 }
180 })
181 184
182 this.paramsSub = this.route.params.subscribe(routeParams => { 185 this.paramsSub = this.route.params.subscribe(routeParams => {
183 const videoId = routeParams[ 'videoId' ] 186 const videoId = routeParams[ 'videoId' ]
diff --git a/client/src/app/+videos/video-list/trending/video-trending-header.component.ts b/client/src/app/+videos/video-list/trending/video-trending-header.component.ts
index bbb02a236..6c2b32a4f 100644
--- a/client/src/app/+videos/video-list/trending/video-trending-header.component.ts
+++ b/client/src/app/+videos/video-list/trending/video-trending-header.component.ts
@@ -1,10 +1,10 @@
1import { Subscription } from 'rxjs'
1import { Component, HostBinding, Inject, OnDestroy, OnInit } from '@angular/core' 2import { Component, HostBinding, Inject, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
3import { VideoListHeaderComponent } from '@app/shared/shared-video-miniature'
4import { GlobalIconName } from '@app/shared/shared-icons'
5import { ServerService } from '@app/core/server/server.service'
6import { Subscription } from 'rxjs'
7import { AuthService, RedirectService } from '@app/core' 4import { AuthService, RedirectService } from '@app/core'
5import { ServerService } from '@app/core/server/server.service'
6import { GlobalIconName } from '@app/shared/shared-icons'
7import { VideoListHeaderComponent } from '@app/shared/shared-video-miniature'
8 8
9interface VideoTrendingHeaderItem { 9interface VideoTrendingHeaderItem {
10 label: string 10 label: string
@@ -67,21 +67,19 @@ export class VideoTrendingHeaderComponent extends VideoListHeaderComponent imple
67 } 67 }
68 68
69 ngOnInit () { 69 ngOnInit () {
70 this.serverService.getConfig() 70 const serverConfig = this.serverService.getHTMLConfig()
71 .subscribe(config => { 71 const algEnabled = serverConfig.trending.videos.algorithms.enabled
72 const algEnabled = config.trending.videos.algorithms.enabled
73 72
74 this.buttons = this.buttons.map(b => { 73 this.buttons = this.buttons.map(b => {
75 b.hidden = !algEnabled.includes(b.value) 74 b.hidden = !algEnabled.includes(b.value)
76 75
77 // Best is adapted by the user history so 76 // Best is adapted by the user history so
78 if (b.value === 'best' && !this.auth.isLoggedIn()) { 77 if (b.value === 'best' && !this.auth.isLoggedIn()) {
79 b.hidden = true 78 b.hidden = true
80 } 79 }
81 80
82 return b 81 return b
83 }) 82 })
84 })
85 83
86 this.algorithmChangeSub = this.route.queryParams.subscribe( 84 this.algorithmChangeSub = this.route.queryParams.subscribe(
87 queryParams => { 85 queryParams => {