diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-04 13:31:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-04 15:45:44 +0200 |
commit | 2989628b7913383b39ac34c7db8666a21f8e5037 (patch) | |
tree | ac7759177c04e524e7845143fd685aefb49e810e /client/src/app/+videos/+video-watch | |
parent | 8e08d415f9473b6b72fef698729453e726da16e7 (diff) | |
download | PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.gz PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.zst PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.zip |
Use HTML config when possible
Diffstat (limited to 'client/src/app/+videos/+video-watch')
-rw-r--r-- | client/src/app/+videos/+video-watch/recommendations/recent-videos-recommendation.service.ts | 10 | ||||
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.ts | 35 |
2 files changed, 23 insertions, 22 deletions
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' | |||
4 | import { ServerService, UserService } from '@app/core' | 4 | import { ServerService, UserService } from '@app/core' |
5 | import { Video, VideoService } from '@app/shared/shared-main' | 5 | import { Video, VideoService } from '@app/shared/shared-main' |
6 | import { AdvancedSearch, SearchService } from '@app/shared/shared-search' | 6 | import { AdvancedSearch, SearchService } from '@app/shared/shared-search' |
7 | import { ServerConfig } from '@shared/models' | 7 | import { HTMLServerConfig } from '@shared/models' |
8 | import { RecommendationInfo } from './recommendation-info.model' | 8 | import { RecommendationInfo } from './recommendation-info.model' |
9 | import { RecommendationService } from './recommendations.service' | 9 | import { RecommendationService } from './recommendations.service' |
10 | 10 | ||
@@ -15,7 +15,7 @@ import { RecommendationService } from './recommendations.service' | |||
15 | export class RecentVideosRecommendationService implements RecommendationService { | 15 | export 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 | |||
28 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 28 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
29 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | 29 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
30 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | 30 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' |
31 | import { PeerTubeProblemDocument, ServerConfig, ServerErrorCode, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models' | 31 | import { |
32 | HTMLServerConfig, | ||
33 | PeerTubeProblemDocument, | ||
34 | ServerErrorCode, | ||
35 | UserVideoRateType, | ||
36 | VideoCaption, | ||
37 | VideoPrivacy, | ||
38 | VideoState | ||
39 | } from '@shared/models' | ||
32 | import { | 40 | import { |
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' ] |