1 import { Component, Input, OnInit } from '@angular/core'
2 import { ServerService } from '@app/core'
3 import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
4 import { HTMLServerConfig, Video } from '@shared/models'
5 import { getStoredP2PEnabled } from '../../../../../assets/player/peertube-player-local-storage'
6 import { isWebRTCDisabled } from '../../../../../assets/player/utils'
9 selector: 'my-privacy-concerns',
10 templateUrl: './privacy-concerns.component.html',
11 styleUrls: [ './privacy-concerns.component.scss' ]
13 export class PrivacyConcernsComponent implements OnInit {
14 private static LOCAL_STORAGE_PRIVACY_CONCERN_KEY = 'video-watch-privacy-concern'
20 private serverConfig: HTMLServerConfig
23 private serverService: ServerService
27 this.serverConfig = this.serverService.getHTMLConfig()
29 if (isWebRTCDisabled() || this.isTrackerDisabled() || this.isP2PDisabled() || this.alreadyAccepted()) {
34 acceptedPrivacyConcern () {
35 peertubeLocalStorage.setItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true')
39 private isTrackerDisabled () {
40 return this.video.isLocal && this.serverConfig.tracker.enabled === false
43 private isP2PDisabled () {
44 return getStoredP2PEnabled() === false
47 private alreadyAccepted () {
48 return peertubeLocalStorage.getItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'