aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-18 15:31:54 +0100
committerChocobozzz <me@florianbigard.com>2019-12-18 15:40:59 +0100
commitba430d7516bc5b1324b60571ba7594460969b7fb (patch)
treedf5c6952c82f49a94c0a884bbc97d4a0cbd9f867 /client/src/app/shared
parent5dfb7c1dec8222b0bbccac5b56ad46da1438747e (diff)
downloadPeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.gz
PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.zst
PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.zip
Lazy load static objects
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/images/preview-upload.component.ts10
-rw-r--r--client/src/app/shared/instance/instance-features-table.component.html16
-rw-r--r--client/src/app/shared/instance/instance-features-table.component.ts23
-rw-r--r--client/src/app/shared/instance/instance.service.ts45
-rw-r--r--client/src/app/shared/moderation/user-moderation-dropdown.component.ts15
-rw-r--r--client/src/app/shared/overview/overview.service.ts2
-rw-r--r--client/src/app/shared/video-caption/video-caption.service.ts2
-rw-r--r--client/src/app/shared/video-import/video-import.service.ts2
-rw-r--r--client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts19
-rw-r--r--client/src/app/shared/video-playlist/video-playlist.service.ts6
-rw-r--r--client/src/app/shared/video/abstract-video-list.ts10
-rw-r--r--client/src/app/shared/video/video-miniature.component.ts9
-rw-r--r--client/src/app/shared/video/video.service.ts4
13 files changed, 106 insertions, 57 deletions
diff --git a/client/src/app/shared/images/preview-upload.component.ts b/client/src/app/shared/images/preview-upload.component.ts
index 44b78866e..f56f5b1f8 100644
--- a/client/src/app/shared/images/preview-upload.component.ts
+++ b/client/src/app/shared/images/preview-upload.component.ts
@@ -2,6 +2,7 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core'
2import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' 2import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
3import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' 3import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'
4import { ServerService } from '@app/core' 4import { ServerService } from '@app/core'
5import { ServerConfig } from '@shared/models'
5 6
6@Component({ 7@Component({
7 selector: 'my-preview-upload', 8 selector: 'my-preview-upload',
@@ -24,6 +25,7 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor {
24 imageSrc: SafeResourceUrl 25 imageSrc: SafeResourceUrl
25 allowedExtensionsMessage = '' 26 allowedExtensionsMessage = ''
26 27
28 private serverConfig: ServerConfig
27 private file: File 29 private file: File
28 30
29 constructor ( 31 constructor (
@@ -32,14 +34,18 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor {
32 ) {} 34 ) {}
33 35
34 get videoImageExtensions () { 36 get videoImageExtensions () {
35 return this.serverService.getConfig().video.image.extensions 37 return this.serverConfig.video.image.extensions
36 } 38 }
37 39
38 get maxVideoImageSize () { 40 get maxVideoImageSize () {
39 return this.serverService.getConfig().video.image.size.max 41 return this.serverConfig.video.image.size.max
40 } 42 }
41 43
42 ngOnInit () { 44 ngOnInit () {
45 this.serverConfig = this.serverService.getTmpConfig()
46 this.serverService.getConfig()
47 .subscribe(config => this.serverConfig = config)
48
43 this.allowedExtensionsMessage = this.videoImageExtensions.join(', ') 49 this.allowedExtensionsMessage = this.videoImageExtensions.join(', ')
44 } 50 }
45 51
diff --git a/client/src/app/shared/instance/instance-features-table.component.html b/client/src/app/shared/instance/instance-features-table.component.html
index f880a886f..fd8b3354f 100644
--- a/client/src/app/shared/instance/instance-features-table.component.html
+++ b/client/src/app/shared/instance/instance-features-table.component.html
@@ -1,6 +1,6 @@
1<div class="feature-table"> 1<div class="feature-table">
2 2
3 <table class="table" *ngIf="config"> 3 <table class="table" *ngIf="serverConfig">
4 <tr> 4 <tr>
5 <td i18n class="label">PeerTube version</td> 5 <td i18n class="label">PeerTube version</td>
6 6
@@ -19,7 +19,7 @@
19 <tr> 19 <tr>
20 <td i18n class="label">User registration allowed</td> 20 <td i18n class="label">User registration allowed</td>
21 <td> 21 <td>
22 <my-feature-boolean [value]="config.signup.allowed"></my-feature-boolean> 22 <my-feature-boolean [value]="serverConfig.signup.allowed"></my-feature-boolean>
23 </td> 23 </td>
24 </tr> 24 </tr>
25 25
@@ -30,15 +30,15 @@
30 <tr> 30 <tr>
31 <td i18n class="sub-label">Transcoding in multiple resolutions</td> 31 <td i18n class="sub-label">Transcoding in multiple resolutions</td>
32 <td> 32 <td>
33 <my-feature-boolean [value]="config.transcoding.enabledResolutions.length !== 0"></my-feature-boolean> 33 <my-feature-boolean [value]="serverConfig.transcoding.enabledResolutions.length !== 0"></my-feature-boolean>
34 </td> 34 </td>
35 </tr> 35 </tr>
36 36
37 <tr> 37 <tr>
38 <td i18n class="sub-label">Video uploads</td> 38 <td i18n class="sub-label">Video uploads</td>
39 <td> 39 <td>
40 <span *ngIf="config.autoBlacklist.videos.ofUsers.enabled">Requires manual validation by moderators</span> 40 <span *ngIf="serverConfig.autoBlacklist.videos.ofUsers.enabled">Requires manual validation by moderators</span>
41 <span *ngIf="!config.autoBlacklist.videos.ofUsers.enabled">Automatically published</span> 41 <span *ngIf="!serverConfig.autoBlacklist.videos.ofUsers.enabled">Automatically published</span>
42 </td> 42 </td>
43 </tr> 43 </tr>
44 44
@@ -69,14 +69,14 @@
69 <tr> 69 <tr>
70 <td i18n class="sub-label">HTTP import (YouTube, Vimeo, direct URL...)</td> 70 <td i18n class="sub-label">HTTP import (YouTube, Vimeo, direct URL...)</td>
71 <td> 71 <td>
72 <my-feature-boolean [value]="config.import.videos.http.enabled"></my-feature-boolean> 72 <my-feature-boolean [value]="serverConfig.import.videos.http.enabled"></my-feature-boolean>
73 </td> 73 </td>
74 </tr> 74 </tr>
75 75
76 <tr> 76 <tr>
77 <td i18n class="sub-label">Torrent import</td> 77 <td i18n class="sub-label">Torrent import</td>
78 <td> 78 <td>
79 <my-feature-boolean [value]="config.import.videos.torrent.enabled"></my-feature-boolean> 79 <my-feature-boolean [value]="serverConfig.import.videos.torrent.enabled"></my-feature-boolean>
80 </td> 80 </td>
81 </tr> 81 </tr>
82 82
@@ -88,7 +88,7 @@
88 <tr> 88 <tr>
89 <td i18n class="sub-label">P2P enabled</td> 89 <td i18n class="sub-label">P2P enabled</td>
90 <td> 90 <td>
91 <my-feature-boolean [value]="config.tracker.enabled"></my-feature-boolean> 91 <my-feature-boolean [value]="serverConfig.tracker.enabled"></my-feature-boolean>
92 </td> 92 </td>
93 </tr> 93 </tr>
94 </table> 94 </table>
diff --git a/client/src/app/shared/instance/instance-features-table.component.ts b/client/src/app/shared/instance/instance-features-table.component.ts
index 1661f1efe..8fd15ebad 100644
--- a/client/src/app/shared/instance/instance-features-table.component.ts
+++ b/client/src/app/shared/instance/instance-features-table.component.ts
@@ -10,7 +10,7 @@ import { ServerConfig } from '@shared/models'
10}) 10})
11export class InstanceFeaturesTableComponent implements OnInit { 11export class InstanceFeaturesTableComponent implements OnInit {
12 quotaHelpIndication = '' 12 quotaHelpIndication = ''
13 config: ServerConfig 13 serverConfig: ServerConfig
14 14
15 constructor ( 15 constructor (
16 private i18n: I18n, 16 private i18n: I18n,
@@ -19,29 +19,34 @@ export class InstanceFeaturesTableComponent implements OnInit {
19 } 19 }
20 20
21 get initialUserVideoQuota () { 21 get initialUserVideoQuota () {
22 return this.serverService.getConfig().user.videoQuota 22 return this.serverConfig.user.videoQuota
23 } 23 }
24 24
25 get dailyUserVideoQuota () { 25 get dailyUserVideoQuota () {
26 return Math.min(this.initialUserVideoQuota, this.serverService.getConfig().user.videoQuotaDaily) 26 return Math.min(this.initialUserVideoQuota, this.serverConfig.user.videoQuotaDaily)
27 } 27 }
28 28
29 ngOnInit () { 29 ngOnInit () {
30 this.serverService.configLoaded 30 this.serverConfig = this.serverService.getTmpConfig()
31 .subscribe(() => { 31 this.serverService.getConfig()
32 this.config = this.serverService.getConfig() 32 .subscribe(config => {
33 this.serverConfig = config
33 this.buildQuotaHelpIndication() 34 this.buildQuotaHelpIndication()
34 }) 35 })
35 } 36 }
36 37
37 buildNSFWLabel () { 38 buildNSFWLabel () {
38 const policy = this.serverService.getConfig().instance.defaultNSFWPolicy 39 const policy = this.serverConfig.instance.defaultNSFWPolicy
39 40
40 if (policy === 'do_not_list') return this.i18n('Hidden') 41 if (policy === 'do_not_list') return this.i18n('Hidden')
41 if (policy === 'blur') return this.i18n('Blurred with confirmation request') 42 if (policy === 'blur') return this.i18n('Blurred with confirmation request')
42 if (policy === 'display') return this.i18n('Displayed') 43 if (policy === 'display') return this.i18n('Displayed')
43 } 44 }
44 45
46 getServerVersionAndCommit () {
47 return this.serverService.getServerVersionAndCommit()
48 }
49
45 private getApproximateTime (seconds: number) { 50 private getApproximateTime (seconds: number) {
46 const hours = Math.floor(seconds / 3600) 51 const hours = Math.floor(seconds / 3600)
47 let pluralSuffix = '' 52 let pluralSuffix = ''
@@ -53,10 +58,6 @@ export class InstanceFeaturesTableComponent implements OnInit {
53 return this.i18n('~ {{minutes}} {minutes, plural, =1 {minute} other {minutes}}', { minutes }) 58 return this.i18n('~ {{minutes}} {minutes, plural, =1 {minute} other {minutes}}', { minutes })
54 } 59 }
55 60
56 getServerVersionAndCommit () {
57 return this.serverService.getServerVersionAndCommit()
58 }
59
60 private buildQuotaHelpIndication () { 61 private buildQuotaHelpIndication () {
61 if (this.initialUserVideoQuota === -1) return 62 if (this.initialUserVideoQuota === -1) return
62 63
diff --git a/client/src/app/shared/instance/instance.service.ts b/client/src/app/shared/instance/instance.service.ts
index 44b413fa4..8b26063fb 100644
--- a/client/src/app/shared/instance/instance.service.ts
+++ b/client/src/app/shared/instance/instance.service.ts
@@ -1,4 +1,4 @@
1import { catchError } from 'rxjs/operators' 1import { catchError, map } 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 { environment } from '../../../environments/environment' 4import { environment } from '../../../environments/environment'
@@ -7,6 +7,7 @@ import { About } from '../../../../../shared/models/server'
7import { MarkdownService } from '@app/shared/renderer' 7import { MarkdownService } from '@app/shared/renderer'
8import { peertubeTranslate } from '@shared/models' 8import { peertubeTranslate } from '@shared/models'
9import { ServerService } from '@app/core' 9import { ServerService } from '@app/core'
10import { forkJoin } from 'rxjs'
10 11
11@Injectable() 12@Injectable()
12export class InstanceService { 13export class InstanceService {
@@ -57,25 +58,35 @@ export class InstanceService {
57 return html 58 return html
58 } 59 }
59 60
60 buildTranslatedLanguages (about: About, translations: any) { 61 buildTranslatedLanguages (about: About) {
61 const languagesArray = this.serverService.getVideoLanguages() 62 return forkJoin([
63 this.serverService.getVideoLanguages(),
64 this.serverService.getServerLocale()
65 ]).pipe(
66 map(([ languagesArray, translations ]) => {
67 return about.instance.languages
68 .map(l => {
69 const languageObj = languagesArray.find(la => la.id === l)
62 70
63 return about.instance.languages 71 return peertubeTranslate(languageObj.label, translations)
64 .map(l => { 72 })
65 const languageObj = languagesArray.find(la => la.id === l) 73 })
66 74 )
67 return peertubeTranslate(languageObj.label, translations)
68 })
69 } 75 }
70 76
71 buildTranslatedCategories (about: About, translations: any) { 77 buildTranslatedCategories (about: About) {
72 const categoriesArray = this.serverService.getVideoCategories() 78 return forkJoin([
73 79 this.serverService.getVideoCategories(),
74 return about.instance.categories 80 this.serverService.getServerLocale()
75 .map(c => { 81 ]).pipe(
76 const categoryObj = categoriesArray.find(ca => ca.id === c) 82 map(([ categoriesArray, translations ]) => {
83 return about.instance.categories
84 .map(c => {
85 const categoryObj = categoriesArray.find(ca => ca.id === c)
77 86
78 return peertubeTranslate(categoryObj.label, translations) 87 return peertubeTranslate(categoryObj.label, translations)
79 }) 88 })
89 })
90 )
80 } 91 }
81} 92}
diff --git a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts
index e9d4c1437..d82dc3d94 100644
--- a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts
+++ b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts
@@ -1,4 +1,4 @@
1import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' 1import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core'
2import { I18n } from '@ngx-translate/i18n-polyfill' 2import { I18n } from '@ngx-translate/i18n-polyfill'
3import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' 3import { DropdownAction } from '@app/shared/buttons/action-dropdown.component'
4import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component' 4import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component'
@@ -7,12 +7,13 @@ import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core'
7import { User, UserRight } from '../../../../../shared/models/users' 7import { User, UserRight } from '../../../../../shared/models/users'
8import { Account } from '@app/shared/account/account.model' 8import { Account } from '@app/shared/account/account.model'
9import { BlocklistService } from '@app/shared/blocklist' 9import { BlocklistService } from '@app/shared/blocklist'
10import { ServerConfig } from '@shared/models'
10 11
11@Component({ 12@Component({
12 selector: 'my-user-moderation-dropdown', 13 selector: 'my-user-moderation-dropdown',
13 templateUrl: './user-moderation-dropdown.component.html' 14 templateUrl: './user-moderation-dropdown.component.html'
14}) 15})
15export class UserModerationDropdownComponent implements OnChanges { 16export class UserModerationDropdownComponent implements OnInit, OnChanges {
16 @ViewChild('userBanModal', { static: false }) userBanModal: UserBanModalComponent 17 @ViewChild('userBanModal', { static: false }) userBanModal: UserBanModalComponent
17 18
18 @Input() user: User 19 @Input() user: User
@@ -26,6 +27,8 @@ export class UserModerationDropdownComponent implements OnChanges {
26 27
27 userActions: DropdownAction<{ user: User, account: Account }>[][] = [] 28 userActions: DropdownAction<{ user: User, account: Account }>[][] = []
28 29
30 private serverConfig: ServerConfig
31
29 constructor ( 32 constructor (
30 private authService: AuthService, 33 private authService: AuthService,
31 private notifier: Notifier, 34 private notifier: Notifier,
@@ -38,7 +41,13 @@ export class UserModerationDropdownComponent implements OnChanges {
38 ) { } 41 ) { }
39 42
40 get requiresEmailVerification () { 43 get requiresEmailVerification () {
41 return this.serverService.getConfig().signup.requiresEmailVerification 44 return this.serverConfig.signup.requiresEmailVerification
45 }
46
47 ngOnInit (): void {
48 this.serverConfig = this.serverService.getTmpConfig()
49 this.serverService.getConfig()
50 .subscribe(config => this.serverConfig = config)
42 } 51 }
43 52
44 ngOnChanges () { 53 ngOnChanges () {
diff --git a/client/src/app/shared/overview/overview.service.ts b/client/src/app/shared/overview/overview.service.ts
index bd4068925..79cb781f7 100644
--- a/client/src/app/shared/overview/overview.service.ts
+++ b/client/src/app/shared/overview/overview.service.ts
@@ -60,7 +60,7 @@ export class OverviewService {
60 .pipe( 60 .pipe(
61 // Translate categories 61 // Translate categories
62 switchMap(() => { 62 switchMap(() => {
63 return this.serverService.localeObservable 63 return this.serverService.getServerLocale()
64 .pipe( 64 .pipe(
65 tap(translations => { 65 tap(translations => {
66 for (const c of videosOverviewResult.categories) { 66 for (const c of videosOverviewResult.categories) {
diff --git a/client/src/app/shared/video-caption/video-caption.service.ts b/client/src/app/shared/video-caption/video-caption.service.ts
index 977f6253a..6bfe67435 100644
--- a/client/src/app/shared/video-caption/video-caption.service.ts
+++ b/client/src/app/shared/video-caption/video-caption.service.ts
@@ -22,7 +22,7 @@ export class VideoCaptionService {
22 return this.authHttp.get<ResultList<VideoCaption>>(VideoService.BASE_VIDEO_URL + videoId + '/captions') 22 return this.authHttp.get<ResultList<VideoCaption>>(VideoService.BASE_VIDEO_URL + videoId + '/captions')
23 .pipe( 23 .pipe(
24 switchMap(captionsResult => { 24 switchMap(captionsResult => {
25 return this.serverService.localeObservable 25 return this.serverService.getServerLocale()
26 .pipe(map(translations => ({ captionsResult, translations }))) 26 .pipe(map(translations => ({ captionsResult, translations })))
27 }), 27 }),
28 map(({ captionsResult, translations }) => { 28 map(({ captionsResult, translations }) => {
diff --git a/client/src/app/shared/video-import/video-import.service.ts b/client/src/app/shared/video-import/video-import.service.ts
index 7ae13154d..3e3fb7dfb 100644
--- a/client/src/app/shared/video-import/video-import.service.ts
+++ b/client/src/app/shared/video-import/video-import.service.ts
@@ -91,7 +91,7 @@ export class VideoImportService {
91 } 91 }
92 92
93 private extractVideoImports (result: ResultList<VideoImport>): Observable<ResultList<VideoImport>> { 93 private extractVideoImports (result: ResultList<VideoImport>): Observable<ResultList<VideoImport>> {
94 return this.serverService.localeObservable 94 return this.serverService.getServerLocale()
95 .pipe( 95 .pipe(
96 map(translations => { 96 map(translations => {
97 result.data.forEach(d => 97 result.data.forEach(d =>
diff --git a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts b/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts
index a8e5a4885..cd592eab0 100644
--- a/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts
+++ b/client/src/app/shared/video-playlist/video-playlist-element-miniature.component.ts
@@ -1,6 +1,6 @@
1import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core' 1import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
2import { Video } from '@app/shared/video/video.model' 2import { Video } from '@app/shared/video/video.model'
3import { VideoPlaylistElementType, VideoPlaylistElementUpdate } from '@shared/models' 3import { ServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate } from '@shared/models'
4import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core' 4import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core'
5import { ActivatedRoute } from '@angular/router' 5import { ActivatedRoute } from '@angular/router'
6import { I18n } from '@ngx-translate/i18n-polyfill' 6import { I18n } from '@ngx-translate/i18n-polyfill'
@@ -17,7 +17,7 @@ import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-
17 templateUrl: './video-playlist-element-miniature.component.html', 17 templateUrl: './video-playlist-element-miniature.component.html',
18 changeDetection: ChangeDetectionStrategy.OnPush 18 changeDetection: ChangeDetectionStrategy.OnPush
19}) 19})
20export class VideoPlaylistElementMiniatureComponent { 20export class VideoPlaylistElementMiniatureComponent implements OnInit {
21 @ViewChild('moreDropdown', { static: false }) moreDropdown: NgbDropdown 21 @ViewChild('moreDropdown', { static: false }) moreDropdown: NgbDropdown
22 22
23 @Input() playlist: VideoPlaylist 23 @Input() playlist: VideoPlaylist
@@ -39,6 +39,8 @@ export class VideoPlaylistElementMiniatureComponent {
39 stopTimestamp: number 39 stopTimestamp: number
40 } = {} as any 40 } = {} as any
41 41
42 private serverConfig: ServerConfig
43
42 constructor ( 44 constructor (
43 private authService: AuthService, 45 private authService: AuthService,
44 private serverService: ServerService, 46 private serverService: ServerService,
@@ -51,6 +53,15 @@ export class VideoPlaylistElementMiniatureComponent {
51 private cdr: ChangeDetectorRef 53 private cdr: ChangeDetectorRef
52 ) {} 54 ) {}
53 55
56 ngOnInit (): void {
57 this.serverConfig = this.serverService.getTmpConfig()
58 this.serverService.getConfig()
59 .subscribe(config => {
60 this.serverConfig = config
61 this.cdr.detectChanges()
62 })
63 }
64
54 isUnavailable (e: VideoPlaylistElement) { 65 isUnavailable (e: VideoPlaylistElement) {
55 return e.type === VideoPlaylistElementType.UNAVAILABLE 66 return e.type === VideoPlaylistElementType.UNAVAILABLE
56 } 67 }
@@ -80,7 +91,7 @@ export class VideoPlaylistElementMiniatureComponent {
80 } 91 }
81 92
82 isVideoBlur (video: Video) { 93 isVideoBlur (video: Video) {
83 return video.isVideoNSFWForUser(this.authService.getUser(), this.serverService.getConfig()) 94 return video.isVideoNSFWForUser(this.authService.getUser(), this.serverConfig)
84 } 95 }
85 96
86 removeFromPlaylist (playlistElement: VideoPlaylistElement) { 97 removeFromPlaylist (playlistElement: VideoPlaylistElement) {
diff --git a/client/src/app/shared/video-playlist/video-playlist.service.ts b/client/src/app/shared/video-playlist/video-playlist.service.ts
index 42791af86..2945b4959 100644
--- a/client/src/app/shared/video-playlist/video-playlist.service.ts
+++ b/client/src/app/shared/video-playlist/video-playlist.service.ts
@@ -173,7 +173,7 @@ export class VideoPlaylistService {
173 } 173 }
174 174
175 extractPlaylists (result: ResultList<VideoPlaylistServerModel>) { 175 extractPlaylists (result: ResultList<VideoPlaylistServerModel>) {
176 return this.serverService.localeObservable 176 return this.serverService.getServerLocale()
177 .pipe( 177 .pipe(
178 map(translations => { 178 map(translations => {
179 const playlistsJSON = result.data 179 const playlistsJSON = result.data
@@ -190,12 +190,12 @@ export class VideoPlaylistService {
190 } 190 }
191 191
192 extractPlaylist (playlist: VideoPlaylistServerModel) { 192 extractPlaylist (playlist: VideoPlaylistServerModel) {
193 return this.serverService.localeObservable 193 return this.serverService.getServerLocale()
194 .pipe(map(translations => new VideoPlaylist(playlist, translations))) 194 .pipe(map(translations => new VideoPlaylist(playlist, translations)))
195 } 195 }
196 196
197 extractVideoPlaylistElements (result: ResultList<ServerVideoPlaylistElement>) { 197 extractVideoPlaylistElements (result: ResultList<ServerVideoPlaylistElement>) {
198 return this.serverService.localeObservable 198 return this.serverService.getServerLocale()
199 .pipe( 199 .pipe(
200 map(translations => { 200 map(translations => {
201 const elementsJson = result.data 201 const elementsJson = result.data
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts
index 2926b179b..faeea27d9 100644
--- a/client/src/app/shared/video/abstract-video-list.ts
+++ b/client/src/app/shared/video/abstract-video-list.ts
@@ -13,7 +13,7 @@ import { Notifier, ServerService } from '@app/core'
13import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' 13import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook'
14import { I18n } from '@ngx-translate/i18n-polyfill' 14import { I18n } from '@ngx-translate/i18n-polyfill'
15import { isLastMonth, isLastWeek, isToday, isYesterday } from '@shared/core-utils/miscs/date' 15import { isLastMonth, isLastWeek, isToday, isYesterday } from '@shared/core-utils/miscs/date'
16import { ResultList } from '@shared/models' 16import { ResultList, ServerConfig } from '@shared/models'
17 17
18enum GroupDate { 18enum GroupDate {
19 UNKNOWN = 0, 19 UNKNOWN = 0,
@@ -61,6 +61,8 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
61 61
62 onDataSubject = new Subject<any[]>() 62 onDataSubject = new Subject<any[]>()
63 63
64 protected serverConfig: ServerConfig
65
64 protected abstract notifier: Notifier 66 protected abstract notifier: Notifier
65 protected abstract authService: AuthService 67 protected abstract authService: AuthService
66 protected abstract route: ActivatedRoute 68 protected abstract route: ActivatedRoute
@@ -85,6 +87,10 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
85 } 87 }
86 88
87 ngOnInit () { 89 ngOnInit () {
90 this.serverConfig = this.serverService.getTmpConfig()
91 this.serverService.getConfig()
92 .subscribe(config => this.serverConfig = config)
93
88 this.groupedDateLabels = { 94 this.groupedDateLabels = {
89 [GroupDate.UNKNOWN]: null, 95 [GroupDate.UNKNOWN]: null,
90 [GroupDate.TODAY]: this.i18n('Today'), 96 [GroupDate.TODAY]: this.i18n('Today'),
@@ -251,7 +257,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, DisableFor
251 } 257 }
252 258
253 let path = this.router.url 259 let path = this.router.url
254 if (!path || path === '/') path = this.serverService.getConfig().instance.defaultClientRoute 260 if (!path || path === '/') path = this.serverConfig.instance.defaultClientRoute
255 261
256 this.router.navigate([ path ], { queryParams, replaceUrl: true, queryParamsHandling: 'merge' }) 262 this.router.navigate([ path ], { queryParams, replaceUrl: true, queryParamsHandling: 'merge' })
257 } 263 }
diff --git a/client/src/app/shared/video/video-miniature.component.ts b/client/src/app/shared/video/video-miniature.component.ts
index d5c7dfd9b..9fffc7ddb 100644
--- a/client/src/app/shared/video/video-miniature.component.ts
+++ b/client/src/app/shared/video/video-miniature.component.ts
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, LOCALE
2import { User } from '../users' 2import { User } from '../users'
3import { Video } from './video.model' 3import { Video } from './video.model'
4import { ServerService } from '@app/core' 4import { ServerService } from '@app/core'
5import { VideoPrivacy, VideoState } from '../../../../../shared' 5import { ServerConfig, VideoPrivacy, VideoState } from '../../../../../shared'
6import { I18n } from '@ngx-translate/i18n-polyfill' 6import { I18n } from '@ngx-translate/i18n-polyfill'
7import { VideoActionsDisplayType } from '@app/shared/video/video-actions-dropdown.component' 7import { VideoActionsDisplayType } from '@app/shared/video/video-actions-dropdown.component'
8import { ScreenService } from '@app/shared/misc/screen.service' 8import { ScreenService } from '@app/shared/misc/screen.service'
@@ -55,6 +55,7 @@ export class VideoMiniatureComponent implements OnInit {
55 report: true 55 report: true
56 } 56 }
57 showActions = false 57 showActions = false
58 serverConfig: ServerConfig
58 59
59 private ownerDisplayTypeChosen: 'account' | 'videoChannel' 60 private ownerDisplayTypeChosen: 'account' | 'videoChannel'
60 61
@@ -66,10 +67,14 @@ export class VideoMiniatureComponent implements OnInit {
66 ) { } 67 ) { }
67 68
68 get isVideoBlur () { 69 get isVideoBlur () {
69 return this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig()) 70 return this.video.isVideoNSFWForUser(this.user, this.serverConfig)
70 } 71 }
71 72
72 ngOnInit () { 73 ngOnInit () {
74 this.serverConfig = this.serverService.getTmpConfig()
75 this.serverService.getConfig()
76 .subscribe(config => this.serverConfig = config)
77
73 this.setUpBy() 78 this.setUpBy()
74 79
75 // We rely on mouseenter to lazy load actions 80 // We rely on mouseenter to lazy load actions
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index b0fa55966..9adf46495 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -64,7 +64,7 @@ export class VideoService implements VideosProvider {
64 } 64 }
65 65
66 getVideo (options: { videoId: string }): Observable<VideoDetails> { 66 getVideo (options: { videoId: string }): Observable<VideoDetails> {
67 return this.serverService.localeObservable 67 return this.serverService.getServerLocale()
68 .pipe( 68 .pipe(
69 switchMap(translations => { 69 switchMap(translations => {
70 return this.authHttp.get<VideoDetailsServerModel>(VideoService.BASE_VIDEO_URL + options.videoId) 70 return this.authHttp.get<VideoDetailsServerModel>(VideoService.BASE_VIDEO_URL + options.videoId)
@@ -315,7 +315,7 @@ export class VideoService implements VideosProvider {
315 } 315 }
316 316
317 extractVideos (result: ResultList<VideoServerModel>) { 317 extractVideos (result: ResultList<VideoServerModel>) {
318 return this.serverService.localeObservable 318 return this.serverService.getServerLocale()
319 .pipe( 319 .pipe(
320 map(translations => { 320 map(translations => {
321 const videosJson = result.data 321 const videosJson = result.data