aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-29 17:25:19 +0200
committerChocobozzz <me@florianbigard.com>2021-06-29 17:36:28 +0200
commit6ebdd12f8806edd7076e89c8ea3bcfaf5658b2b6 (patch)
treefa4800c702a614a19a6548e8561f14857c366661 /client/src/app/+videos/+video-watch/video-watch.component.ts
parent911186dae411d78788ccede093c251303187589a (diff)
downloadPeerTube-6ebdd12f8806edd7076e89c8ea3bcfaf5658b2b6.tar.gz
PeerTube-6ebdd12f8806edd7076e89c8ea3bcfaf5658b2b6.tar.zst
PeerTube-6ebdd12f8806edd7076e89c8ea3bcfaf5658b2b6.zip
Move privacy concerns in a dedicated component
Diffstat (limited to 'client/src/app/+videos/+video-watch/video-watch.component.ts')
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts44
1 files changed, 4 insertions, 40 deletions
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 9bc82d667..5a0109e64 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -26,7 +26,6 @@ import { SupportModalComponent } from '@app/shared/shared-support-modal'
26import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' 26import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'
27import { VideoActionsDisplayType, VideoDownloadComponent } from '@app/shared/shared-video-miniature' 27import { VideoActionsDisplayType, VideoDownloadComponent } from '@app/shared/shared-video-miniature'
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'
30import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' 29import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
31import { 30import {
32 HTMLServerConfig, 31 HTMLServerConfig,
@@ -37,12 +36,7 @@ import {
37 VideoPrivacy, 36 VideoPrivacy,
38 VideoState 37 VideoState
39} from '@shared/models' 38} from '@shared/models'
40import { 39import { cleanupVideoWatch, getStoredTheater, getStoredVideoWatchHistory } from '../../../assets/player/peertube-player-local-storage'
41 cleanupVideoWatch,
42 getStoredP2PEnabled,
43 getStoredTheater,
44 getStoredVideoWatchHistory
45} from '../../../assets/player/peertube-player-local-storage'
46import { 40import {
47 CustomizationOptions, 41 CustomizationOptions,
48 P2PMediaLoaderOptions, 42 P2PMediaLoaderOptions,
@@ -51,7 +45,7 @@ import {
51 PlayerMode, 45 PlayerMode,
52 videojs 46 videojs
53} from '../../../assets/player/peertube-player-manager' 47} from '../../../assets/player/peertube-player-manager'
54import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils' 48import { timeToInt } from '../../../assets/player/utils'
55import { environment } from '../../../environments/environment' 49import { environment } from '../../../environments/environment'
56import { VideoWatchPlaylistComponent } from './shared' 50import { VideoWatchPlaylistComponent } from './shared'
57 51
@@ -63,8 +57,6 @@ type URLOptions = CustomizationOptions & { playerMode: PlayerMode }
63 styleUrls: [ './video-watch.component.scss' ] 57 styleUrls: [ './video-watch.component.scss' ]
64}) 58})
65export class VideoWatchComponent implements OnInit, OnDestroy { 59export class VideoWatchComponent implements OnInit, OnDestroy {
66 private static LOCAL_STORAGE_PRIVACY_CONCERN_KEY = 'video-watch-privacy-concern'
67
68 @ViewChild('videoWatchPlaylist', { static: true }) videoWatchPlaylist: VideoWatchPlaylistComponent 60 @ViewChild('videoWatchPlaylist', { static: true }) videoWatchPlaylist: VideoWatchPlaylistComponent
69 @ViewChild('videoShareModal') videoShareModal: VideoShareComponent 61 @ViewChild('videoShareModal') videoShareModal: VideoShareComponent
70 @ViewChild('supportModal') supportModal: SupportModalComponent 62 @ViewChild('supportModal') supportModal: SupportModalComponent
@@ -84,15 +76,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
84 playlistPosition: number 76 playlistPosition: number
85 playlist: VideoPlaylist = null 77 playlist: VideoPlaylist = null
86 78
87 descriptionLoading = false
88 completeDescriptionShown = false
89 completeVideoDescription: string
90 shortVideoDescription: string
91 videoHTMLDescription = ''
92
93 likesBarTooltipText = '' 79 likesBarTooltipText = ''
94 80
95 hasAlreadyAcceptedPrivacyConcern = false
96 remoteServerDown = false 81 remoteServerDown = false
97 82
98 tooltipSupport = '' 83 tooltipSupport = ''
@@ -159,6 +144,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
159 } 144 }
160 145
161 async ngOnInit () { 146 async ngOnInit () {
147 this.serverConfig = this.serverService.getHTMLConfig()
148
162 // Hide the tooltips for unlogged users in mobile view, this adds confusion with the popover 149 // Hide the tooltips for unlogged users in mobile view, this adds confusion with the popover
163 if (this.user || !this.screenService.isInMobileView()) { 150 if (this.user || !this.screenService.isInMobileView()) {
164 this.tooltipSupport = $localize`Support options for this video` 151 this.tooltipSupport = $localize`Support options for this video`
@@ -167,16 +154,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
167 154
168 PeertubePlayerManager.initState() 155 PeertubePlayerManager.initState()
169 156
170 this.serverConfig = this.serverService.getHTMLConfig()
171 if (
172 isWebRTCDisabled() ||
173 this.serverConfig.tracker.enabled === false ||
174 getStoredP2PEnabled() === false ||
175 peertubeLocalStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'
176 ) {
177 this.hasAlreadyAcceptedPrivacyConcern = true
178 }
179
180 this.paramsSub = this.route.params.subscribe(routeParams => { 157 this.paramsSub = this.route.params.subscribe(routeParams => {
181 const videoId = routeParams[ 'videoId' ] 158 const videoId = routeParams[ 'videoId' ]
182 if (videoId) this.loadVideo(videoId) 159 if (videoId) this.loadVideo(videoId)
@@ -272,16 +249,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
272 this.redirectService.redirectToHomepage() 249 this.redirectService.redirectToHomepage()
273 } 250 }
274 251
275 declinedPrivacyConcern () {
276 peertubeLocalStorage.setItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'false')
277 this.hasAlreadyAcceptedPrivacyConcern = false
278 }
279
280 acceptedPrivacyConcern () {
281 peertubeLocalStorage.setItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true')
282 this.hasAlreadyAcceptedPrivacyConcern = true
283 }
284
285 isVideoToTranscode () { 252 isVideoToTranscode () {
286 return this.video && this.video.state.id === VideoState.TO_TRANSCODE 253 return this.video && this.video.state.id === VideoState.TO_TRANSCODE
287 } 254 }
@@ -486,9 +453,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
486 453
487 // Re init attributes 454 // Re init attributes
488 this.playerPlaceholderImgSrc = undefined 455 this.playerPlaceholderImgSrc = undefined
489 this.descriptionLoading = false
490 this.completeDescriptionShown = false
491 this.completeVideoDescription = undefined
492 this.remoteServerDown = false 456 this.remoteServerDown = false
493 this.currentTime = undefined 457 this.currentTime = undefined
494 458