diff options
Diffstat (limited to 'client/src/app/core')
-rw-r--r-- | client/src/app/core/auth/auth-user.model.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts index 97acf7bfe..acd13d9c5 100644 --- a/client/src/app/core/auth/auth-user.model.ts +++ b/client/src/app/core/auth/auth-user.model.ts | |||
@@ -4,7 +4,6 @@ import { UserRight } from '../../../../../shared/models/users/user-right.enum' | |||
4 | import { hasUserRight, UserRole } from '../../../../../shared/models/users/user-role' | 4 | import { hasUserRight, UserRole } from '../../../../../shared/models/users/user-role' |
5 | import { User, UserConstructorHash } from '../../shared/users/user.model' | 5 | import { User, UserConstructorHash } from '../../shared/users/user.model' |
6 | import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' | 6 | import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' |
7 | import { WebTorrentPolicyType } from '../../../../../shared/models/users/user-webtorrent-policy.type' | ||
8 | 7 | ||
9 | export type TokenOptions = { | 8 | export type TokenOptions = { |
10 | accessToken: string | 9 | accessToken: string |
@@ -73,7 +72,7 @@ export class AuthUser extends User { | |||
73 | EMAIL: 'email', | 72 | EMAIL: 'email', |
74 | USERNAME: 'username', | 73 | USERNAME: 'username', |
75 | NSFW_POLICY: 'nsfw_policy', | 74 | NSFW_POLICY: 'nsfw_policy', |
76 | WEBTORRENT_POLICY: 'peertube-videojs-' + 'webtorrent_policy', | 75 | WEBTORRENT_ENABLED: 'peertube-videojs-' + 'webtorrent_enabled', |
77 | AUTO_PLAY_VIDEO: 'auto_play_video' | 76 | AUTO_PLAY_VIDEO: 'auto_play_video' |
78 | } | 77 | } |
79 | 78 | ||
@@ -89,7 +88,7 @@ export class AuthUser extends User { | |||
89 | email: peertubeLocalStorage.getItem(this.KEYS.EMAIL), | 88 | email: peertubeLocalStorage.getItem(this.KEYS.EMAIL), |
90 | role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole, | 89 | role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole, |
91 | nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType, | 90 | nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType, |
92 | webTorrentPolicy: peertubeLocalStorage.getItem(this.KEYS.WEBTORRENT_POLICY) as WebTorrentPolicyType, | 91 | webTorrentEnabled: peertubeLocalStorage.getItem(this.KEYS.WEBTORRENT_ENABLED) === 'true', |
93 | autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true' | 92 | autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true' |
94 | }, | 93 | }, |
95 | Tokens.load() | 94 | Tokens.load() |
@@ -104,7 +103,7 @@ export class AuthUser extends User { | |||
104 | peertubeLocalStorage.removeItem(this.KEYS.ID) | 103 | peertubeLocalStorage.removeItem(this.KEYS.ID) |
105 | peertubeLocalStorage.removeItem(this.KEYS.ROLE) | 104 | peertubeLocalStorage.removeItem(this.KEYS.ROLE) |
106 | peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY) | 105 | peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY) |
107 | peertubeLocalStorage.removeItem(this.KEYS.WEBTORRENT_POLICY) | 106 | peertubeLocalStorage.removeItem(this.KEYS.WEBTORRENT_ENABLED) |
108 | peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO) | 107 | peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO) |
109 | peertubeLocalStorage.removeItem(this.KEYS.EMAIL) | 108 | peertubeLocalStorage.removeItem(this.KEYS.EMAIL) |
110 | Tokens.flush() | 109 | Tokens.flush() |
@@ -142,7 +141,7 @@ export class AuthUser extends User { | |||
142 | peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email) | 141 | peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email) |
143 | peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) | 142 | peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) |
144 | peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString()) | 143 | peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString()) |
145 | peertubeLocalStorage.setItem(AuthUser.KEYS.WEBTORRENT_POLICY, this.webTorrentPolicy.toString()) | 144 | peertubeLocalStorage.setItem(AuthUser.KEYS.WEBTORRENT_ENABLED, JSON.stringify(this.webTorrentEnabled)) |
146 | peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo)) | 145 | peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo)) |
147 | this.tokens.save() | 146 | this.tokens.save() |
148 | } | 147 | } |