aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts')
-rw-r--r--client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts45
1 files changed, 45 insertions, 0 deletions
diff --git a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts
new file mode 100644
index 000000000..ef5c8ed87
--- /dev/null
+++ b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts
@@ -0,0 +1,45 @@
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
24 async ngOnInit () {
25 this.serverConfig = this.serverService.getHTMLConfig()
26 if (
27 isWebRTCDisabled() ||
28 this.serverConfig.tracker.enabled === false ||
29 getStoredP2PEnabled() === false ||
30 peertubeLocalStorage.getItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'
31 ) {
32 this.hasAlreadyAcceptedPrivacyConcern = true
33 }
34 }
35
36 declinedPrivacyConcern () {
37 peertubeLocalStorage.setItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'false')
38 this.hasAlreadyAcceptedPrivacyConcern = false
39 }
40
41 acceptedPrivacyConcern () {
42 peertubeLocalStorage.setItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true')
43 this.hasAlreadyAcceptedPrivacyConcern = true
44 }
45}