]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts
Breaking: fix inconsistencies in configuration
[github/Chocobozzz/PeerTube.git] / client / src / app / +videos / +video-watch / shared / information / privacy-concerns.component.ts
CommitLineData
6ebdd12f
C
1import { Component, OnInit } from '@angular/core'
2import { ServerService } from '@app/core'
3import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
4import { HTMLServerConfig } from '@shared/models'
5import { getStoredP2PEnabled } from '../../../../../assets/player/peertube-player-local-storage'
6import { isWebRTCDisabled } from '../../../../../assets/player/utils'
7
8@Component({
9 selector: 'my-privacy-concerns',
10 templateUrl: './privacy-concerns.component.html',
11 styleUrls: [ './privacy-concerns.component.scss' ]
12})
13export class PrivacyConcernsComponent implements OnInit {
14 private static LOCAL_STORAGE_PRIVACY_CONCERN_KEY = 'video-watch-privacy-concern'
15
16 hasAlreadyAcceptedPrivacyConcern = false
17
18 private serverConfig: HTMLServerConfig
19
20 constructor (
21 private serverService: ServerService
22 ) { }
23
98ab5dc8 24 ngOnInit () {
6ebdd12f 25 this.serverConfig = this.serverService.getHTMLConfig()
98ab5dc8 26
6ebdd12f
C
27 if (
28 isWebRTCDisabled() ||
29 this.serverConfig.tracker.enabled === false ||
30 getStoredP2PEnabled() === false ||
31 peertubeLocalStorage.getItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'
32 ) {
33 this.hasAlreadyAcceptedPrivacyConcern = true
34 }
35 }
36
37 declinedPrivacyConcern () {
38 peertubeLocalStorage.setItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'false')
39 this.hasAlreadyAcceptedPrivacyConcern = false
40 }
41
42 acceptedPrivacyConcern () {
43 peertubeLocalStorage.setItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true')
44 this.hasAlreadyAcceptedPrivacyConcern = true
45 }
46}