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 | |
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')
6 files changed, 142 insertions, 1 deletions
diff --git a/client/src/app/+videos/+video-watch/shared/index.ts b/client/src/app/+videos/+video-watch/shared/index.ts index a6c2d75ad..6c5ff7e9b 100644 --- a/client/src/app/+videos/+video-watch/shared/index.ts +++ b/client/src/app/+videos/+video-watch/shared/index.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | export * from './comment' | 1 | export * from './comment' |
2 | export * from './information' | ||
2 | export * from './metadata' | 3 | export * from './metadata' |
3 | export * from './playlist' | 4 | export * from './playlist' |
4 | export * from './recommendations' | 5 | export * from './recommendations' |
diff --git a/client/src/app/+videos/+video-watch/shared/information/index.ts b/client/src/app/+videos/+video-watch/shared/information/index.ts new file mode 100644 index 000000000..4c9920765 --- /dev/null +++ b/client/src/app/+videos/+video-watch/shared/information/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './privacy-concerns.component' | |||
diff --git a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.html b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.html new file mode 100644 index 000000000..efad5a2b8 --- /dev/null +++ b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.html | |||
@@ -0,0 +1,15 @@ | |||
1 | <div class="privacy-concerns" *ngIf="hasAlreadyAcceptedPrivacyConcern === false"> | ||
2 | <div class="privacy-concerns-text"> | ||
3 | <span class="mr-2"> | ||
4 | <strong i18n>Friendly Reminder: </strong> | ||
5 | <ng-container i18n> | ||
6 | the sharing system used for this video implies that some technical information about your system (such as a public IP address) can be sent to other peers. | ||
7 | </ng-container> | ||
8 | </span> | ||
9 | <a i18n i18n-title title="Get more information" target="_blank" rel="noopener noreferrer" href="/about/peertube#privacy">More information</a> | ||
10 | </div> | ||
11 | |||
12 | <div i18n class="privacy-concerns-button privacy-concerns-okay" (click)="acceptedPrivacyConcern()"> | ||
13 | OK | ||
14 | </div> | ||
15 | </div> | ||
diff --git a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.scss b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.scss new file mode 100644 index 000000000..b42be318f --- /dev/null +++ b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.scss | |||
@@ -0,0 +1,80 @@ | |||
1 | @use '_variables' as *; | ||
2 | @use '_mixins' as *; | ||
3 | |||
4 | .privacy-concerns { | ||
5 | position: fixed; | ||
6 | bottom: 0; | ||
7 | |||
8 | width: calc(100% - #{$menu-width}); | ||
9 | z-index: z(privacymsg); | ||
10 | |||
11 | padding: 5px 15px; | ||
12 | |||
13 | display: flex; | ||
14 | flex-wrap: nowrap; | ||
15 | align-items: center; | ||
16 | justify-content: space-between; | ||
17 | background-color: rgba(0, 0, 0, 0.9); | ||
18 | color: #fff; | ||
19 | } | ||
20 | |||
21 | // If the view is expanded | ||
22 | :host-context(.expanded) { | ||
23 | .privacy-concerns { | ||
24 | width: 100%; | ||
25 | } | ||
26 | } | ||
27 | |||
28 | // Or if we are in the small view | ||
29 | @media screen and (max-width: $small-view) { | ||
30 | .privacy-concerns { | ||
31 | width: 100%; | ||
32 | } | ||
33 | } | ||
34 | |||
35 | .privacy-concerns-text { | ||
36 | margin: 0 5px; | ||
37 | } | ||
38 | |||
39 | a { | ||
40 | @include disable-default-a-behaviour; | ||
41 | |||
42 | color: pvar(--mainColor); | ||
43 | transition: color 0.3s; | ||
44 | |||
45 | &:hover { | ||
46 | color: #fff; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | .privacy-concerns-button { | ||
51 | @include margin-left(auto); | ||
52 | |||
53 | padding: 5px 8px 5px 7px; | ||
54 | border-radius: 3px; | ||
55 | white-space: nowrap; | ||
56 | cursor: pointer; | ||
57 | transition: background-color 0.3s; | ||
58 | font-weight: $font-semibold; | ||
59 | |||
60 | &:hover { | ||
61 | background-color: #000; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | .privacy-concerns-okay { | ||
66 | @include margin-left(10px); | ||
67 | |||
68 | background-color: pvar(--mainColor); | ||
69 | } | ||
70 | |||
71 | @media screen and (max-width: 1300px) { | ||
72 | .privacy-concerns { | ||
73 | font-size: 12px; | ||
74 | padding: 2px 5px; | ||
75 | } | ||
76 | |||
77 | .privacy-concerns-text { | ||
78 | margin: 0; | ||
79 | } | ||
80 | } | ||
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 | } | ||
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts index 2ea3b206f..b554567d9 100644 --- a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts +++ b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts | |||
@@ -2,7 +2,6 @@ import { Component, EventEmitter, Inject, Input, LOCALE_ID, OnChanges, Output } | |||
2 | import { MarkdownService, Notifier } from '@app/core' | 2 | import { MarkdownService, Notifier } from '@app/core' |
3 | import { VideoDetails, VideoService } from '@app/shared/shared-main' | 3 | import { VideoDetails, VideoService } from '@app/shared/shared-main' |
4 | 4 | ||
5 | |||
6 | @Component({ | 5 | @Component({ |
7 | selector: 'my-video-description', | 6 | selector: 'my-video-description', |
8 | templateUrl: './video-description.component.html', | 7 | templateUrl: './video-description.component.html', |