aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-03-07 17:35:30 +0100
committerChocobozzz <me@florianbigard.com>2018-03-07 17:35:30 +0100
commit2b3b76abb0c363d85ff5c831afd541a9c6982e76 (patch)
tree863d1b0d3a9da8061f43ceee9df07395956b7142 /client/src/app/videos/+video-watch/video-watch.component.ts
parentea65a47623a545ed8023347d752cdd5fe5700e5d (diff)
downloadPeerTube-2b3b76abb0c363d85ff5c831afd541a9c6982e76.tar.gz
PeerTube-2b3b76abb0c363d85ff5c831afd541a9c6982e76.tar.zst
PeerTube-2b3b76abb0c363d85ff5c831afd541a9c6982e76.zip
Use banner instead of modal for privacy concerns
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.ts22
1 files changed, 6 insertions, 16 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 2924f1622..5750c5fca 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -50,6 +50,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
50 videoHTMLDescription = '' 50 videoHTMLDescription = ''
51 likesBarTooltipText = '' 51 likesBarTooltipText = ''
52 52
53 private hasAlreadyAcceptedPrivacyConcern = false
53 private otherVideos: Video[] = [] 54 private otherVideos: Video[] = []
54 private paramsSub: Subscription 55 private paramsSub: Subscription
55 56
@@ -73,6 +74,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
73 } 74 }
74 75
75 ngOnInit () { 76 ngOnInit () {
77 if (localStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true') {
78 this.hasAlreadyAcceptedPrivacyConcern = true
79 }
80
76 this.videoService.getVideos({ currentPage: 1, itemsPerPage: 5 }, '-createdAt') 81 this.videoService.getVideos({ currentPage: 1, itemsPerPage: 5 }, '-createdAt')
77 .subscribe( 82 .subscribe(
78 data => { 83 data => {
@@ -317,18 +322,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
317 if (res === false) return this.redirectService.redirectToHomepage() 322 if (res === false) return this.redirectService.redirectToHomepage()
318 } 323 }
319 324
320 if (!this.hasAlreadyAcceptedPrivacyConcern()) {
321 const res = await this.confirmService.confirm(
322 'PeerTube uses P2P, other may know you are watching that video through your public IP address. ' +
323 'Are you okay with that?',
324 'Privacy concern',
325 'I accept!'
326 )
327 if (res === false) return this.redirectService.redirectToHomepage()
328 }
329
330 this.acceptedPrivacyConcern()
331
332 // Player was already loaded 325 // Player was already loaded
333 if (this.videoPlayerLoaded !== true) { 326 if (this.videoPlayerLoaded !== true) {
334 this.playerElement = this.elementRef.nativeElement.querySelector('#video-element') 327 this.playerElement = this.elementRef.nativeElement.querySelector('#video-element')
@@ -478,11 +471,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
478 return this.user.autoPlayVideo !== false 471 return this.user.autoPlayVideo !== false
479 } 472 }
480 473
481 private hasAlreadyAcceptedPrivacyConcern () {
482 return localStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'
483 }
484
485 private acceptedPrivacyConcern () { 474 private acceptedPrivacyConcern () {
486 localStorage.setItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true') 475 localStorage.setItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true')
476 this.hasAlreadyAcceptedPrivacyConcern = true
487 } 477 }
488} 478}