diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-29 17:25:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-29 17:36:28 +0200 |
commit | 6ebdd12f8806edd7076e89c8ea3bcfaf5658b2b6 (patch) | |
tree | fa4800c702a614a19a6548e8561f14857c366661 /client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts | |
parent | 911186dae411d78788ccede093c251303187589a (diff) | |
download | PeerTube-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/shared/information/privacy-concerns.component.ts')
-rw-r--r-- | client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts | 45 |
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 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { ServerService } from '@app/core' | ||
3 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | ||
4 | import { HTMLServerConfig } from '@shared/models' | ||
5 | import { getStoredP2PEnabled } from '../../../../../assets/player/peertube-player-local-storage' | ||
6 | import { 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 | }) | ||
13 | export 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 | } | ||