aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/core')
-rw-r--r--client/src/app/core/auth/auth-user.model.ts10
-rw-r--r--client/src/app/core/auth/auth.service.ts2
-rw-r--r--client/src/app/core/menu/menu.service.ts2
-rw-r--r--client/src/app/core/notification/peertube-socket.service.ts2
-rw-r--r--client/src/app/core/plugins/hooks.service.ts2
-rw-r--r--client/src/app/core/plugins/plugin.service.ts10
-rw-r--r--client/src/app/core/renderer/html-renderer.service.ts2
-rw-r--r--client/src/app/core/renderer/markdown.service.ts5
-rw-r--r--client/src/app/core/rest/rest-extractor.service.ts10
-rw-r--r--client/src/app/core/routing/homepage-redirect.component.ts2
-rw-r--r--client/src/app/core/routing/meta.service.ts2
-rw-r--r--client/src/app/core/scoped-tokens/scoped-tokens.service.ts2
-rw-r--r--client/src/app/core/server/server.service.ts22
-rw-r--r--client/src/app/core/theme/theme.service.ts2
-rw-r--r--client/src/app/core/users/user-local-storage.service.ts10
-rw-r--r--client/src/app/core/users/user.model.ts15
-rw-r--r--client/src/app/core/users/user.service.ts2
17 files changed, 58 insertions, 44 deletions
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts
index 226075265..a1e23bfbb 100644
--- a/client/src/app/core/auth/auth-user.model.ts
+++ b/client/src/app/core/auth/auth-user.model.ts
@@ -1,16 +1,16 @@
1import { Observable, of } from 'rxjs' 1import { Observable, of } from 'rxjs'
2import { map } from 'rxjs/operators' 2import { map } from 'rxjs/operators'
3import { User } from '@app/core/users/user.model' 3import { User } from '@app/core/users/user.model'
4import { OAuthUserTokens } from '@root-helpers/users' 4import { hasUserRight } from '@peertube/peertube-core-utils'
5import { hasUserRight } from '@shared/core-utils/users'
6import { 5import {
7 MyUser as ServerMyUserModel, 6 MyUser as ServerMyUserModel,
8 MyUserSpecialPlaylist, 7 MyUserSpecialPlaylist,
9 User as ServerUserModel, 8 User as ServerUserModel,
10 UserRight, 9 UserRightType,
11 UserRole, 10 UserRole,
12 UserVideoQuota 11 UserVideoQuota
13} from '@shared/models' 12} from '@peertube/peertube-models'
13import { OAuthUserTokens } from '@root-helpers/users'
14 14
15export class AuthUser extends User implements ServerMyUserModel { 15export class AuthUser extends User implements ServerMyUserModel {
16 oauthTokens: OAuthUserTokens 16 oauthTokens: OAuthUserTokens
@@ -42,7 +42,7 @@ export class AuthUser extends User implements ServerMyUserModel {
42 this.oauthTokens.refreshToken = refreshToken 42 this.oauthTokens.refreshToken = refreshToken
43 } 43 }
44 44
45 hasRight (right: UserRight) { 45 hasRight (right: UserRightType) {
46 return hasUserRight(this.role.id, right) 46 return hasUserRight(this.role.id, right)
47 } 47 }
48 48
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 6fe601d8d..bc67ab7a0 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -6,7 +6,7 @@ import { Injectable } from '@angular/core'
6import { Router } from '@angular/router' 6import { Router } from '@angular/router'
7import { Notifier } from '@app/core/notification/notifier.service' 7import { Notifier } from '@app/core/notification/notifier.service'
8import { logger, OAuthUserTokens, objectToUrlEncoded, peertubeLocalStorage } from '@root-helpers/index' 8import { logger, OAuthUserTokens, objectToUrlEncoded, peertubeLocalStorage } from '@root-helpers/index'
9import { HttpStatusCode, MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models' 9import { HttpStatusCode, MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@peertube/peertube-models'
10import { environment } from '../../../environments/environment' 10import { environment } from '../../../environments/environment'
11import { RestExtractor } from '../rest/rest-extractor.service' 11import { RestExtractor } from '../rest/rest-extractor.service'
12import { RedirectService } from '../routing' 12import { RedirectService } from '../routing'
diff --git a/client/src/app/core/menu/menu.service.ts b/client/src/app/core/menu/menu.service.ts
index d865c7da2..39e89f6e3 100644
--- a/client/src/app/core/menu/menu.service.ts
+++ b/client/src/app/core/menu/menu.service.ts
@@ -2,7 +2,7 @@ import { fromEvent } from 'rxjs'
2import { debounceTime } from 'rxjs/operators' 2import { debounceTime } from 'rxjs/operators'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { GlobalIconName } from '@app/shared/shared-icons' 4import { GlobalIconName } from '@app/shared/shared-icons'
5import { HTMLServerConfig } from '@shared/models/server' 5import { HTMLServerConfig } from '@peertube/peertube-models'
6import { ScreenService } from '../wrappers' 6import { ScreenService } from '../wrappers'
7 7
8export type MenuLink = { 8export type MenuLink = {
diff --git a/client/src/app/core/notification/peertube-socket.service.ts b/client/src/app/core/notification/peertube-socket.service.ts
index 50a11e948..15af9a310 100644
--- a/client/src/app/core/notification/peertube-socket.service.ts
+++ b/client/src/app/core/notification/peertube-socket.service.ts
@@ -1,7 +1,7 @@
1import { Subject } from 'rxjs' 1import { Subject } from 'rxjs'
2import { ManagerOptions, Socket, SocketOptions } from 'socket.io-client' 2import { ManagerOptions, Socket, SocketOptions } from 'socket.io-client'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { LiveVideoEventPayload, LiveVideoEventType, UserNotification as UserNotificationServer } from '@shared/models' 4import { LiveVideoEventPayload, LiveVideoEventType, UserNotification as UserNotificationServer } from '@peertube/peertube-models'
5import { environment } from '../../../environments/environment' 5import { environment } from '../../../environments/environment'
6import { AuthService } from '../auth' 6import { AuthService } from '../auth'
7 7
diff --git a/client/src/app/core/plugins/hooks.service.ts b/client/src/app/core/plugins/hooks.service.ts
index d9fef8389..59c627c05 100644
--- a/client/src/app/core/plugins/hooks.service.ts
+++ b/client/src/app/core/plugins/hooks.service.ts
@@ -3,7 +3,7 @@ import { mergeMap, switchMap } from 'rxjs/operators'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { PluginService } from '@app/core/plugins/plugin.service' 4import { PluginService } from '@app/core/plugins/plugin.service'
5import { logger } from '@root-helpers/logger' 5import { logger } from '@root-helpers/logger'
6import { ClientActionHookName, ClientFilterHookName, PluginClientScope } from '@shared/models' 6import { ClientActionHookName, ClientFilterHookName, PluginClientScope } from '@peertube/peertube-models'
7import { AuthService, AuthStatus } from '../auth' 7import { AuthService, AuthStatus } from '../auth'
8 8
9type RawFunction<U, T> = (params: U) => T 9type RawFunction<U, T> = (params: U) => T
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index bd8c61d9a..d37b2e5f7 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -10,22 +10,22 @@ import { RestExtractor } from '@app/core/rest'
10import { ServerService } from '@app/core/server/server.service' 10import { ServerService } from '@app/core/server/server.service'
11import { getDevLocale, isOnDevLocale } from '@app/helpers' 11import { getDevLocale, isOnDevLocale } from '@app/helpers'
12import { CustomModalComponent } from '@app/modal/custom-modal.component' 12import { CustomModalComponent } from '@app/modal/custom-modal.component'
13import { PluginInfo, PluginsManager } from '@root-helpers/plugins-manager' 13import { getCompleteLocale, getKeys, isDefaultLocale, peertubeTranslate } from '@peertube/peertube-core-utils'
14import { getKeys } from '@shared/core-utils'
15import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n'
16import { 14import {
17 ClientHook, 15 ClientHook,
18 ClientHookName, 16 ClientHookName,
19 PluginClientScope, 17 PluginClientScope,
20 PluginTranslation, 18 PluginTranslation,
21 PluginType, 19 PluginType,
20 PluginType_Type,
22 PublicServerSetting, 21 PublicServerSetting,
23 RegisterClientFormFieldOptions, 22 RegisterClientFormFieldOptions,
24 RegisterClientRouteOptions, 23 RegisterClientRouteOptions,
25 RegisterClientSettingsScriptOptions, 24 RegisterClientSettingsScriptOptions,
26 RegisterClientVideoFieldOptions, 25 RegisterClientVideoFieldOptions,
27 ServerConfigPlugin 26 ServerConfigPlugin
28} from '@shared/models' 27} from '@peertube/peertube-models'
28import { PluginInfo, PluginsManager } from '@root-helpers/plugins-manager'
29import { environment } from '../../../environments/environment' 29import { environment } from '../../../environments/environment'
30import { RegisterClientHelpers } from '../../../types/register-client-option.model' 30import { RegisterClientHelpers } from '../../../types/register-client-option.model'
31 31
@@ -110,7 +110,7 @@ export class PluginService implements ClientHook {
110 return this.pluginsManager.removePlugin(plugin) 110 return this.pluginsManager.removePlugin(plugin)
111 } 111 }
112 112
113 nameToNpmName (name: string, type: PluginType) { 113 nameToNpmName (name: string, type: PluginType_Type) {
114 const prefix = type === PluginType.PLUGIN 114 const prefix = type === PluginType.PLUGIN
115 ? 'peertube-plugin-' 115 ? 'peertube-plugin-'
116 : 'peertube-theme-' 116 : 'peertube-theme-'
diff --git a/client/src/app/core/renderer/html-renderer.service.ts b/client/src/app/core/renderer/html-renderer.service.ts
index 7776ccad5..37741c079 100644
--- a/client/src/app/core/renderer/html-renderer.service.ts
+++ b/client/src/app/core/renderer/html-renderer.service.ts
@@ -1,5 +1,5 @@
1import { Injectable } from '@angular/core' 1import { Injectable } from '@angular/core'
2import { getCustomMarkupSanitizeOptions, getDefaultSanitizeOptions } from '@shared/core-utils/renderer/html' 2import { getCustomMarkupSanitizeOptions, getDefaultSanitizeOptions } from '@peertube/peertube-core-utils'
3import { LinkifierService } from './linkifier.service' 3import { LinkifierService } from './linkifier.service'
4 4
5@Injectable() 5@Injectable()
diff --git a/client/src/app/core/renderer/markdown.service.ts b/client/src/app/core/renderer/markdown.service.ts
index ec3b683bb..907b92232 100644
--- a/client/src/app/core/renderer/markdown.service.ts
+++ b/client/src/app/core/renderer/markdown.service.ts
@@ -1,13 +1,14 @@
1import * as MarkdownIt from 'markdown-it' 1import * as MarkdownIt from 'markdown-it'
2import { Injectable } from '@angular/core' 2import { Injectable } from '@angular/core'
3import { buildVideoLink, decorateVideoLink } from '@shared/core-utils'
4import { 3import {
4 buildVideoLink,
5 COMPLETE_RULES, 5 COMPLETE_RULES,
6 decorateVideoLink,
6 ENHANCED_RULES, 7 ENHANCED_RULES,
7 ENHANCED_WITH_HTML_RULES, 8 ENHANCED_WITH_HTML_RULES,
8 TEXT_RULES, 9 TEXT_RULES,
9 TEXT_WITH_HTML_RULES 10 TEXT_WITH_HTML_RULES
10} from '@shared/core-utils/renderer/markdown' 11} from '@peertube/peertube-core-utils'
11import { HtmlRendererService } from './html-renderer.service' 12import { HtmlRendererService } from './html-renderer.service'
12 13
13type MarkdownParsers = { 14type MarkdownParsers = {
diff --git a/client/src/app/core/rest/rest-extractor.service.ts b/client/src/app/core/rest/rest-extractor.service.ts
index c6c1e183f..bcc50c0f4 100644
--- a/client/src/app/core/rest/rest-extractor.service.ts
+++ b/client/src/app/core/rest/rest-extractor.service.ts
@@ -1,10 +1,10 @@
1import { throwError as observableThrowError } from 'rxjs' 1import { throwError as observableThrowError } from 'rxjs'
2import { HttpHeaderResponse } from '@angular/common/http'
2import { Inject, Injectable, LOCALE_ID } from '@angular/core' 3import { Inject, Injectable, LOCALE_ID } from '@angular/core'
3import { Router } from '@angular/router' 4import { Router } from '@angular/router'
4import { DateFormat, dateToHuman } from '@app/helpers' 5import { DateFormat, dateToHuman } from '@app/helpers'
6import { HttpStatusCode, HttpStatusCodeType, ResultList } from '@peertube/peertube-models'
5import { logger } from '@root-helpers/logger' 7import { logger } from '@root-helpers/logger'
6import { HttpStatusCode, ResultList } from '@shared/models'
7import { HttpHeaderResponse } from '@angular/common/http'
8 8
9@Injectable() 9@Injectable()
10export class RestExtractor { 10export class RestExtractor {
@@ -45,7 +45,11 @@ export class RestExtractor {
45 return target 45 return target
46 } 46 }
47 47
48 redirectTo404IfNotFound (obj: { status: number }, type: 'video' | 'other', status = [ HttpStatusCode.NOT_FOUND_404 ]) { 48 redirectTo404IfNotFound (
49 obj: { status: HttpStatusCodeType },
50 type: 'video' | 'other',
51 status: HttpStatusCodeType[] = [ HttpStatusCode.NOT_FOUND_404 ]
52 ) {
49 if (obj?.status && status.includes(obj.status)) { 53 if (obj?.status && status.includes(obj.status)) {
50 // Do not use redirectService to avoid circular dependencies 54 // Do not use redirectService to avoid circular dependencies
51 this.router.navigate([ '/404' ], { state: { type, obj }, skipLocationChange: true }) 55 this.router.navigate([ '/404' ], { state: { type, obj }, skipLocationChange: true })
diff --git a/client/src/app/core/routing/homepage-redirect.component.ts b/client/src/app/core/routing/homepage-redirect.component.ts
index 9e3848038..e9be832e0 100644
--- a/client/src/app/core/routing/homepage-redirect.component.ts
+++ b/client/src/app/core/routing/homepage-redirect.component.ts
@@ -1,6 +1,6 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { ActivatedRoute } from '@angular/router' 2import { ActivatedRoute } from '@angular/router'
3import { is18nPath } from '@shared/core-utils/i18n/i18n' 3import { is18nPath } from '@peertube/peertube-core-utils'
4import { RedirectService } from './redirect.service' 4import { RedirectService } from './redirect.service'
5 5
6/* 6/*
diff --git a/client/src/app/core/routing/meta.service.ts b/client/src/app/core/routing/meta.service.ts
index 97e440faf..d50f0d65a 100644
--- a/client/src/app/core/routing/meta.service.ts
+++ b/client/src/app/core/routing/meta.service.ts
@@ -1,6 +1,6 @@
1import { Injectable } from '@angular/core' 1import { Injectable } from '@angular/core'
2import { Meta, Title } from '@angular/platform-browser' 2import { Meta, Title } from '@angular/platform-browser'
3import { HTMLServerConfig } from '@shared/models/server' 3import { HTMLServerConfig } from '@peertube/peertube-models'
4import { ServerService } from '../server' 4import { ServerService } from '../server'
5 5
6export interface MetaSettings { 6export interface MetaSettings {
diff --git a/client/src/app/core/scoped-tokens/scoped-tokens.service.ts b/client/src/app/core/scoped-tokens/scoped-tokens.service.ts
index 038e5031c..f7d192feb 100644
--- a/client/src/app/core/scoped-tokens/scoped-tokens.service.ts
+++ b/client/src/app/core/scoped-tokens/scoped-tokens.service.ts
@@ -1,7 +1,7 @@
1import { catchError } from 'rxjs/operators' 1import { catchError } from 'rxjs/operators'
2import { HttpClient } from '@angular/common/http' 2import { HttpClient } from '@angular/common/http'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { ScopedToken } from '@shared/models/users/user-scoped-token' 4import { ScopedToken } from '@peertube/peertube-models'
5import { environment } from '../../../environments/environment' 5import { environment } from '../../../environments/environment'
6import { RestExtractor } from '../rest' 6import { RestExtractor } from '../rest'
7 7
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts
index 41cb4791a..75ac8ddc1 100644
--- a/client/src/app/core/server/server.service.ts
+++ b/client/src/app/core/server/server.service.ts
@@ -3,9 +3,16 @@ import { first, map, share, shareReplay, switchMap, tap } from 'rxjs/operators'
3import { HttpClient } from '@angular/common/http' 3import { HttpClient } from '@angular/common/http'
4import { Inject, Injectable, LOCALE_ID } from '@angular/core' 4import { Inject, Injectable, LOCALE_ID } from '@angular/core'
5import { getDevLocale, isOnDevLocale } from '@app/helpers' 5import { getDevLocale, isOnDevLocale } from '@app/helpers'
6import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@peertube/peertube-core-utils'
7import {
8 HTMLServerConfig,
9 ServerConfig,
10 ServerStats,
11 VideoConstant,
12 VideoPlaylistPrivacyType,
13 VideoPrivacyType
14} from '@peertube/peertube-models'
6import { logger } from '@root-helpers/logger' 15import { logger } from '@root-helpers/logger'
7import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n'
8import { HTMLServerConfig, ServerConfig, ServerStats, VideoConstant } from '@shared/models'
9import { environment } from '../../../environments/environment' 16import { environment } from '../../../environments/environment'
10 17
11@Injectable() 18@Injectable()
@@ -21,8 +28,8 @@ export class ServerService {
21 private localeObservable: Observable<any> 28 private localeObservable: Observable<any>
22 private videoLicensesObservable: Observable<VideoConstant<number>[]> 29 private videoLicensesObservable: Observable<VideoConstant<number>[]>
23 private videoCategoriesObservable: Observable<VideoConstant<number>[]> 30 private videoCategoriesObservable: Observable<VideoConstant<number>[]>
24 private videoPrivaciesObservable: Observable<VideoConstant<number>[]> 31 private videoPrivaciesObservable: Observable<VideoConstant<VideoPrivacyType>[]>
25 private videoPlaylistPrivaciesObservable: Observable<VideoConstant<number>[]> 32 private videoPlaylistPrivaciesObservable: Observable<VideoConstant<VideoPlaylistPrivacyType>[]>
26 private videoLanguagesObservable: Observable<VideoConstant<string>[]> 33 private videoLanguagesObservable: Observable<VideoConstant<string>[]>
27 private configObservable: Observable<ServerConfig> 34 private configObservable: Observable<ServerConfig>
28 35
@@ -123,7 +130,7 @@ export class ServerService {
123 130
124 getVideoPrivacies () { 131 getVideoPrivacies () {
125 if (!this.videoPrivaciesObservable) { 132 if (!this.videoPrivaciesObservable) {
126 this.videoPrivaciesObservable = this.loadAttributeEnum<number>(ServerService.BASE_VIDEO_URL, 'privacies') 133 this.videoPrivaciesObservable = this.loadAttributeEnum<VideoPrivacyType>(ServerService.BASE_VIDEO_URL, 'privacies')
127 } 134 }
128 135
129 return this.videoPrivaciesObservable.pipe(first()) 136 return this.videoPrivaciesObservable.pipe(first())
@@ -131,7 +138,10 @@ export class ServerService {
131 138
132 getVideoPlaylistPrivacies () { 139 getVideoPlaylistPrivacies () {
133 if (!this.videoPlaylistPrivaciesObservable) { 140 if (!this.videoPlaylistPrivaciesObservable) {
134 this.videoPlaylistPrivaciesObservable = this.loadAttributeEnum<number>(ServerService.BASE_VIDEO_PLAYLIST_URL, 'privacies') 141 this.videoPlaylistPrivaciesObservable = this.loadAttributeEnum<VideoPlaylistPrivacyType>(
142 ServerService.BASE_VIDEO_PLAYLIST_URL,
143 'privacies'
144 )
135 } 145 }
136 146
137 return this.videoPlaylistPrivaciesObservable.pipe(first()) 147 return this.videoPlaylistPrivaciesObservable.pipe(first())
diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts
index ead1770ba..22eb5ddd3 100644
--- a/client/src/app/core/theme/theme.service.ts
+++ b/client/src/app/core/theme/theme.service.ts
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'
2import { logger } from '@root-helpers/logger' 2import { logger } from '@root-helpers/logger'
3import { capitalizeFirstLetter } from '@root-helpers/string' 3import { capitalizeFirstLetter } from '@root-helpers/string'
4import { UserLocalStorageKeys } from '@root-helpers/users' 4import { UserLocalStorageKeys } from '@root-helpers/users'
5import { HTMLServerConfig, ServerConfigTheme } from '@shared/models' 5import { HTMLServerConfig, ServerConfigTheme } from '@peertube/peertube-models'
6import { environment } from '../../../environments/environment' 6import { environment } from '../../../environments/environment'
7import { AuthService } from '../auth' 7import { AuthService } from '../auth'
8import { PluginService } from '../plugins/plugin.service' 8import { PluginService } from '../plugins/plugin.service'
diff --git a/client/src/app/core/users/user-local-storage.service.ts b/client/src/app/core/users/user-local-storage.service.ts
index a87f3b98a..431a57343 100644
--- a/client/src/app/core/users/user-local-storage.service.ts
+++ b/client/src/app/core/users/user-local-storage.service.ts
@@ -1,13 +1,11 @@
1
2import { filter, throttleTime } from 'rxjs' 1import { filter, throttleTime } from 'rxjs'
3import { Injectable } from '@angular/core' 2import { Injectable } from '@angular/core'
4import { AuthService, AuthStatus } from '@app/core/auth' 3import { AuthService, AuthStatus } from '@app/core/auth'
4import { objectKeysTyped } from '@peertube/peertube-core-utils'
5import { NSFWPolicyType, UserRoleType, UserUpdateMe } from '@peertube/peertube-models'
5import { getBoolOrDefault } from '@root-helpers/local-storage-utils' 6import { getBoolOrDefault } from '@root-helpers/local-storage-utils'
6import { logger } from '@root-helpers/logger' 7import { logger } from '@root-helpers/logger'
7import { OAuthUserTokens, UserLocalStorageKeys } from '@root-helpers/users' 8import { OAuthUserTokens, UserLocalStorageKeys } from '@root-helpers/users'
8import { objectKeysTyped } from '@shared/core-utils'
9import { UserRole, UserUpdateMe } from '@shared/models'
10import { NSFWPolicyType } from '@shared/models/videos'
11import { ServerService } from '../server' 9import { ServerService } from '../server'
12import { LocalStorageService } from '../wrappers/storage.service' 10import { LocalStorageService } from '../wrappers/storage.service'
13 11
@@ -61,7 +59,7 @@ export class UserLocalStorageService {
61 username: this.localStorageService.getItem(UserLocalStorageKeys.USERNAME), 59 username: this.localStorageService.getItem(UserLocalStorageKeys.USERNAME),
62 email: this.localStorageService.getItem(UserLocalStorageKeys.EMAIL), 60 email: this.localStorageService.getItem(UserLocalStorageKeys.EMAIL),
63 role: { 61 role: {
64 id: parseInt(this.localStorageService.getItem(UserLocalStorageKeys.ROLE), 10) as UserRole, 62 id: parseInt(this.localStorageService.getItem(UserLocalStorageKeys.ROLE), 10) as UserRoleType,
65 label: '' 63 label: ''
66 }, 64 },
67 65
@@ -74,7 +72,7 @@ export class UserLocalStorageService {
74 username: string 72 username: string
75 email: string 73 email: string
76 role: { 74 role: {
77 id: UserRole 75 id: UserRoleType
78 } 76 }
79 }) { 77 }) {
80 this.localStorageService.setItem(UserLocalStorageKeys.ID, user.id.toString()) 78 this.localStorageService.setItem(UserLocalStorageKeys.ID, user.id.toString())
diff --git a/client/src/app/core/users/user.model.ts b/client/src/app/core/users/user.model.ts
index 54b749a4c..ffc7c2b44 100644
--- a/client/src/app/core/users/user.model.ts
+++ b/client/src/app/core/users/user.model.ts
@@ -1,17 +1,18 @@
1import { Account } from '@app/shared/shared-main/account/account.model' 1import { Account } from '@app/shared/shared-main/account/account.model'
2import { objectKeysTyped } from '@shared/core-utils' 2import { hasUserRight, objectKeysTyped } from '@peertube/peertube-core-utils'
3import { hasUserRight } from '@shared/core-utils/users'
4import { 3import {
5 ActorImage, 4 ActorImage,
6 HTMLServerConfig, 5 HTMLServerConfig,
7 NSFWPolicyType, 6 NSFWPolicyType,
8 User as UserServerModel, 7 User as UserServerModel,
9 UserAdminFlag, 8 UserAdminFlag,
9 UserAdminFlagType,
10 UserNotificationSetting, 10 UserNotificationSetting,
11 UserRight, 11 UserRightType,
12 UserRole, 12 UserRole,
13 UserRoleType,
13 VideoChannel 14 VideoChannel
14} from '@shared/models' 15} from '@peertube/peertube-models'
15 16
16export class User implements UserServerModel { 17export class User implements UserServerModel {
17 id: number 18 id: number
@@ -23,7 +24,7 @@ export class User implements UserServerModel {
23 emailPublic: boolean 24 emailPublic: boolean
24 nsfwPolicy: NSFWPolicyType 25 nsfwPolicy: NSFWPolicyType
25 26
26 adminFlags?: UserAdminFlag 27 adminFlags?: UserAdminFlagType
27 28
28 autoPlayVideo: boolean 29 autoPlayVideo: boolean
29 autoPlayNextVideo: boolean 30 autoPlayNextVideo: boolean
@@ -35,7 +36,7 @@ export class User implements UserServerModel {
35 videoLanguages: string[] 36 videoLanguages: string[]
36 37
37 role: { 38 role: {
38 id: UserRole 39 id: UserRoleType
39 label: string 40 label: string
40 } 41 }
41 42
@@ -124,7 +125,7 @@ export class User implements UserServerModel {
124 } 125 }
125 } 126 }
126 127
127 hasRight (right: UserRight) { 128 hasRight (right: UserRightType) {
128 return hasUserRight(this.role.id, right) 129 return hasUserRight(this.role.id, right)
129 } 130 }
130 131
diff --git a/client/src/app/core/users/user.service.ts b/client/src/app/core/users/user.service.ts
index b4024c02d..7ad0ee9bf 100644
--- a/client/src/app/core/users/user.service.ts
+++ b/client/src/app/core/users/user.service.ts
@@ -3,7 +3,7 @@ import { catchError, first, map, shareReplay } from 'rxjs/operators'
3import { HttpClient, HttpParams } from '@angular/common/http' 3import { HttpClient, HttpParams } from '@angular/common/http'
4import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
5import { AuthService } from '@app/core/auth' 5import { AuthService } from '@app/core/auth'
6import { ActorImage, User as UserServerModel, UserUpdateMe, UserVideoQuota } from '@shared/models' 6import { ActorImage, User as UserServerModel, UserUpdateMe, UserVideoQuota } from '@peertube/peertube-models'
7import { environment } from '../../../environments/environment' 7import { environment } from '../../../environments/environment'
8import { RestExtractor } from '../rest' 8import { RestExtractor } from '../rest'
9import { UserLocalStorageService } from './user-local-storage.service' 9import { UserLocalStorageService } from './user-local-storage.service'