diff options
Diffstat (limited to 'client/src/app')
4 files changed, 16 insertions, 0 deletions
diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html index 96629940f..8be8a66cc 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html | |||
@@ -16,6 +16,11 @@ | |||
16 | </div> | 16 | </div> |
17 | 17 | ||
18 | <my-peertube-checkbox | 18 | <my-peertube-checkbox |
19 | inputName="webTorrentEnabled" formControlName="webTorrentEnabled" | ||
20 | i18n-labelText labelText="Use WebTorrent to exchange parts of the video with others" | ||
21 | ></my-peertube-checkbox> | ||
22 | |||
23 | <my-peertube-checkbox | ||
19 | inputName="autoPlayVideo" formControlName="autoPlayVideo" | 24 | inputName="autoPlayVideo" formControlName="autoPlayVideo" |
20 | i18n-labelText labelText="Automatically plays video" | 25 | i18n-labelText labelText="Automatically plays video" |
21 | ></my-peertube-checkbox> | 26 | ></my-peertube-checkbox> |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts index 7089b2057..6c9a7ce75 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts | |||
@@ -29,12 +29,14 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI | |||
29 | ngOnInit () { | 29 | ngOnInit () { |
30 | this.buildForm({ | 30 | this.buildForm({ |
31 | nsfwPolicy: null, | 31 | nsfwPolicy: null, |
32 | webTorrentEnabled: null, | ||
32 | autoPlayVideo: null | 33 | autoPlayVideo: null |
33 | }) | 34 | }) |
34 | 35 | ||
35 | this.userInformationLoaded.subscribe(() => { | 36 | this.userInformationLoaded.subscribe(() => { |
36 | this.form.patchValue({ | 37 | this.form.patchValue({ |
37 | nsfwPolicy: this.user.nsfwPolicy, | 38 | nsfwPolicy: this.user.nsfwPolicy, |
39 | webTorrentEnabled: this.user.webTorrentEnabled, | ||
38 | autoPlayVideo: this.user.autoPlayVideo === true | 40 | autoPlayVideo: this.user.autoPlayVideo === true |
39 | }) | 41 | }) |
40 | }) | 42 | }) |
@@ -42,9 +44,11 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI | |||
42 | 44 | ||
43 | updateDetails () { | 45 | updateDetails () { |
44 | const nsfwPolicy = this.form.value['nsfwPolicy'] | 46 | const nsfwPolicy = this.form.value['nsfwPolicy'] |
47 | const webTorrentEnabled = this.form.value['webTorrentEnabled'] | ||
45 | const autoPlayVideo = this.form.value['autoPlayVideo'] | 48 | const autoPlayVideo = this.form.value['autoPlayVideo'] |
46 | const details: UserUpdateMe = { | 49 | const details: UserUpdateMe = { |
47 | nsfwPolicy, | 50 | nsfwPolicy, |
51 | webTorrentEnabled, | ||
48 | autoPlayVideo | 52 | autoPlayVideo |
49 | } | 53 | } |
50 | 54 | ||
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts index 74ed1c580..acd13d9c5 100644 --- a/client/src/app/core/auth/auth-user.model.ts +++ b/client/src/app/core/auth/auth-user.model.ts | |||
@@ -72,6 +72,7 @@ export class AuthUser extends User { | |||
72 | EMAIL: 'email', | 72 | EMAIL: 'email', |
73 | USERNAME: 'username', | 73 | USERNAME: 'username', |
74 | NSFW_POLICY: 'nsfw_policy', | 74 | NSFW_POLICY: 'nsfw_policy', |
75 | WEBTORRENT_ENABLED: 'peertube-videojs-' + 'webtorrent_enabled', | ||
75 | AUTO_PLAY_VIDEO: 'auto_play_video' | 76 | AUTO_PLAY_VIDEO: 'auto_play_video' |
76 | } | 77 | } |
77 | 78 | ||
@@ -87,6 +88,7 @@ export class AuthUser extends User { | |||
87 | email: peertubeLocalStorage.getItem(this.KEYS.EMAIL), | 88 | email: peertubeLocalStorage.getItem(this.KEYS.EMAIL), |
88 | role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole, | 89 | role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole, |
89 | nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType, | 90 | nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType, |
91 | webTorrentEnabled: peertubeLocalStorage.getItem(this.KEYS.WEBTORRENT_ENABLED) === 'true', | ||
90 | autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true' | 92 | autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true' |
91 | }, | 93 | }, |
92 | Tokens.load() | 94 | Tokens.load() |
@@ -101,6 +103,7 @@ export class AuthUser extends User { | |||
101 | peertubeLocalStorage.removeItem(this.KEYS.ID) | 103 | peertubeLocalStorage.removeItem(this.KEYS.ID) |
102 | peertubeLocalStorage.removeItem(this.KEYS.ROLE) | 104 | peertubeLocalStorage.removeItem(this.KEYS.ROLE) |
103 | peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY) | 105 | peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY) |
106 | peertubeLocalStorage.removeItem(this.KEYS.WEBTORRENT_ENABLED) | ||
104 | peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO) | 107 | peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO) |
105 | peertubeLocalStorage.removeItem(this.KEYS.EMAIL) | 108 | peertubeLocalStorage.removeItem(this.KEYS.EMAIL) |
106 | Tokens.flush() | 109 | Tokens.flush() |
@@ -138,6 +141,7 @@ export class AuthUser extends User { | |||
138 | peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email) | 141 | peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email) |
139 | peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) | 142 | peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) |
140 | peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString()) | 143 | peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString()) |
144 | peertubeLocalStorage.setItem(AuthUser.KEYS.WEBTORRENT_ENABLED, JSON.stringify(this.webTorrentEnabled)) | ||
141 | peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo)) | 145 | peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo)) |
142 | this.tokens.save() | 146 | this.tokens.save() |
143 | } | 147 | } |
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index 877f1bf3a..7c840ffa7 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts | |||
@@ -18,6 +18,7 @@ export type UserConstructorHash = { | |||
18 | videoQuota?: number, | 18 | videoQuota?: number, |
19 | videoQuotaDaily?: number, | 19 | videoQuotaDaily?: number, |
20 | nsfwPolicy?: NSFWPolicyType, | 20 | nsfwPolicy?: NSFWPolicyType, |
21 | webTorrentEnabled?: boolean, | ||
21 | autoPlayVideo?: boolean, | 22 | autoPlayVideo?: boolean, |
22 | createdAt?: Date, | 23 | createdAt?: Date, |
23 | account?: AccountServerModel, | 24 | account?: AccountServerModel, |
@@ -32,6 +33,7 @@ export class User implements UserServerModel { | |||
32 | email: string | 33 | email: string |
33 | role: UserRole | 34 | role: UserRole |
34 | nsfwPolicy: NSFWPolicyType | 35 | nsfwPolicy: NSFWPolicyType |
36 | webTorrentEnabled: boolean | ||
35 | autoPlayVideo: boolean | 37 | autoPlayVideo: boolean |
36 | videoQuota: number | 38 | videoQuota: number |
37 | videoQuotaDaily: number | 39 | videoQuotaDaily: number |
@@ -52,6 +54,7 @@ export class User implements UserServerModel { | |||
52 | this.videoQuota = hash.videoQuota | 54 | this.videoQuota = hash.videoQuota |
53 | this.videoQuotaDaily = hash.videoQuotaDaily | 55 | this.videoQuotaDaily = hash.videoQuotaDaily |
54 | this.nsfwPolicy = hash.nsfwPolicy | 56 | this.nsfwPolicy = hash.nsfwPolicy |
57 | this.webTorrentEnabled = hash.webTorrentEnabled | ||
55 | this.autoPlayVideo = hash.autoPlayVideo | 58 | this.autoPlayVideo = hash.autoPlayVideo |
56 | this.createdAt = hash.createdAt | 59 | this.createdAt = hash.createdAt |
57 | this.blocked = hash.blocked | 60 | this.blocked = hash.blocked |