aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+about/about-instance/about-instance.component.ts13
-rw-r--r--client/src/app/+about/about-instance/about-instance.resolver.ts17
-rw-r--r--client/src/app/+about/about-instance/contact-admin-modal.component.ts8
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.ts2
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts4
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts8
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts4
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts4
-rw-r--r--client/src/app/+admin/moderation/moderation.component.ts5
-rw-r--r--client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts13
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.ts8
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.ts12
-rw-r--r--client/src/app/+admin/users/users.routes.ts5
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts6
-rw-r--r--client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts8
-rw-r--r--client/src/app/+my-library/my-library.component.ts9
-rw-r--r--client/src/app/+search/search-filters.component.ts9
-rw-r--r--client/src/app/+search/search.component.ts20
-rw-r--r--client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts12
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts4
-rw-r--r--client/src/app/+videos/+video-edit/shared/video-edit.component.ts9
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-send.ts8
-rw-r--r--client/src/app/+videos/+video-edit/video-add.component.ts9
-rw-r--r--client/src/app/+videos/+video-watch/recommendations/recent-videos-recommendation.service.ts10
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts35
-rw-r--r--client/src/app/+videos/video-list/trending/video-trending-header.component.ts30
-rw-r--r--client/src/app/app.component.ts121
-rw-r--r--client/src/app/app.module.ts2
-rw-r--r--client/src/app/core/menu/menu.service.ts4
-rw-r--r--client/src/app/core/routing/meta.service.ts4
-rw-r--r--client/src/app/core/routing/redirect.service.ts21
-rw-r--r--client/src/app/core/server/server.service.ts27
-rw-r--r--client/src/app/core/theme/theme.service.ts19
-rw-r--r--client/src/app/header/search-typeahead.component.ts22
-rw-r--r--client/src/app/menu/menu.component.ts19
-rw-r--r--client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts15
-rw-r--r--client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts15
-rw-r--r--client/src/app/shared/shared-forms/preview-upload.component.ts8
-rw-r--r--client/src/app/shared/shared-instance/instance-features-table.component.html2
-rw-r--r--client/src/app/shared/shared-instance/instance-features-table.component.ts1
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts6
-rw-r--r--client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts13
-rw-r--r--client/src/app/shared/shared-user-settings/user-interface-settings.component.ts8
-rw-r--r--client/src/app/shared/shared-user-settings/user-video-settings.component.ts6
-rw-r--r--client/src/app/shared/shared-video-miniature/abstract-video-list.ts8
-rw-r--r--client/src/app/shared/shared-video-miniature/video-miniature.component.ts12
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts11
47 files changed, 265 insertions, 351 deletions
diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts
index 5627aaa5a..f02048f39 100644
--- a/client/src/app/+about/about-instance/about-instance.component.ts
+++ b/client/src/app/+about/about-instance/about-instance.component.ts
@@ -2,10 +2,10 @@ import { ViewportScroller } from '@angular/common'
2import { AfterViewChecked, Component, ElementRef, OnInit, ViewChild } from '@angular/core' 2import { AfterViewChecked, Component, ElementRef, OnInit, ViewChild } from '@angular/core'
3import { ActivatedRoute } from '@angular/router' 3import { ActivatedRoute } from '@angular/router'
4import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component' 4import { ContactAdminModalComponent } from '@app/+about/about-instance/contact-admin-modal.component'
5import { Notifier } from '@app/core' 5import { Notifier, ServerService } from '@app/core'
6import { CustomMarkupService } from '@app/shared/shared-custom-markup' 6import { CustomMarkupService } from '@app/shared/shared-custom-markup'
7import { InstanceService } from '@app/shared/shared-instance' 7import { InstanceService } from '@app/shared/shared-instance'
8import { About, ServerConfig } from '@shared/models' 8import { About, HTMLServerConfig, ServerConfig } from '@shared/models'
9import { copyToClipboard } from '../../../root-helpers/utils' 9import { copyToClipboard } from '../../../root-helpers/utils'
10import { ResolverData } from './about-instance.resolver' 10import { ResolverData } from './about-instance.resolver'
11 11
@@ -35,16 +35,17 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked {
35 languages: string[] = [] 35 languages: string[] = []
36 categories: string[] = [] 36 categories: string[] = []
37 37
38 serverConfig: ServerConfig
39
40 initialized = false 38 initialized = false
41 39
40 private serverConfig: HTMLServerConfig
41
42 private lastScrollHash: string 42 private lastScrollHash: string
43 43
44 constructor ( 44 constructor (
45 private viewportScroller: ViewportScroller, 45 private viewportScroller: ViewportScroller,
46 private route: ActivatedRoute, 46 private route: ActivatedRoute,
47 private notifier: Notifier, 47 private notifier: Notifier,
48 private serverService: ServerService,
48 private instanceService: InstanceService 49 private instanceService: InstanceService
49 ) {} 50 ) {}
50 51
@@ -61,9 +62,9 @@ export class AboutInstanceComponent implements OnInit, AfterViewChecked {
61 } 62 }
62 63
63 async ngOnInit () { 64 async ngOnInit () {
64 const { about, languages, categories, serverConfig }: ResolverData = this.route.snapshot.data.instanceData 65 const { about, languages, categories }: ResolverData = this.route.snapshot.data.instanceData
65 66
66 this.serverConfig = serverConfig 67 this.serverConfig = this.serverService.getHTMLConfig()
67 68
68 this.languages = languages 69 this.languages = languages
69 this.categories = categories 70 this.categories = categories
diff --git a/client/src/app/+about/about-instance/about-instance.resolver.ts b/client/src/app/+about/about-instance/about-instance.resolver.ts
index 9a5924ebb..ee0219df0 100644
--- a/client/src/app/+about/about-instance/about-instance.resolver.ts
+++ b/client/src/app/+about/about-instance/about-instance.resolver.ts
@@ -1,30 +1,27 @@
1import { forkJoin } from 'rxjs' 1import { forkJoin } from 'rxjs'
2import { map, switchMap } from 'rxjs/operators' 2import { map, switchMap } from 'rxjs/operators'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { ActivatedRouteSnapshot, Resolve } from '@angular/router' 4import { Resolve } from '@angular/router'
5import { ServerService } from '@app/core'
6import { InstanceService } from '@app/shared/shared-instance' 5import { InstanceService } from '@app/shared/shared-instance'
7import { About, ServerConfig } from '@shared/models/server' 6import { About } from '@shared/models/server'
8 7
9export type ResolverData = { about: About, languages: string[], categories: string[], serverConfig: ServerConfig } 8export type ResolverData = { about: About, languages: string[], categories: string[] }
10 9
11@Injectable() 10@Injectable()
12export class AboutInstanceResolver implements Resolve<any> { 11export class AboutInstanceResolver implements Resolve<any> {
13 12
14 constructor ( 13 constructor (
15 private instanceService: InstanceService, 14 private instanceService: InstanceService
16 private serverService: ServerService
17 ) {} 15 ) {}
18 16
19 resolve (route: ActivatedRouteSnapshot) { 17 resolve () {
20 return this.instanceService.getAbout() 18 return this.instanceService.getAbout()
21 .pipe( 19 .pipe(
22 switchMap(about => { 20 switchMap(about => {
23 return forkJoin([ 21 return forkJoin([
24 this.instanceService.buildTranslatedLanguages(about), 22 this.instanceService.buildTranslatedLanguages(about),
25 this.instanceService.buildTranslatedCategories(about), 23 this.instanceService.buildTranslatedCategories(about)
26 this.serverService.getConfig() 24 ]).pipe(map(([ languages, categories ]) => ({ about, languages, categories }) as ResolverData))
27 ]).pipe(map(([ languages, categories, serverConfig ]) => ({ about, languages, categories, serverConfig })))
28 }) 25 })
29 ) 26 )
30 } 27 }
diff --git a/client/src/app/+about/about-instance/contact-admin-modal.component.ts b/client/src/app/+about/about-instance/contact-admin-modal.component.ts
index ac2a6c980..adbe7fe9a 100644
--- a/client/src/app/+about/about-instance/contact-admin-modal.component.ts
+++ b/client/src/app/+about/about-instance/contact-admin-modal.component.ts
@@ -11,7 +11,7 @@ import { InstanceService } from '@app/shared/shared-instance'
11import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 11import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
12import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' 12import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
13import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' 13import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
14import { ServerConfig } from '@shared/models' 14import { HTMLServerConfig } from '@shared/models'
15 15
16@Component({ 16@Component({
17 selector: 'my-contact-admin-modal', 17 selector: 'my-contact-admin-modal',
@@ -24,7 +24,7 @@ export class ContactAdminModalComponent extends FormReactive implements OnInit {
24 error: string 24 error: string
25 25
26 private openedModal: NgbModalRef 26 private openedModal: NgbModalRef
27 private serverConfig: ServerConfig 27 private serverConfig: HTMLServerConfig
28 28
29 constructor ( 29 constructor (
30 protected formValidatorService: FormValidatorService, 30 protected formValidatorService: FormValidatorService,
@@ -41,9 +41,7 @@ export class ContactAdminModalComponent extends FormReactive implements OnInit {
41 } 41 }
42 42
43 ngOnInit () { 43 ngOnInit () {
44 this.serverConfig = this.serverService.getTmpConfig() 44 this.serverConfig = this.serverService.getHTMLConfig()
45 this.serverService.getConfig()
46 .subscribe(config => this.serverConfig = config)
47 45
48 this.buildForm({ 46 this.buildForm({
49 fromName: FROM_NAME_VALIDATOR, 47 fromName: FROM_NAME_VALIDATOR,
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.ts
index 01ff022c5..79a98f288 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.ts
@@ -1,5 +1,3 @@
1
2import { SelectOptionsItem } from 'src/types/select-options-item.model'
3import { Component, Input } from '@angular/core' 1import { Component, Input } from '@angular/core'
4import { FormGroup } from '@angular/forms' 2import { FormGroup } from '@angular/forms'
5 3
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts
index 74fdb87a1..bac1015fc 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts
@@ -3,7 +3,7 @@ import { SelectOptionsItem } from 'src/types/select-options-item.model'
3import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' 3import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'
4import { FormGroup } from '@angular/forms' 4import { FormGroup } from '@angular/forms'
5import { MenuService } from '@app/core' 5import { MenuService } from '@app/core'
6import { ServerConfig } from '@shared/models' 6import { HTMLServerConfig } from '@shared/models'
7import { ConfigService } from '../shared/config.service' 7import { ConfigService } from '../shared/config.service'
8 8
9@Component({ 9@Component({
@@ -15,7 +15,7 @@ export class EditBasicConfigurationComponent implements OnInit, OnChanges {
15 @Input() form: FormGroup 15 @Input() form: FormGroup
16 @Input() formErrors: any 16 @Input() formErrors: any
17 17
18 @Input() serverConfig: ServerConfig 18 @Input() serverConfig: HTMLServerConfig
19 19
20 signupAlertMessage: string 20 signupAlertMessage: string
21 defaultLandingPageOptions: SelectOptionsItem[] = [] 21 defaultLandingPageOptions: SelectOptionsItem[] = []
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
index cb65ca6e7..1e8cfb021 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
@@ -27,7 +27,7 @@ import {
27import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators' 27import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators'
28import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 28import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
29import { CustomPageService } from '@app/shared/shared-main/custom-page' 29import { CustomPageService } from '@app/shared/shared-main/custom-page'
30import { CustomConfig, CustomPage, ServerConfig } from '@shared/models' 30import { CustomConfig, CustomPage, HTMLServerConfig } from '@shared/models'
31import { EditConfigurationService } from './edit-configuration.service' 31import { EditConfigurationService } from './edit-configuration.service'
32 32
33type ComponentCustomConfig = CustomConfig & { 33type ComponentCustomConfig = CustomConfig & {
@@ -43,7 +43,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
43 activeNav: string 43 activeNav: string
44 44
45 customConfig: ComponentCustomConfig 45 customConfig: ComponentCustomConfig
46 serverConfig: ServerConfig 46 serverConfig: HTMLServerConfig
47 47
48 homepage: CustomPage 48 homepage: CustomPage
49 49
@@ -64,9 +64,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
64 } 64 }
65 65
66 ngOnInit () { 66 ngOnInit () {
67 this.serverConfig = this.serverService.getTmpConfig() 67 this.serverConfig = this.serverService.getHTMLConfig()
68 this.serverService.getConfig()
69 .subscribe(config => this.serverConfig = config)
70 68
71 const formGroupData: { [key in keyof ComponentCustomConfig ]: any } = { 69 const formGroupData: { [key in keyof ComponentCustomConfig ]: any } = {
72 instance: { 70 instance: {
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts
index 72372ffac..d4892a571 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts
@@ -2,7 +2,7 @@
2import { SelectOptionsItem } from 'src/types/select-options-item.model' 2import { SelectOptionsItem } from 'src/types/select-options-item.model'
3import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' 3import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'
4import { FormGroup } from '@angular/forms' 4import { FormGroup } from '@angular/forms'
5import { ServerConfig } from '@shared/models' 5import { HTMLServerConfig } from '@shared/models'
6import { ConfigService } from '../shared/config.service' 6import { ConfigService } from '../shared/config.service'
7import { EditConfigurationService, ResolutionOption } from './edit-configuration.service' 7import { EditConfigurationService, ResolutionOption } from './edit-configuration.service'
8 8
@@ -14,7 +14,7 @@ import { EditConfigurationService, ResolutionOption } from './edit-configuration
14export class EditLiveConfigurationComponent implements OnInit, OnChanges { 14export class EditLiveConfigurationComponent implements OnInit, OnChanges {
15 @Input() form: FormGroup 15 @Input() form: FormGroup
16 @Input() formErrors: any 16 @Input() formErrors: any
17 @Input() serverConfig: ServerConfig 17 @Input() serverConfig: HTMLServerConfig
18 18
19 transcodingThreadOptions: SelectOptionsItem[] = [] 19 transcodingThreadOptions: SelectOptionsItem[] = []
20 transcodingProfiles: SelectOptionsItem[] = [] 20 transcodingProfiles: SelectOptionsItem[] = []
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts
index b017dd08c..3397c3dbd 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts
@@ -2,7 +2,7 @@
2import { SelectOptionsItem } from 'src/types/select-options-item.model' 2import { SelectOptionsItem } from 'src/types/select-options-item.model'
3import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' 3import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'
4import { FormGroup } from '@angular/forms' 4import { FormGroup } from '@angular/forms'
5import { ServerConfig } from '@shared/models' 5import { HTMLServerConfig } from '@shared/models'
6import { ConfigService } from '../shared/config.service' 6import { ConfigService } from '../shared/config.service'
7import { EditConfigurationService, ResolutionOption } from './edit-configuration.service' 7import { EditConfigurationService, ResolutionOption } from './edit-configuration.service'
8 8
@@ -14,7 +14,7 @@ import { EditConfigurationService, ResolutionOption } from './edit-configuration
14export class EditVODTranscodingComponent implements OnInit, OnChanges { 14export class EditVODTranscodingComponent implements OnInit, OnChanges {
15 @Input() form: FormGroup 15 @Input() form: FormGroup
16 @Input() formErrors: any 16 @Input() formErrors: any
17 @Input() serverConfig: ServerConfig 17 @Input() serverConfig: HTMLServerConfig
18 18
19 transcodingThreadOptions: SelectOptionsItem[] = [] 19 transcodingThreadOptions: SelectOptionsItem[] = []
20 transcodingProfiles: SelectOptionsItem[] = [] 20 transcodingProfiles: SelectOptionsItem[] = []
diff --git a/client/src/app/+admin/moderation/moderation.component.ts b/client/src/app/+admin/moderation/moderation.component.ts
index 85665ea4f..44dd11c47 100644
--- a/client/src/app/+admin/moderation/moderation.component.ts
+++ b/client/src/app/+admin/moderation/moderation.component.ts
@@ -13,7 +13,8 @@ export class ModerationComponent implements OnInit {
13 ) { } 13 ) { }
14 14
15 ngOnInit (): void { 15 ngOnInit (): void {
16 this.serverService.getConfig() 16 const serverConfig = this.serverService.getHTMLConfig()
17 .subscribe(config => this.autoBlockVideosEnabled = config.autoBlacklist.videos.ofUsers.enabled) 17
18 this.autoBlockVideosEnabled = serverConfig.autoBlacklist.videos.ofUsers.enabled
18 } 19 }
19} 20}
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
index 498d8321a..63143d0f9 100644
--- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
+++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts
@@ -107,13 +107,12 @@ export class VideoBlockListComponent extends RestTable implements OnInit {
107 } 107 }
108 108
109 ngOnInit () { 109 ngOnInit () {
110 this.serverService.getConfig() 110 const serverConfig = this.serverService.getHTMLConfig()
111 .subscribe(config => { 111
112 // don't filter if auto-blacklist is not enabled as this will be the only list 112 // Don't filter if auto-blacklist is not enabled as this will be the only list
113 if (config.autoBlacklist.videos.ofUsers.enabled) { 113 if (serverConfig.autoBlacklist.videos.ofUsers.enabled) {
114 this.blocklistTypeFilter = VideoBlacklistType.MANUAL 114 this.blocklistTypeFilter = VideoBlacklistType.MANUAL
115 } 115 }
116 })
117 116
118 this.initialize() 117 this.initialize()
119 } 118 }
diff --git a/client/src/app/+admin/users/user-edit/user-edit.ts b/client/src/app/+admin/users/user-edit/user-edit.ts
index 2fc3c5d3b..ae1f79ba0 100644
--- a/client/src/app/+admin/users/user-edit/user-edit.ts
+++ b/client/src/app/+admin/users/user-edit/user-edit.ts
@@ -3,7 +3,7 @@ import { ConfigService } from '@app/+admin/config/shared/config.service'
3import { AuthService, ScreenService, ServerService, User } from '@app/core' 3import { AuthService, ScreenService, ServerService, User } from '@app/core'
4import { FormReactive } from '@app/shared/shared-forms' 4import { FormReactive } from '@app/shared/shared-forms'
5import { USER_ROLE_LABELS } from '@shared/core-utils/users' 5import { USER_ROLE_LABELS } from '@shared/core-utils/users'
6import { ServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models' 6import { HTMLServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models'
7import { SelectOptionsItem } from '../../../../types/select-options-item.model' 7import { SelectOptionsItem } from '../../../../types/select-options-item.model'
8 8
9@Directive() 9@Directive()
@@ -16,7 +16,7 @@ export abstract class UserEdit extends FormReactive implements OnInit {
16 16
17 roles: { value: string, label: string }[] = [] 17 roles: { value: string, label: string }[] = []
18 18
19 protected serverConfig: ServerConfig 19 protected serverConfig: HTMLServerConfig
20 20
21 protected abstract serverService: ServerService 21 protected abstract serverService: ServerService
22 protected abstract configService: ConfigService 22 protected abstract configService: ConfigService
@@ -26,9 +26,7 @@ export abstract class UserEdit extends FormReactive implements OnInit {
26 abstract getFormButtonTitle (): string 26 abstract getFormButtonTitle (): string
27 27
28 ngOnInit (): void { 28 ngOnInit (): void {
29 this.serverConfig = this.serverService.getTmpConfig() 29 this.serverConfig = this.serverService.getHTMLConfig()
30 this.serverService.getConfig()
31 .subscribe(config => this.serverConfig = config)
32 30
33 this.buildRoles() 31 this.buildRoles()
34 } 32 }
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts
index 1c60adf89..e02d8e1ad 100644
--- a/client/src/app/+admin/users/user-list/user-list.component.ts
+++ b/client/src/app/+admin/users/user-list/user-list.component.ts
@@ -5,7 +5,7 @@ import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, Serve
5import { AdvancedInputFilter } from '@app/shared/shared-forms' 5import { AdvancedInputFilter } from '@app/shared/shared-forms'
6import { DropdownAction } from '@app/shared/shared-main' 6import { DropdownAction } from '@app/shared/shared-main'
7import { UserBanModalComponent } from '@app/shared/shared-moderation' 7import { UserBanModalComponent } from '@app/shared/shared-moderation'
8import { ServerConfig, User, UserRole } from '@shared/models' 8import { User, UserRole } from '@shared/models'
9 9
10type UserForList = User & { 10type UserForList = User & {
11 rawVideoQuota: number 11 rawVideoQuota: number
@@ -41,8 +41,9 @@ export class UserListComponent extends RestTable implements OnInit {
41 } 41 }
42 ] 42 ]
43 43
44 requiresEmailVerification = false
45
44 private _selectedColumns: string[] 46 private _selectedColumns: string[]
45 private serverConfig: ServerConfig
46 47
47 constructor ( 48 constructor (
48 protected route: ActivatedRoute, 49 protected route: ActivatedRoute,
@@ -60,10 +61,6 @@ export class UserListComponent extends RestTable implements OnInit {
60 return this.auth.getUser() 61 return this.auth.getUser()
61 } 62 }
62 63
63 get requiresEmailVerification () {
64 return this.serverConfig.signup.requiresEmailVerification
65 }
66
67 get selectedColumns () { 64 get selectedColumns () {
68 return this._selectedColumns 65 return this._selectedColumns
69 } 66 }
@@ -73,9 +70,8 @@ export class UserListComponent extends RestTable implements OnInit {
73 } 70 }
74 71
75 ngOnInit () { 72 ngOnInit () {
76 this.serverConfig = this.serverService.getTmpConfig()
77 this.serverService.getConfig() 73 this.serverService.getConfig()
78 .subscribe(config => this.serverConfig = config) 74 .subscribe(config => this.requiresEmailVerification = config.signup.requiresEmailVerification)
79 75
80 this.initialize() 76 this.initialize()
81 77
diff --git a/client/src/app/+admin/users/users.routes.ts b/client/src/app/+admin/users/users.routes.ts
index 5183498d6..9175be067 100644
--- a/client/src/app/+admin/users/users.routes.ts
+++ b/client/src/app/+admin/users/users.routes.ts
@@ -1,5 +1,5 @@
1import { Routes } from '@angular/router' 1import { Routes } from '@angular/router'
2import { ServerConfigResolver, UserRightGuard } from '@app/core' 2import { UserRightGuard } from '@app/core'
3import { UserRight } from '@shared/models' 3import { UserRight } from '@shared/models'
4import { UserCreateComponent, UserUpdateComponent } from './user-edit' 4import { UserCreateComponent, UserUpdateComponent } from './user-edit'
5import { UserListComponent } from './user-list' 5import { UserListComponent } from './user-list'
@@ -35,9 +35,6 @@ export const UsersRoutes: Routes = [
35 meta: { 35 meta: {
36 title: $localize`Create a user` 36 title: $localize`Create a user`
37 } 37 }
38 },
39 resolve: {
40 serverConfig: ServerConfigResolver
41 } 38 }
42 }, 39 },
43 { 40 {
diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts
index c7e173038..b94e6ad82 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts
@@ -60,10 +60,8 @@ export class MyAccountNotificationPreferencesComponent implements OnInit {
60 } 60 }
61 61
62 ngOnInit () { 62 ngOnInit () {
63 this.serverService.getConfig() 63 const serverConfig = this.serverService.getHTMLConfig()
64 .subscribe(config => { 64 this.emailEnabled = serverConfig.email.enabled
65 this.emailEnabled = config.email.enabled
66 })
67 65
68 this.userInformationLoaded.subscribe(() => this.loadNotificationSettings()) 66 this.userInformationLoaded.subscribe(() => this.loadNotificationSettings())
69 } 67 }
diff --git a/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts b/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts
index c9173039a..eb24a60c5 100644
--- a/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts
+++ b/client/src/app/+my-library/+my-video-channels/my-video-channel-update.component.ts
@@ -11,7 +11,7 @@ import {
11} from '@app/shared/form-validators/video-channel-validators' 11} from '@app/shared/form-validators/video-channel-validators'
12import { FormValidatorService } from '@app/shared/shared-forms' 12import { FormValidatorService } from '@app/shared/shared-forms'
13import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' 13import { VideoChannel, VideoChannelService } from '@app/shared/shared-main'
14import { ServerConfig, VideoChannelUpdate } from '@shared/models' 14import { HTMLServerConfig, VideoChannelUpdate } from '@shared/models'
15import { MyVideoChannelEdit } from './my-video-channel-edit' 15import { MyVideoChannelEdit } from './my-video-channel-edit'
16 16
17@Component({ 17@Component({
@@ -25,7 +25,7 @@ export class MyVideoChannelUpdateComponent extends MyVideoChannelEdit implements
25 25
26 private paramsSub: Subscription 26 private paramsSub: Subscription
27 private oldSupportField: string 27 private oldSupportField: string
28 private serverConfig: ServerConfig 28 private serverConfig: HTMLServerConfig
29 29
30 constructor ( 30 constructor (
31 protected formValidatorService: FormValidatorService, 31 protected formValidatorService: FormValidatorService,
@@ -40,9 +40,7 @@ export class MyVideoChannelUpdateComponent extends MyVideoChannelEdit implements
40 } 40 }
41 41
42 ngOnInit () { 42 ngOnInit () {
43 this.serverConfig = this.serverService.getTmpConfig() 43 this.serverConfig = this.serverService.getHTMLConfig()
44 this.serverService.getConfig()
45 .subscribe(config => this.serverConfig = config)
46 44
47 this.buildForm({ 45 this.buildForm({
48 'display-name': VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR, 46 'display-name': VIDEO_CHANNEL_DISPLAY_NAME_VALIDATOR,
diff --git a/client/src/app/+my-library/my-library.component.ts b/client/src/app/+my-library/my-library.component.ts
index 0cc91e484..939aa84c8 100644
--- a/client/src/app/+my-library/my-library.component.ts
+++ b/client/src/app/+my-library/my-library.component.ts
@@ -1,6 +1,6 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { AuthService, AuthUser, ScreenService, ServerService } from '@app/core' 2import { AuthService, AuthUser, ScreenService, ServerService } from '@app/core'
3import { ServerConfig } from '@shared/models' 3import { HTMLServerConfig } from '@shared/models'
4import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component' 4import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component'
5 5
6@Component({ 6@Component({
@@ -11,7 +11,8 @@ export class MyLibraryComponent implements OnInit {
11 menuEntries: TopMenuDropdownParam[] = [] 11 menuEntries: TopMenuDropdownParam[] = []
12 user: AuthUser 12 user: AuthUser
13 13
14 private serverConfig: ServerConfig 14
15 private serverConfig: HTMLServerConfig
15 16
16 constructor ( 17 constructor (
17 private serverService: ServerService, 18 private serverService: ServerService,
@@ -24,9 +25,7 @@ export class MyLibraryComponent implements OnInit {
24 } 25 }
25 26
26 ngOnInit (): void { 27 ngOnInit (): void {
27 this.serverConfig = this.serverService.getTmpConfig() 28 this.serverConfig = this.serverService.getHTMLConfig()
28 this.serverService.getConfig()
29 .subscribe(config => this.serverConfig = config)
30 29
31 this.user = this.authService.getUser() 30 this.user = this.authService.getUser()
32 31
diff --git a/client/src/app/+search/search-filters.component.ts b/client/src/app/+search/search-filters.component.ts
index 59aba22ff..f5f0c87ed 100644
--- a/client/src/app/+search/search-filters.component.ts
+++ b/client/src/app/+search/search-filters.component.ts
@@ -1,7 +1,7 @@
1import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' 1import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
2import { ServerService } from '@app/core' 2import { ServerService } from '@app/core'
3import { AdvancedSearch } from '@app/shared/shared-search' 3import { AdvancedSearch } from '@app/shared/shared-search'
4import { ServerConfig, VideoConstant } from '@shared/models' 4import { HTMLServerConfig, VideoConstant } from '@shared/models'
5 5
6type FormOption = { id: string, label: string } 6type FormOption = { id: string, label: string }
7 7
@@ -30,7 +30,7 @@ export class SearchFiltersComponent implements OnInit {
30 originallyPublishedStartYear: string 30 originallyPublishedStartYear: string
31 originallyPublishedEndYear: string 31 originallyPublishedEndYear: string
32 32
33 private serverConfig: ServerConfig 33 private serverConfig: HTMLServerConfig
34 34
35 constructor ( 35 constructor (
36 private serverService: ServerService 36 private serverService: ServerService
@@ -97,9 +97,8 @@ export class SearchFiltersComponent implements OnInit {
97 } 97 }
98 98
99 ngOnInit () { 99 ngOnInit () {
100 this.serverConfig = this.serverService.getTmpConfig() 100 this.serverConfig = this.serverService.getHTMLConfig()
101 this.serverService.getConfig() 101
102 .subscribe(config => this.serverConfig = config)
103 102
104 this.serverService.getVideoCategories().subscribe(categories => this.videoCategories = categories) 103 this.serverService.getVideoCategories().subscribe(categories => this.videoCategories = categories)
105 this.serverService.getVideoLicences().subscribe(licences => this.videoLicences = licences) 104 this.serverService.getVideoLicences().subscribe(licences => this.videoLicences = licences)
diff --git a/client/src/app/+search/search.component.ts b/client/src/app/+search/search.component.ts
index 4381659e1..a31096bb2 100644
--- a/client/src/app/+search/search.component.ts
+++ b/client/src/app/+search/search.component.ts
@@ -6,7 +6,7 @@ import { immutableAssign } from '@app/helpers'
6import { Video, VideoChannel } from '@app/shared/shared-main' 6import { Video, VideoChannel } from '@app/shared/shared-main'
7import { AdvancedSearch, SearchService } from '@app/shared/shared-search' 7import { AdvancedSearch, SearchService } from '@app/shared/shared-search'
8import { MiniatureDisplayOptions, VideoLinkType } from '@app/shared/shared-video-miniature' 8import { MiniatureDisplayOptions, VideoLinkType } from '@app/shared/shared-video-miniature'
9import { SearchTargetType, ServerConfig } from '@shared/models' 9import { HTMLServerConfig, SearchTargetType } from '@shared/models'
10 10
11@Component({ 11@Component({
12 selector: 'my-search', 12 selector: 'my-search',
@@ -37,7 +37,6 @@ export class SearchComponent implements OnInit, OnDestroy {
37 } 37 }
38 38
39 errorMessage: string 39 errorMessage: string
40 serverConfig: ServerConfig
41 40
42 userMiniature: User 41 userMiniature: User
43 42
@@ -49,6 +48,8 @@ export class SearchComponent implements OnInit, OnDestroy {
49 48
50 private lastSearchTarget: SearchTargetType 49 private lastSearchTarget: SearchTargetType
51 50
51 private serverConfig: HTMLServerConfig
52
52 constructor ( 53 constructor (
53 private route: ActivatedRoute, 54 private route: ActivatedRoute,
54 private router: Router, 55 private router: Router,
@@ -62,8 +63,7 @@ export class SearchComponent implements OnInit, OnDestroy {
62 ) { } 63 ) { }
63 64
64 ngOnInit () { 65 ngOnInit () {
65 this.serverService.getConfig() 66 this.serverConfig = this.serverService.getHTMLConfig()
66 .subscribe(config => this.serverConfig = config)
67 67
68 this.subActivatedRoute = this.route.queryParams.subscribe( 68 this.subActivatedRoute = this.route.queryParams.subscribe(
69 async queryParams => { 69 async queryParams => {
@@ -81,7 +81,7 @@ export class SearchComponent implements OnInit, OnDestroy {
81 81
82 this.advancedSearch = new AdvancedSearch(queryParams) 82 this.advancedSearch = new AdvancedSearch(queryParams)
83 if (!this.advancedSearch.searchTarget) { 83 if (!this.advancedSearch.searchTarget) {
84 this.advancedSearch.searchTarget = await this.serverService.getDefaultSearchTarget() 84 this.advancedSearch.searchTarget = this.getDefaultSearchTarget()
85 } 85 }
86 86
87 // Don't hide filters if we have some of them AND the user just came on the webpage 87 // Don't hide filters if we have some of them AND the user just came on the webpage
@@ -286,4 +286,14 @@ export class SearchComponent implements OnInit, OnDestroy {
286 'filter:api.search.video-channels.list.result' 286 'filter:api.search.video-channels.list.result'
287 ) 287 )
288 } 288 }
289
290 private getDefaultSearchTarget(): SearchTargetType {
291 const searchIndexConfig = this.serverConfig.search.searchIndex
292
293 if (searchIndexConfig.enabled && (searchIndexConfig.isDefaultSearch || searchIndexConfig.disableLocalSearch)) {
294 return 'search-index'
295 }
296
297 return 'local'
298 }
289} 299}
diff --git a/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts b/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts
index 830dd9962..afb0e6d6c 100644
--- a/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts
+++ b/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts
@@ -2,7 +2,6 @@ import { Component, OnInit } from '@angular/core'
2import { Notifier, RedirectService, ServerService, UserService } from '@app/core' 2import { Notifier, RedirectService, ServerService, UserService } from '@app/core'
3import { USER_EMAIL_VALIDATOR } from '@app/shared/form-validators/user-validators' 3import { USER_EMAIL_VALIDATOR } from '@app/shared/form-validators/user-validators'
4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
5import { ServerConfig } from '@shared/models'
6 5
7@Component({ 6@Component({
8 selector: 'my-verify-account-ask-send-email', 7 selector: 'my-verify-account-ask-send-email',
@@ -11,7 +10,7 @@ import { ServerConfig } from '@shared/models'
11}) 10})
12 11
13export class VerifyAccountAskSendEmailComponent extends FormReactive implements OnInit { 12export class VerifyAccountAskSendEmailComponent extends FormReactive implements OnInit {
14 private serverConfig: ServerConfig 13 requiresEmailVerification = false
15 14
16 constructor ( 15 constructor (
17 protected formValidatorService: FormValidatorService, 16 protected formValidatorService: FormValidatorService,
@@ -19,18 +18,13 @@ export class VerifyAccountAskSendEmailComponent extends FormReactive implements
19 private serverService: ServerService, 18 private serverService: ServerService,
20 private notifier: Notifier, 19 private notifier: Notifier,
21 private redirectService: RedirectService 20 private redirectService: RedirectService
22 ) { 21 ) {
23 super() 22 super()
24 } 23 }
25 24
26 get requiresEmailVerification () {
27 return this.serverConfig.signup.requiresEmailVerification
28 }
29
30 ngOnInit () { 25 ngOnInit () {
31 this.serverConfig = this.serverService.getTmpConfig()
32 this.serverService.getConfig() 26 this.serverService.getConfig()
33 .subscribe(config => this.serverConfig = config) 27 .subscribe(config => this.requiresEmailVerification = config.signup.requiresEmailVerification)
34 28
35 this.buildForm({ 29 this.buildForm({
36 'verify-email-email': USER_EMAIL_VALIDATOR 30 'verify-email-email': USER_EMAIL_VALIDATOR
diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts
index e48d16527..875911b91 100644
--- a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts
+++ b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.ts
@@ -4,7 +4,7 @@ import { VIDEO_CAPTION_FILE_VALIDATOR, VIDEO_CAPTION_LANGUAGE_VALIDATOR } from '
4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
5import { VideoCaptionEdit } from '@app/shared/shared-main' 5import { VideoCaptionEdit } from '@app/shared/shared-main'
6import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' 6import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
7import { ServerConfig, VideoConstant } from '@shared/models' 7import { HTMLServerConfig, VideoConstant } from '@shared/models'
8 8
9@Component({ 9@Component({
10 selector: 'my-video-caption-add-modal', 10 selector: 'my-video-caption-add-modal',
@@ -14,7 +14,7 @@ import { ServerConfig, VideoConstant } from '@shared/models'
14 14
15export class VideoCaptionAddModalComponent extends FormReactive implements OnInit { 15export class VideoCaptionAddModalComponent extends FormReactive implements OnInit {
16 @Input() existingCaptions: string[] 16 @Input() existingCaptions: string[]
17 @Input() serverConfig: ServerConfig 17 @Input() serverConfig: HTMLServerConfig
18 18
19 @Output() captionAdded = new EventEmitter<VideoCaptionEdit>() 19 @Output() captionAdded = new EventEmitter<VideoCaptionEdit>()
20 20
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts
index 3d916dbce..52801802b 100644
--- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts
+++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts
@@ -22,10 +22,10 @@ import { FormReactiveValidationMessages, FormValidatorService } from '@app/share
22import { InstanceService } from '@app/shared/shared-instance' 22import { InstanceService } from '@app/shared/shared-instance'
23import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main' 23import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main'
24import { 24import {
25 HTMLServerConfig,
25 LiveVideo, 26 LiveVideo,
26 RegisterClientFormFieldOptions, 27 RegisterClientFormFieldOptions,
27 RegisterClientVideoFieldOptions, 28 RegisterClientVideoFieldOptions,
28 ServerConfig,
29 VideoConstant, 29 VideoConstant,
30 VideoDetails, 30 VideoDetails,
31 VideoPrivacy 31 VideoPrivacy
@@ -84,7 +84,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
84 calendarTimezone: string 84 calendarTimezone: string
85 calendarDateFormat: string 85 calendarDateFormat: string
86 86
87 serverConfig: ServerConfig 87 serverConfig: HTMLServerConfig
88 88
89 pluginFields: PluginField[] = [] 89 pluginFields: PluginField[] = []
90 90
@@ -194,9 +194,8 @@ export class VideoEditComponent implements OnInit, OnDestroy {
194 } 194 }
195 }) 195 })
196 196
197 this.serverConfig = this.serverService.getTmpConfig() 197
198 this.serverService.getConfig() 198 this.serverConfig = this.serverService.getHTMLConfig()
199 .subscribe(config => this.serverConfig = config)
200 199
201 this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id) 200 this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id)
202 201
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-send.ts b/client/src/app/+videos/+video-edit/video-add-components/video-send.ts
index 3614499cd..a185892fe 100644
--- a/client/src/app/+videos/+video-edit/video-add-components/video-send.ts
+++ b/client/src/app/+videos/+video-edit/video-add-components/video-send.ts
@@ -6,7 +6,7 @@ import { listUserChannels } from '@app/helpers'
6import { FormReactive } from '@app/shared/shared-forms' 6import { FormReactive } from '@app/shared/shared-forms'
7import { VideoCaptionEdit, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' 7import { VideoCaptionEdit, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
8import { LoadingBarService } from '@ngx-loading-bar/core' 8import { LoadingBarService } from '@ngx-loading-bar/core'
9import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' 9import { HTMLServerConfig, VideoConstant, VideoPrivacy } from '@shared/models'
10 10
11@Directive() 11@Directive()
12// tslint:disable-next-line: directive-class-suffix 12// tslint:disable-next-line: directive-class-suffix
@@ -28,7 +28,7 @@ export abstract class VideoSend extends FormReactive implements OnInit {
28 protected serverService: ServerService 28 protected serverService: ServerService
29 protected videoService: VideoService 29 protected videoService: VideoService
30 protected videoCaptionService: VideoCaptionService 30 protected videoCaptionService: VideoCaptionService
31 protected serverConfig: ServerConfig 31 protected serverConfig: HTMLServerConfig
32 32
33 abstract canDeactivate (): CanComponentDeactivateResult 33 abstract canDeactivate (): CanComponentDeactivateResult
34 34
@@ -41,9 +41,7 @@ export abstract class VideoSend extends FormReactive implements OnInit {
41 this.firstStepChannelId = this.userVideoChannels[0].id 41 this.firstStepChannelId = this.userVideoChannels[0].id
42 }) 42 })
43 43
44 this.serverConfig = this.serverService.getTmpConfig() 44 this.serverConfig = this.serverService.getHTMLConfig()
45 this.serverService.getConfig()
46 .subscribe(config => this.serverConfig = config)
47 45
48 this.serverService.getVideoPrivacies() 46 this.serverService.getVideoPrivacies()
49 .subscribe( 47 .subscribe(
diff --git a/client/src/app/+videos/+video-edit/video-add.component.ts b/client/src/app/+videos/+video-edit/video-add.component.ts
index d735c936c..8606b8222 100644
--- a/client/src/app/+videos/+video-edit/video-add.component.ts
+++ b/client/src/app/+videos/+video-edit/video-add.component.ts
@@ -1,7 +1,7 @@
1import { Component, HostListener, OnInit, ViewChild } from '@angular/core' 1import { Component, HostListener, OnInit, ViewChild } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 2import { ActivatedRoute, Router } from '@angular/router'
3import { AuthService, AuthUser, CanComponentDeactivate, ServerService } from '@app/core' 3import { AuthService, AuthUser, CanComponentDeactivate, ServerService } from '@app/core'
4import { ServerConfig } from '@shared/models' 4import { HTMLServerConfig } from '@shared/models'
5import { VideoEditType } from './shared/video-edit.type' 5import { VideoEditType } from './shared/video-edit.type'
6import { VideoGoLiveComponent } from './video-add-components/video-go-live.component' 6import { VideoGoLiveComponent } from './video-add-components/video-go-live.component'
7import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component' 7import { VideoImportTorrentComponent } from './video-add-components/video-import-torrent.component'
@@ -26,7 +26,7 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
26 26
27 activeNav: string 27 activeNav: string
28 28
29 private serverConfig: ServerConfig 29 private serverConfig: HTMLServerConfig
30 30
31 constructor ( 31 constructor (
32 private auth: AuthService, 32 private auth: AuthService,
@@ -42,10 +42,7 @@ export class VideoAddComponent implements OnInit, CanComponentDeactivate {
42 ngOnInit () { 42 ngOnInit () {
43 this.user = this.auth.getUser() 43 this.user = this.auth.getUser()
44 44
45 this.serverConfig = this.serverService.getTmpConfig() 45 this.serverConfig = this.serverService.getHTMLConfig()
46
47 this.serverService.getConfig()
48 .subscribe(config => this.serverConfig = config)
49 46
50 this.user = this.auth.getUser() 47 this.user = this.auth.getUser()
51 48
diff --git a/client/src/app/+videos/+video-watch/recommendations/recent-videos-recommendation.service.ts b/client/src/app/+videos/+video-watch/recommendations/recent-videos-recommendation.service.ts
index 2a851f13a..4654da847 100644
--- a/client/src/app/+videos/+video-watch/recommendations/recent-videos-recommendation.service.ts
+++ b/client/src/app/+videos/+video-watch/recommendations/recent-videos-recommendation.service.ts
@@ -4,7 +4,7 @@ import { Injectable } from '@angular/core'
4import { ServerService, UserService } from '@app/core' 4import { ServerService, UserService } from '@app/core'
5import { Video, VideoService } from '@app/shared/shared-main' 5import { Video, VideoService } from '@app/shared/shared-main'
6import { AdvancedSearch, SearchService } from '@app/shared/shared-search' 6import { AdvancedSearch, SearchService } from '@app/shared/shared-search'
7import { ServerConfig } from '@shared/models' 7import { HTMLServerConfig } from '@shared/models'
8import { RecommendationInfo } from './recommendation-info.model' 8import { RecommendationInfo } from './recommendation-info.model'
9import { RecommendationService } from './recommendations.service' 9import { RecommendationService } from './recommendations.service'
10 10
@@ -15,7 +15,7 @@ import { RecommendationService } from './recommendations.service'
15export class RecentVideosRecommendationService implements RecommendationService { 15export class RecentVideosRecommendationService implements RecommendationService {
16 readonly pageSize = 5 16 readonly pageSize = 5
17 17
18 private config: ServerConfig 18 private config: HTMLServerConfig
19 19
20 constructor ( 20 constructor (
21 private videos: VideoService, 21 private videos: VideoService,
@@ -23,13 +23,11 @@ export class RecentVideosRecommendationService implements RecommendationService
23 private userService: UserService, 23 private userService: UserService,
24 private serverService: ServerService 24 private serverService: ServerService
25 ) { 25 ) {
26 this.config = this.serverService.getTmpConfig() 26 this.config = this.serverService.getHTMLConfig()
27
28 this.serverService.getConfig()
29 .subscribe(config => this.config = config)
30 } 27 }
31 28
32 getRecommendations (recommendation: RecommendationInfo): Observable<Video[]> { 29 getRecommendations (recommendation: RecommendationInfo): Observable<Video[]> {
30
33 return this.fetchPage(1, recommendation) 31 return this.fetchPage(1, recommendation)
34 .pipe( 32 .pipe(
35 map(videos => { 33 map(videos => {
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts
index 540b568ed..51d486ea5 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -28,7 +28,15 @@ import { VideoActionsDisplayType, VideoDownloadComponent } from '@app/shared/sha
28import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' 28import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
29import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' 29import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
30import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' 30import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
31import { PeerTubeProblemDocument, ServerConfig, ServerErrorCode, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models' 31import {
32 HTMLServerConfig,
33 PeerTubeProblemDocument,
34 ServerErrorCode,
35 UserVideoRateType,
36 VideoCaption,
37 VideoPrivacy,
38 VideoState
39} from '@shared/models'
32import { 40import {
33 cleanupVideoWatch, 41 cleanupVideoWatch,
34 getStoredP2PEnabled, 42 getStoredP2PEnabled,
@@ -116,7 +124,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
116 private configSub: Subscription 124 private configSub: Subscription
117 private liveVideosSub: Subscription 125 private liveVideosSub: Subscription
118 126
119 private serverConfig: ServerConfig 127 private serverConfig: HTMLServerConfig
120 128
121 constructor ( 129 constructor (
122 private elementRef: ElementRef, 130 private elementRef: ElementRef,
@@ -163,21 +171,16 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
163 171
164 PeertubePlayerManager.initState() 172 PeertubePlayerManager.initState()
165 173
166 this.serverConfig = this.serverService.getTmpConfig() 174 this.serverConfig = this.serverService.getHTMLConfig()
167 175 if (
168 this.configSub = this.serverService.getConfig() 176 isWebRTCDisabled() ||
169 .subscribe(config => { 177 this.serverConfig.tracker.enabled === false ||
170 this.serverConfig = config 178 getStoredP2PEnabled() === false ||
179 peertubeLocalStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'
180 ) {
181 this.hasAlreadyAcceptedPrivacyConcern = true
182 }
171 183
172 if (
173 isWebRTCDisabled() ||
174 this.serverConfig.tracker.enabled === false ||
175 getStoredP2PEnabled() === false ||
176 peertubeLocalStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'
177 ) {
178 this.hasAlreadyAcceptedPrivacyConcern = true
179 }
180 })
181 184
182 this.paramsSub = this.route.params.subscribe(routeParams => { 185 this.paramsSub = this.route.params.subscribe(routeParams => {
183 const videoId = routeParams[ 'videoId' ] 186 const videoId = routeParams[ 'videoId' ]
diff --git a/client/src/app/+videos/video-list/trending/video-trending-header.component.ts b/client/src/app/+videos/video-list/trending/video-trending-header.component.ts
index bbb02a236..6c2b32a4f 100644
--- a/client/src/app/+videos/video-list/trending/video-trending-header.component.ts
+++ b/client/src/app/+videos/video-list/trending/video-trending-header.component.ts
@@ -1,10 +1,10 @@
1import { Subscription } from 'rxjs'
1import { Component, HostBinding, Inject, OnDestroy, OnInit } from '@angular/core' 2import { Component, HostBinding, Inject, OnDestroy, OnInit } from '@angular/core'
2import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
3import { VideoListHeaderComponent } from '@app/shared/shared-video-miniature'
4import { GlobalIconName } from '@app/shared/shared-icons'
5import { ServerService } from '@app/core/server/server.service'
6import { Subscription } from 'rxjs'
7import { AuthService, RedirectService } from '@app/core' 4import { AuthService, RedirectService } from '@app/core'
5import { ServerService } from '@app/core/server/server.service'
6import { GlobalIconName } from '@app/shared/shared-icons'
7import { VideoListHeaderComponent } from '@app/shared/shared-video-miniature'
8 8
9interface VideoTrendingHeaderItem { 9interface VideoTrendingHeaderItem {
10 label: string 10 label: string
@@ -67,21 +67,19 @@ export class VideoTrendingHeaderComponent extends VideoListHeaderComponent imple
67 } 67 }
68 68
69 ngOnInit () { 69 ngOnInit () {
70 this.serverService.getConfig() 70 const serverConfig = this.serverService.getHTMLConfig()
71 .subscribe(config => { 71 const algEnabled = serverConfig.trending.videos.algorithms.enabled
72 const algEnabled = config.trending.videos.algorithms.enabled
73 72
74 this.buttons = this.buttons.map(b => { 73 this.buttons = this.buttons.map(b => {
75 b.hidden = !algEnabled.includes(b.value) 74 b.hidden = !algEnabled.includes(b.value)
76 75
77 // Best is adapted by the user history so 76 // Best is adapted by the user history so
78 if (b.value === 'best' && !this.auth.isLoggedIn()) { 77 if (b.value === 'best' && !this.auth.isLoggedIn()) {
79 b.hidden = true 78 b.hidden = true
80 } 79 }
81 80
82 return b 81 return b
83 }) 82 })
84 })
85 83
86 this.algorithmChangeSub = this.route.queryParams.subscribe( 84 this.algorithmChangeSub = this.route.queryParams.subscribe(
87 queryParams => { 85 queryParams => {
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 863c3f3b5..6884068f6 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,6 +1,6 @@
1import { Hotkey, HotkeysService } from 'angular2-hotkeys' 1import { Hotkey, HotkeysService } from 'angular2-hotkeys'
2import { concat } from 'rxjs' 2import { concat } from 'rxjs'
3import { filter, first, map, pairwise } from 'rxjs/operators' 3import { filter, first, map, pairwise, switchMap } from 'rxjs/operators'
4import { DOCUMENT, PlatformLocation, ViewportScroller } from '@angular/common' 4import { DOCUMENT, PlatformLocation, ViewportScroller } from '@angular/common'
5import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core' 5import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core'
6import { DomSanitizer, SafeHtml } from '@angular/platform-browser' 6import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
@@ -15,7 +15,7 @@ import { NgbConfig, NgbModal } from '@ng-bootstrap/ng-bootstrap'
15import { LoadingBarService } from '@ngx-loading-bar/core' 15import { LoadingBarService } from '@ngx-loading-bar/core'
16import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' 16import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
17import { getShortLocale, is18nPath } from '@shared/core-utils/i18n' 17import { getShortLocale, is18nPath } from '@shared/core-utils/i18n'
18import { BroadcastMessageLevel, ServerConfig, UserRole } from '@shared/models' 18import { BroadcastMessageLevel, HTMLServerConfig, ServerConfig, UserRole } from '@shared/models'
19import { MenuService } from './core/menu/menu.service' 19import { MenuService } from './core/menu/menu.service'
20import { POP_STATE_MODAL_DISMISS } from './helpers' 20import { POP_STATE_MODAL_DISMISS } from './helpers'
21import { InstanceService } from './shared/shared-instance' 21import { InstanceService } from './shared/shared-instance'
@@ -35,7 +35,7 @@ export class AppComponent implements OnInit, AfterViewInit {
35 customCSS: SafeHtml 35 customCSS: SafeHtml
36 broadcastMessage: { message: string, dismissable: boolean, class: string } | null = null 36 broadcastMessage: { message: string, dismissable: boolean, class: string } | null = null
37 37
38 private serverConfig: ServerConfig 38 private serverConfig: HTMLServerConfig
39 39
40 constructor ( 40 constructor (
41 @Inject(DOCUMENT) private document: Document, 41 @Inject(DOCUMENT) private document: Document,
@@ -73,9 +73,7 @@ export class AppComponent implements OnInit, AfterViewInit {
73 ngOnInit () { 73 ngOnInit () {
74 document.getElementById('incompatible-browser').className += ' browser-ok' 74 document.getElementById('incompatible-browser').className += ' browser-ok'
75 75
76 this.serverConfig = this.serverService.getTmpConfig() 76 this.serverConfig = this.serverService.getHTMLConfig()
77 this.serverService.getConfig()
78 .subscribe(config => this.serverConfig = config)
79 77
80 this.loadPlugins() 78 this.loadPlugins()
81 this.themeService.initialize() 79 this.themeService.initialize()
@@ -88,10 +86,21 @@ export class AppComponent implements OnInit, AfterViewInit {
88 } 86 }
89 87
90 this.initRouteEvents() 88 this.initRouteEvents()
89
91 this.injectJS() 90 this.injectJS()
92 this.injectCSS() 91 this.injectCSS()
93 this.injectBroadcastMessage() 92 this.injectBroadcastMessage()
94 93
94 this.serverService.configReloaded
95 .subscribe(config => {
96 this.serverConfig = config
97
98 this.injectBroadcastMessage()
99 this.injectCSS()
100
101 // Don't reinject JS since it could conflict with existing one
102 })
103
95 this.initHotkeys() 104 this.initHotkeys()
96 105
97 this.location.onPopState(() => this.modalService.dismissAll(POP_STATE_MODAL_DISMISS)) 106 this.location.onPopState(() => this.modalService.dismissAll(POP_STATE_MODAL_DISMISS))
@@ -208,69 +217,55 @@ export class AppComponent implements OnInit, AfterViewInit {
208 ).subscribe(() => this.loadingBar.useRef().complete()) 217 ).subscribe(() => this.loadingBar.useRef().complete())
209 } 218 }
210 219
211 private injectBroadcastMessage () { 220 private async injectBroadcastMessage () {
212 concat( 221 this.broadcastMessage = null
213 this.serverService.getConfig().pipe(first()), 222 this.screenService.isBroadcastMessageDisplayed = false
214 this.serverService.configReloaded
215 ).subscribe(async config => {
216 this.broadcastMessage = null
217 this.screenService.isBroadcastMessageDisplayed = false
218
219 const messageConfig = config.broadcastMessage
220 223
221 if (messageConfig.enabled) { 224 const messageConfig = this.serverConfig.broadcastMessage
222 // Already dismissed this message?
223 if (messageConfig.dismissable && localStorage.getItem(AppComponent.BROADCAST_MESSAGE_KEY) === messageConfig.message) {
224 return
225 }
226 225
227 const classes: { [id in BroadcastMessageLevel]: string } = { 226 if (messageConfig.enabled) {
228 info: 'alert-info', 227 // Already dismissed this message?
229 warning: 'alert-warning', 228 if (messageConfig.dismissable && localStorage.getItem(AppComponent.BROADCAST_MESSAGE_KEY) === messageConfig.message) {
230 error: 'alert-danger' 229 return
231 } 230 }
232 231
233 this.broadcastMessage = { 232 const classes: { [id in BroadcastMessageLevel]: string } = {
234 message: await this.markdownService.unsafeMarkdownToHTML(messageConfig.message, true), 233 info: 'alert-info',
235 dismissable: messageConfig.dismissable, 234 warning: 'alert-warning',
236 class: classes[messageConfig.level] 235 error: 'alert-danger'
237 } 236 }
238 237
239 this.screenService.isBroadcastMessageDisplayed = true 238 this.broadcastMessage = {
239 message: await this.markdownService.unsafeMarkdownToHTML(messageConfig.message, true),
240 dismissable: messageConfig.dismissable,
241 class: classes[messageConfig.level]
240 } 242 }
241 }) 243
244 this.screenService.isBroadcastMessageDisplayed = true
245 }
242 } 246 }
243 247
244 private injectJS () { 248 private injectJS () {
245 // Inject JS 249 // Inject JS
246 this.serverService.getConfig() 250 if (this.serverConfig.instance.customizations.javascript) {
247 .subscribe(config => { 251 try {
248 if (config.instance.customizations.javascript) { 252 // tslint:disable:no-eval
249 try { 253 eval(this.serverConfig.instance.customizations.javascript)
250 // tslint:disable:no-eval 254 } catch (err) {
251 eval(config.instance.customizations.javascript) 255 console.error('Cannot eval custom JavaScript.', err)
252 } catch (err) { 256 }
253 console.error('Cannot eval custom JavaScript.', err) 257 }
254 }
255 }
256 })
257 } 258 }
258 259
259 private injectCSS () { 260 private injectCSS () {
260 // Inject CSS if modified (admin config settings) 261 const headStyle = document.querySelector('style.custom-css-style')
261 concat( 262 if (headStyle) headStyle.parentNode.removeChild(headStyle)
262 this.serverService.getConfig().pipe(first()), 263
263 this.serverService.configReloaded 264 // We test customCSS if the admin removed the css
264 ).subscribe(config => { 265 if (this.customCSS || this.serverConfig.instance.customizations.css) {
265 const headStyle = document.querySelector('style.custom-css-style') 266 const styleTag = '<style>' + this.serverConfig.instance.customizations.css + '</style>'
266 if (headStyle) headStyle.parentNode.removeChild(headStyle) 267 this.customCSS = this.domSanitizer.bypassSecurityTrustHtml(styleTag)
267 268 }
268 // We test customCSS if the admin removed the css
269 if (this.customCSS || config.instance.customizations.css) {
270 const styleTag = '<style>' + config.instance.customizations.css + '</style>'
271 this.customCSS = this.domSanitizer.bypassSecurityTrustHtml(styleTag)
272 }
273 })
274 } 269 }
275 270
276 private async loadPlugins () { 271 private async loadPlugins () {
@@ -283,14 +278,18 @@ export class AppComponent implements OnInit, AfterViewInit {
283 this.authService.userInformationLoaded 278 this.authService.userInformationLoaded
284 .pipe( 279 .pipe(
285 map(() => this.authService.getUser()), 280 map(() => this.authService.getUser()),
286 filter(user => user.role === UserRole.ADMINISTRATOR) 281 filter(user => user.role === UserRole.ADMINISTRATOR),
287 ).subscribe(user => setTimeout(() => this._openAdminModalsIfNeeded(user))) // setTimeout because of ngIf in template 282 switchMap(user => {
283 return this.serverService.getConfig()
284 .pipe(map(serverConfig => ({ serverConfig, user })))
285 })
286 ).subscribe(({ serverConfig, user }) => this._openAdminModalsIfNeeded(serverConfig, user))
288 } 287 }
289 288
290 private async _openAdminModalsIfNeeded (user: User) { 289 private async _openAdminModalsIfNeeded (serverConfig: ServerConfig, user: User) {
291 if (user.noWelcomeModal !== true) return this.welcomeModal.show() 290 if (user.noWelcomeModal !== true) return this.welcomeModal.show()
292 291
293 if (user.noInstanceConfigWarningModal === true || !this.serverConfig.signup.allowed) return 292 if (user.noInstanceConfigWarningModal === true || !serverConfig.signup.allowed) return
294 293
295 this.instanceService.getAbout() 294 this.instanceService.getAbout()
296 .subscribe(about => { 295 .subscribe(about => {
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts
index 8fc054d79..ea53818e1 100644
--- a/client/src/app/app.module.ts
+++ b/client/src/app/app.module.ts
@@ -27,7 +27,7 @@ import { SharedUserInterfaceSettingsModule } from './shared/shared-user-settings
27registerLocaleData(localeOc, 'oc') 27registerLocaleData(localeOc, 'oc')
28 28
29export function loadConfigFactory (server: ServerService) { 29export function loadConfigFactory (server: ServerService) {
30 return () => server.loadConfig() 30 return () => server.loadHTMLConfig()
31} 31}
32 32
33@NgModule({ 33@NgModule({
diff --git a/client/src/app/core/menu/menu.service.ts b/client/src/app/core/menu/menu.service.ts
index 4e00d0bce..a30766b29 100644
--- a/client/src/app/core/menu/menu.service.ts
+++ b/client/src/app/core/menu/menu.service.ts
@@ -3,7 +3,7 @@ import { 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 { sortObjectComparator } from '@shared/core-utils/miscs/miscs' 5import { sortObjectComparator } from '@shared/core-utils/miscs/miscs'
6import { ServerConfig } from '@shared/models/server' 6import { HTMLServerConfig } from '@shared/models/server'
7import { ScreenService } from '../wrappers' 7import { ScreenService } from '../wrappers'
8 8
9export type MenuLink = { 9export type MenuLink = {
@@ -59,7 +59,7 @@ export class MenuService {
59 this.isMenuDisplayed = window.innerWidth >= 800 && !this.isMenuChangedByUser 59 this.isMenuDisplayed = window.innerWidth >= 800 && !this.isMenuChangedByUser
60 } 60 }
61 61
62 buildCommonLinks (config: ServerConfig) { 62 buildCommonLinks (config: HTMLServerConfig) {
63 let entries: MenuLink[] = [ 63 let entries: MenuLink[] = [
64 { 64 {
65 icon: 'globe' as 'globe', 65 icon: 'globe' as 'globe',
diff --git a/client/src/app/core/routing/meta.service.ts b/client/src/app/core/routing/meta.service.ts
index a5ac778dc..97e440faf 100644
--- a/client/src/app/core/routing/meta.service.ts
+++ b/client/src/app/core/routing/meta.service.ts
@@ -16,9 +16,7 @@ export class MetaService {
16 private meta: Meta, 16 private meta: Meta,
17 private server: ServerService 17 private server: ServerService
18 ) { 18 ) {
19 this.config = this.server.getTmpConfig() 19 this.config = this.server.getHTMLConfig()
20 this.server.getConfig()
21 .subscribe(config => this.config = config)
22 } 20 }
23 21
24 setTitle (subTitle?: string) { 22 setTitle (subTitle?: string) {
diff --git a/client/src/app/core/routing/redirect.service.ts b/client/src/app/core/routing/redirect.service.ts
index cf690a4d0..198332b00 100644
--- a/client/src/app/core/routing/redirect.service.ts
+++ b/client/src/app/core/routing/redirect.service.ts
@@ -20,24 +20,14 @@ export class RedirectService {
20 private serverService: ServerService 20 private serverService: ServerService
21 ) { 21 ) {
22 // The config is first loaded from the cache so try to get the default route 22 // The config is first loaded from the cache so try to get the default route
23 const tmpConfig = this.serverService.getTmpConfig() 23 const config = this.serverService.getHTMLConfig()
24 if (tmpConfig?.instance?.defaultClientRoute) { 24 if (config?.instance?.defaultClientRoute) {
25 this.defaultRoute = tmpConfig.instance.defaultClientRoute 25 this.defaultRoute = config.instance.defaultClientRoute
26 } 26 }
27 if (tmpConfig?.trending?.videos?.algorithms?.default) { 27 if (config?.trending?.videos?.algorithms?.default) {
28 this.defaultTrendingAlgorithm = tmpConfig.trending.videos.algorithms.default 28 this.defaultTrendingAlgorithm = config.trending.videos.algorithms.default
29 } 29 }
30 30
31 // Load default route
32 this.serverService.getConfig()
33 .subscribe(config => {
34 const defaultRouteConfig = config.instance.defaultClientRoute
35 const defaultTrendingConfig = config.trending.videos.algorithms.default
36
37 if (defaultRouteConfig) this.defaultRoute = defaultRouteConfig
38 if (defaultTrendingConfig) this.defaultTrendingAlgorithm = defaultTrendingConfig
39 })
40
41 // Track previous url 31 // Track previous url
42 this.currentUrl = this.router.url 32 this.currentUrl = this.router.url
43 router.events.subscribe(event => { 33 router.events.subscribe(event => {
@@ -52,6 +42,7 @@ export class RedirectService {
52 return this.defaultRoute 42 return this.defaultRoute
53 } 43 }
54 44
45
55 getDefaultTrendingAlgorithm () { 46 getDefaultTrendingAlgorithm () {
56 return this.defaultTrendingAlgorithm 47 return this.defaultTrendingAlgorithm
57 } 48 }
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts
index 251963858..8f041a147 100644
--- a/client/src/app/core/server/server.service.ts
+++ b/client/src/app/core/server/server.service.ts
@@ -37,9 +37,9 @@ export class ServerService {
37 ) { 37 ) {
38 } 38 }
39 39
40 loadConfig () { 40 loadHTMLConfig () {
41 try { 41 try {
42 return this.loadConfigLocally() 42 return this.loadHTMLConfigLocally()
43 } catch (err) { 43 } catch (err) {
44 // Expected in dev mode since we can't inject the config in the HTML 44 // Expected in dev mode since we can't inject the config in the HTML
45 if (environment.production !== false) { 45 if (environment.production !== false) {
@@ -76,6 +76,7 @@ export class ServerService {
76 .pipe( 76 .pipe(
77 tap(config => { 77 tap(config => {
78 this.config = config 78 this.config = config
79 this.htmlConfig = config
79 this.configLoaded = true 80 this.configLoaded = true
80 }), 81 }),
81 tap(config => { 82 tap(config => {
@@ -91,8 +92,8 @@ export class ServerService {
91 return this.configObservable 92 return this.configObservable
92 } 93 }
93 94
94 getTmpConfig () { 95 getHTMLConfig () {
95 return this.config 96 return this.htmlConfig
96 } 97 }
97 98
98 getVideoCategories () { 99 getVideoCategories () {
@@ -156,20 +157,6 @@ export class ServerService {
156 return this.http.get<ServerStats>(ServerService.BASE_STATS_URL) 157 return this.http.get<ServerStats>(ServerService.BASE_STATS_URL)
157 } 158 }
158 159
159 getDefaultSearchTarget (): Promise<SearchTargetType> {
160 return this.getConfig().pipe(
161 map(config => {
162 const searchIndexConfig = config.search.searchIndex
163
164 if (searchIndexConfig.enabled && (searchIndexConfig.isDefaultSearch || searchIndexConfig.disableLocalSearch)) {
165 return 'search-index'
166 }
167
168 return 'local'
169 })
170 ).toPromise()
171 }
172
173 private loadAttributeEnum <T extends string | number> ( 160 private loadAttributeEnum <T extends string | number> (
174 baseUrl: string, 161 baseUrl: string,
175 attributeName: 'categories' | 'licences' | 'languages' | 'privacies', 162 attributeName: 'categories' | 'licences' | 'languages' | 'privacies',
@@ -204,12 +191,12 @@ export class ServerService {
204 ) 191 )
205 } 192 }
206 193
207 private loadConfigLocally () { 194 private loadHTMLConfigLocally () {
208 const configString = window['PeerTubeServerConfig'] 195 const configString = window['PeerTubeServerConfig']
209 if (!configString) { 196 if (!configString) {
210 throw new Error('Could not find PeerTubeServerConfig in HTML') 197 throw new Error('Could not find PeerTubeServerConfig in HTML')
211 } 198 }
212 199
213 this.config = JSON.parse(configString) 200 this.htmlConfig = JSON.parse(configString)
214 } 201 }
215} 202}
diff --git a/client/src/app/core/theme/theme.service.ts b/client/src/app/core/theme/theme.service.ts
index e7a5ae17a..0c7dec0a1 100644
--- a/client/src/app/core/theme/theme.service.ts
+++ b/client/src/app/core/theme/theme.service.ts
@@ -1,7 +1,7 @@
1import { first } from 'rxjs/operators' 1import { first } from 'rxjs/operators'
2import { Injectable } from '@angular/core' 2import { Injectable } from '@angular/core'
3import { UserLocalStorageKeys } from '@root-helpers/users' 3import { UserLocalStorageKeys } from '@root-helpers/users'
4import { ServerConfig, ServerConfigTheme } from '@shared/models' 4import { HTMLServerConfig, ServerConfigTheme } from '@shared/models'
5import { environment } from '../../../environments/environment' 5import { environment } from '../../../environments/environment'
6import { AuthService } from '../auth' 6import { AuthService } from '../auth'
7import { PluginService } from '../plugins/plugin.service' 7import { PluginService } from '../plugins/plugin.service'
@@ -18,7 +18,7 @@ export class ThemeService {
18 private themeFromLocalStorage: ServerConfigTheme 18 private themeFromLocalStorage: ServerConfigTheme
19 private themeDOMLinksFromLocalStorage: HTMLLinkElement[] = [] 19 private themeDOMLinksFromLocalStorage: HTMLLinkElement[] = []
20 20
21 private serverConfig: ServerConfig 21 private serverConfig: HTMLServerConfig
22 22
23 constructor ( 23 constructor (
24 private auth: AuthService, 24 private auth: AuthService,
@@ -32,18 +32,13 @@ export class ThemeService {
32 // Try to load from local storage first, so we don't have to wait network requests 32 // Try to load from local storage first, so we don't have to wait network requests
33 this.loadAndSetFromLocalStorage() 33 this.loadAndSetFromLocalStorage()
34 34
35 this.serverConfig = this.server.getTmpConfig() 35 this.serverConfig = this.server.getHTMLConfig()
36 this.server.getConfig() 36 const themes = this.serverConfig.theme.registered
37 .subscribe(config => {
38 this.serverConfig = config
39 37
40 const themes = this.serverConfig.theme.registered 38 this.removeThemeFromLocalStorageIfNeeded(themes)
39 this.injectThemes(themes)
41 40
42 this.removeThemeFromLocalStorageIfNeeded(themes) 41 this.listenUserTheme()
43 this.injectThemes(themes)
44
45 this.listenUserTheme()
46 })
47 } 42 }
48 43
49 private injectThemes (themes: ServerConfigTheme[], fromLocalStorage = false) { 44 private injectThemes (themes: ServerConfigTheme[], fromLocalStorage = false) {
diff --git a/client/src/app/header/search-typeahead.component.ts b/client/src/app/header/search-typeahead.component.ts
index c546628ee..b5d76c70e 100644
--- a/client/src/app/header/search-typeahead.component.ts
+++ b/client/src/app/header/search-typeahead.component.ts
@@ -1,10 +1,10 @@
1import { of } from 'rxjs' 1import { of } from 'rxjs'
2import { first, tap } from 'rxjs/operators' 2import { first, tap } from 'rxjs/operators'
3import { ListKeyManager } from '@angular/cdk/a11y' 3import { ListKeyManager } from '@angular/cdk/a11y'
4import { AfterViewChecked, AfterViewInit, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core' 4import { AfterViewChecked, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core'
5import { ActivatedRoute, Params, Router } from '@angular/router' 5import { ActivatedRoute, Params, Router } from '@angular/router'
6import { AuthService, ServerService } from '@app/core' 6import { AuthService, ServerService } from '@app/core'
7import { SearchTargetType, ServerConfig } from '@shared/models' 7import { HTMLServerConfig, SearchTargetType } from '@shared/models'
8import { SuggestionComponent, SuggestionPayload, SuggestionPayloadType } from './suggestion.component' 8import { SuggestionComponent, SuggestionPayload, SuggestionPayloadType } from './suggestion.component'
9 9
10@Component({ 10@Component({
@@ -12,7 +12,7 @@ import { SuggestionComponent, SuggestionPayload, SuggestionPayloadType } from '.
12 templateUrl: './search-typeahead.component.html', 12 templateUrl: './search-typeahead.component.html',
13 styleUrls: [ './search-typeahead.component.scss' ] 13 styleUrls: [ './search-typeahead.component.scss' ]
14}) 14})
15export class SearchTypeaheadComponent implements OnInit, AfterViewInit, AfterViewChecked, OnDestroy { 15export class SearchTypeaheadComponent implements OnInit, AfterViewChecked, OnDestroy {
16 @ViewChildren(SuggestionComponent) suggestionItems: QueryList<SuggestionComponent> 16 @ViewChildren(SuggestionComponent) suggestionItems: QueryList<SuggestionComponent>
17 17
18 hasChannel = false 18 hasChannel = false
@@ -20,7 +20,7 @@ export class SearchTypeaheadComponent implements OnInit, AfterViewInit, AfterVie
20 areSuggestionsOpened = true 20 areSuggestionsOpened = true
21 21
22 search = '' 22 search = ''
23 serverConfig: ServerConfig 23 serverConfig: HTMLServerConfig
24 24
25 inThisChannelText: string 25 inThisChannelText: string
26 26
@@ -42,20 +42,14 @@ export class SearchTypeaheadComponent implements OnInit, AfterViewInit, AfterVie
42 this.route.queryParams 42 this.route.queryParams
43 .pipe(first(params => this.isOnSearch() && params.search !== undefined && params.search !== null)) 43 .pipe(first(params => this.isOnSearch() && params.search !== undefined && params.search !== null))
44 .subscribe(params => this.search = params.search) 44 .subscribe(params => this.search = params.search)
45 }
46 45
47 ngAfterViewInit () { 46 this.serverConfig = this.serverService.getHTMLConfig()
48 this.serverService.getConfig() 47 this.computeTypeahead()
48
49 this.serverService.configReloaded
49 .subscribe(config => { 50 .subscribe(config => {
50 this.serverConfig = config 51 this.serverConfig = config
51
52 this.computeTypeahead() 52 this.computeTypeahead()
53
54 this.serverService.configReloaded
55 .subscribe(config => {
56 this.serverConfig = config
57 this.computeTypeahead()
58 })
59 }) 53 })
60 } 54 }
61 55
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts
index 2f7e0cf07..c767f19b2 100644
--- a/client/src/app/menu/menu.component.ts
+++ b/client/src/app/menu/menu.component.ts
@@ -20,7 +20,7 @@ import { LanguageChooserComponent } from '@app/menu/language-chooser.component'
20import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' 20import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
21import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service' 21import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service'
22import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' 22import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
23import { ServerConfig, UserRight, VideoConstant } from '@shared/models' 23import { HTMLServerConfig, ServerConfig, UserRight, VideoConstant } from '@shared/models'
24 24
25const logger = debug('peertube:menu:MenuComponent') 25const logger = debug('peertube:menu:MenuComponent')
26 26
@@ -48,7 +48,10 @@ export class MenuComponent implements OnInit {
48 commonMenuLinks: MenuLink[] = [] 48 commonMenuLinks: MenuLink[] = []
49 49
50 private languages: VideoConstant<string>[] = [] 50 private languages: VideoConstant<string>[] = []
51
52 private htmlServerConfig: HTMLServerConfig
51 private serverConfig: ServerConfig 53 private serverConfig: ServerConfig
54
52 private routesPerRight: { [role in UserRight]?: string } = { 55 private routesPerRight: { [role in UserRight]?: string } = {
53 [UserRight.MANAGE_USERS]: '/admin/users', 56 [UserRight.MANAGE_USERS]: '/admin/users',
54 [UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends', 57 [UserRight.MANAGE_SERVER_FOLLOW]: '/admin/friends',
@@ -86,16 +89,12 @@ export class MenuComponent implements OnInit {
86 } 89 }
87 90
88 get instanceName () { 91 get instanceName () {
89 return this.serverConfig.instance.name 92 return this.htmlServerConfig.instance.name
90 } 93 }
91 94
92 ngOnInit () { 95 ngOnInit () {
93 this.serverConfig = this.serverService.getTmpConfig() 96 this.htmlServerConfig = this.serverService.getHTMLConfig()
94 this.serverService.getConfig() 97 this.buildMenuLinks()
95 .subscribe(config => {
96 this.serverConfig = config
97 this.buildMenuLinks()
98 })
99 98
100 this.isLoggedIn = this.authService.isLoggedIn() 99 this.isLoggedIn = this.authService.isLoggedIn()
101 if (this.isLoggedIn === true) { 100 if (this.isLoggedIn === true) {
@@ -148,6 +147,8 @@ export class MenuComponent implements OnInit {
148 } 147 }
149 148
150 isRegistrationAllowed () { 149 isRegistrationAllowed () {
150 if (!this.serverConfig) return false
151
151 return this.serverConfig.signup.allowed && 152 return this.serverConfig.signup.allowed &&
152 this.serverConfig.signup.allowedForCurrentIP 153 this.serverConfig.signup.allowedForCurrentIP
153 } 154 }
@@ -257,7 +258,7 @@ export class MenuComponent implements OnInit {
257 } 258 }
258 259
259 private buildMenuLinks () { 260 private buildMenuLinks () {
260 this.commonMenuLinks = this.menuService.buildCommonLinks(this.serverConfig) 261 this.commonMenuLinks = this.menuService.buildCommonLinks(this.htmlServerConfig)
261 } 262 }
262 263
263 private buildUserLanguages () { 264 private buildUserLanguages () {
diff --git a/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts b/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts
index 840946690..dc9b72ddb 100644
--- a/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts
+++ b/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts
@@ -39,14 +39,13 @@ export class ActorAvatarEditComponent implements OnInit {
39 ) { } 39 ) { }
40 40
41 ngOnInit (): void { 41 ngOnInit (): void {
42 this.serverService.getConfig() 42 const config = this.serverService.getHTMLConfig()
43 .subscribe(config => { 43
44 this.maxAvatarSize = config.avatar.file.size.max 44 this.maxAvatarSize = config.avatar.file.size.max
45 this.avatarExtensions = config.avatar.file.extensions.join(', ') 45 this.avatarExtensions = config.avatar.file.extensions.join(', ')
46 46
47 this.avatarFormat = `${$localize`max size`}: 192*192px, ` + 47 this.avatarFormat = `${$localize`max size`}: 192*192px, ` +
48 `${getBytes(this.maxAvatarSize)} ${$localize`extensions`}: ${this.avatarExtensions}` 48 `${getBytes(this.maxAvatarSize)} ${$localize`extensions`}: ${this.avatarExtensions}`
49 })
50 } 49 }
51 50
52 onAvatarChange (input: HTMLInputElement) { 51 onAvatarChange (input: HTMLInputElement) {
diff --git a/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts b/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts
index 08372d8ad..eec325a61 100644
--- a/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts
+++ b/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.ts
@@ -1,4 +1,4 @@
1import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core' 1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
2import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' 2import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'
3import { Notifier, ServerService } from '@app/core' 3import { Notifier, ServerService } from '@app/core'
4import { VideoChannel } from '@app/shared/shared-main' 4import { VideoChannel } from '@app/shared/shared-main'
@@ -36,16 +36,15 @@ export class ActorBannerEditComponent implements OnInit {
36 ) { } 36 ) { }
37 37
38 ngOnInit (): void { 38 ngOnInit (): void {
39 this.serverService.getConfig() 39 const config = this.serverService.getHTMLConfig()
40 .subscribe(config => { 40 this.maxBannerSize = config.banner.file.size.max
41 this.maxBannerSize = config.banner.file.size.max 41 this.bannerExtensions = config.banner.file.extensions.join(', ')
42 this.bannerExtensions = config.banner.file.extensions.join(', ')
43 42
44 // tslint:disable:max-line-length 43 // tslint:disable:max-line-length
45 this.bannerFormat = $localize`ratio 6/1, recommended size: 1920x317, max size: ${getBytes(this.maxBannerSize)}, extensions: ${this.bannerExtensions}` 44 this.bannerFormat = $localize`ratio 6/1, recommended size: 1920x317, max size: ${getBytes(this.maxBannerSize)}, extensions: ${this.bannerExtensions}`
46 })
47 } 45 }
48 46
47
49 onBannerChange (input: HTMLInputElement) { 48 onBannerChange (input: HTMLInputElement) {
50 this.bannerfileInput = new ElementRef(input) 49 this.bannerfileInput = new ElementRef(input)
51 50
diff --git a/client/src/app/shared/shared-forms/preview-upload.component.ts b/client/src/app/shared/shared-forms/preview-upload.component.ts
index a55dcdd9a..edee6786d 100644
--- a/client/src/app/shared/shared-forms/preview-upload.component.ts
+++ b/client/src/app/shared/shared-forms/preview-upload.component.ts
@@ -2,7 +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' 5import { HTMLServerConfig } from '@shared/models'
6import { BytesPipe } from '../shared-main' 6import { BytesPipe } from '../shared-main'
7 7
8@Component({ 8@Component({
@@ -27,7 +27,7 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor {
27 allowedExtensionsMessage = '' 27 allowedExtensionsMessage = ''
28 maxSizeText: string 28 maxSizeText: string
29 29
30 private serverConfig: ServerConfig 30 private serverConfig: HTMLServerConfig
31 private bytesPipe: BytesPipe 31 private bytesPipe: BytesPipe
32 private file: Blob 32 private file: Blob
33 33
@@ -52,9 +52,7 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor {
52 } 52 }
53 53
54 ngOnInit () { 54 ngOnInit () {
55 this.serverConfig = this.serverService.getTmpConfig() 55 this.serverConfig = this.serverService.getHTMLConfig()
56 this.serverService.getConfig()
57 .subscribe(config => this.serverConfig = config)
58 56
59 this.allowedExtensionsMessage = this.videoImageExtensions.join(', ') 57 this.allowedExtensionsMessage = this.videoImageExtensions.join(', ')
60 } 58 }
diff --git a/client/src/app/shared/shared-instance/instance-features-table.component.html b/client/src/app/shared/shared-instance/instance-features-table.component.html
index d505b6739..3fc5920b5 100644
--- a/client/src/app/shared/shared-instance/instance-features-table.component.html
+++ b/client/src/app/shared/shared-instance/instance-features-table.component.html
@@ -1,4 +1,4 @@
1<div class="feature-table"> 1<div *ngIf="serverConfig" class="feature-table">
2 2
3 <table class="table" *ngIf="serverConfig"> 3 <table class="table" *ngIf="serverConfig">
4 <caption i18n>Features found on this instance</caption> 4 <caption i18n>Features found on this instance</caption>
diff --git a/client/src/app/shared/shared-instance/instance-features-table.component.ts b/client/src/app/shared/shared-instance/instance-features-table.component.ts
index c3b3dfdfd..6335de450 100644
--- a/client/src/app/shared/shared-instance/instance-features-table.component.ts
+++ b/client/src/app/shared/shared-instance/instance-features-table.component.ts
@@ -40,7 +40,6 @@ export class InstanceFeaturesTableComponent implements OnInit {
40 } 40 }
41 41
42 ngOnInit () { 42 ngOnInit () {
43 this.serverConfig = this.serverService.getTmpConfig()
44 this.serverService.getConfig() 43 this.serverService.getConfig()
45 .subscribe(config => { 44 .subscribe(config => {
46 this.serverConfig = config 45 this.serverConfig = config
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts
index e7f739bfe..ab8ed9051 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -1,13 +1,11 @@
1import { AuthUser } from '@app/core' 1import { AuthUser } from '@app/core'
2import { User } from '@app/core/users/user.model' 2import { User } from '@app/core/users/user.model'
3import { durationToString, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers' 3import { durationToString, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers'
4import { Account } from '@app/shared/shared-main/account/account.model'
5import { Actor } from '@app/shared/shared-main/account/actor.model' 4import { Actor } from '@app/shared/shared-main/account/actor.model'
6import { VideoChannel } from '@app/shared/shared-main/video-channel/video-channel.model'
7import { peertubeTranslate } from '@shared/core-utils/i18n' 5import { peertubeTranslate } from '@shared/core-utils/i18n'
8import { 6import {
9 ActorImage, 7 ActorImage,
10 ServerConfig, 8 HTMLServerConfig,
11 UserRight, 9 UserRight,
12 Video as VideoServerModel, 10 Video as VideoServerModel,
13 VideoConstant, 11 VideoConstant,
@@ -163,7 +161,7 @@ export class Video implements VideoServerModel {
163 this.pluginData = hash.pluginData 161 this.pluginData = hash.pluginData
164 } 162 }
165 163
166 isVideoNSFWForUser (user: User, serverConfig: ServerConfig) { 164 isVideoNSFWForUser (user: User, serverConfig: HTMLServerConfig) {
167 // Video is not NSFW, skip 165 // Video is not NSFW, skip
168 if (this.nsfw === false) return false 166 if (this.nsfw === false) return false
169 167
diff --git a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts
index f510a82f9..8c5a48d42 100644
--- a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts
+++ b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts
@@ -1,7 +1,7 @@
1import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core' 1import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core'
2import { AuthService, ConfirmService, Notifier, ServerService, UserService } from '@app/core' 2import { AuthService, ConfirmService, Notifier, ServerService, UserService } from '@app/core'
3import { Account, DropdownAction } from '@app/shared/shared-main' 3import { Account, DropdownAction } from '@app/shared/shared-main'
4import { BulkRemoveCommentsOfBody, ServerConfig, User, UserRight } from '@shared/models' 4import { BulkRemoveCommentsOfBody, User, UserRight } from '@shared/models'
5import { BlocklistService } from './blocklist.service' 5import { BlocklistService } from './blocklist.service'
6import { BulkService } from './bulk.service' 6import { BulkService } from './bulk.service'
7import { UserBanModalComponent } from './user-ban-modal.component' 7import { UserBanModalComponent } from './user-ban-modal.component'
@@ -28,7 +28,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
28 28
29 userActions: DropdownAction<{ user: User, account: Account }>[][] = [] 29 userActions: DropdownAction<{ user: User, account: Account }>[][] = []
30 30
31 private serverConfig: ServerConfig 31 requiresEmailVerification = false
32 32
33 constructor ( 33 constructor (
34 private authService: AuthService, 34 private authService: AuthService,
@@ -40,14 +40,9 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
40 private bulkService: BulkService 40 private bulkService: BulkService
41 ) { } 41 ) { }
42 42
43 get requiresEmailVerification () { 43 ngOnInit () {
44 return this.serverConfig.signup.requiresEmailVerification
45 }
46
47 ngOnInit (): void {
48 this.serverConfig = this.serverService.getTmpConfig()
49 this.serverService.getConfig() 44 this.serverService.getConfig()
50 .subscribe(config => this.serverConfig = config) 45 .subscribe(config => this.requiresEmailVerification = config.signup.requiresEmailVerification)
51 } 46 }
52 47
53 ngOnChanges () { 48 ngOnChanges () {
diff --git a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
index 80b88c129..b721604e5 100644
--- a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
+++ b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts
@@ -2,7 +2,7 @@ import { Subject, Subscription } from 'rxjs'
2import { Component, Input, OnDestroy, OnInit } from '@angular/core' 2import { Component, Input, OnDestroy, OnInit } from '@angular/core'
3import { AuthService, Notifier, ServerService, UserService } from '@app/core' 3import { AuthService, Notifier, ServerService, UserService } from '@app/core'
4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
5import { ServerConfig, User, UserUpdateMe } from '@shared/models' 5import { HTMLServerConfig, User, UserUpdateMe } from '@shared/models'
6 6
7@Component({ 7@Component({
8 selector: 'my-user-interface-settings', 8 selector: 'my-user-interface-settings',
@@ -17,7 +17,7 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
17 17
18 formValuesWatcher: Subscription 18 formValuesWatcher: Subscription
19 19
20 private serverConfig: ServerConfig 20 private serverConfig: HTMLServerConfig
21 21
22 constructor ( 22 constructor (
23 protected formValidatorService: FormValidatorService, 23 protected formValidatorService: FormValidatorService,
@@ -35,9 +35,7 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn
35 } 35 }
36 36
37 ngOnInit () { 37 ngOnInit () {
38 this.serverConfig = this.serverService.getTmpConfig() 38 this.serverConfig = this.serverService.getHTMLConfig()
39 this.serverService.getConfig()
40 .subscribe(config => this.serverConfig = config)
41 39
42 this.buildForm({ 40 this.buildForm({
43 theme: null 41 theme: null
diff --git a/client/src/app/shared/shared-user-settings/user-video-settings.component.ts b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts
index ae95030c7..8b0eaea4f 100644
--- a/client/src/app/shared/shared-user-settings/user-video-settings.component.ts
+++ b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts
@@ -48,9 +48,8 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit,
48 48
49 forkJoin([ 49 forkJoin([
50 this.serverService.getVideoLanguages(), 50 this.serverService.getVideoLanguages(),
51 this.serverService.getConfig(),
52 this.userInformationLoaded.pipe(first()) 51 this.userInformationLoaded.pipe(first())
53 ]).subscribe(([ languages, config ]) => { 52 ]).subscribe(([ languages ]) => {
54 const group = this.allLanguagesGroup 53 const group = this.allLanguagesGroup
55 54
56 this.languageItems = [ { label: $localize`Unknown language`, id: '_unknown', group } ] 55 this.languageItems = [ { label: $localize`Unknown language`, id: '_unknown', group } ]
@@ -61,7 +60,8 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit,
61 ? this.user.videoLanguages.map(l => ({ id: l })) 60 ? this.user.videoLanguages.map(l => ({ id: l }))
62 : [ { group } ] 61 : [ { group } ]
63 62
64 this.defaultNSFWPolicy = config.instance.defaultNSFWPolicy 63 const serverConfig = this.serverService.getHTMLConfig()
64 this.defaultNSFWPolicy = serverConfig.instance.defaultNSFWPolicy
65 65
66 this.form.patchValue({ 66 this.form.patchValue({
67 nsfwPolicy: this.user.nsfwPolicy || this.defaultNSFWPolicy, 67 nsfwPolicy: this.user.nsfwPolicy || this.defaultNSFWPolicy,
diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts
index f83380513..bf433aabd 100644
--- a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts
+++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts
@@ -25,7 +25,7 @@ import {
25import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook' 25import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook'
26import { GlobalIconName } from '@app/shared/shared-icons' 26import { GlobalIconName } from '@app/shared/shared-icons'
27import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils/miscs/date' 27import { isLastMonth, isLastWeek, isThisMonth, isToday, isYesterday } from '@shared/core-utils/miscs/date'
28import { ServerConfig, UserRight, VideoFilter, VideoSortField } from '@shared/models' 28import { HTMLServerConfig, UserRight, VideoFilter, VideoSortField } from '@shared/models'
29import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' 29import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type'
30import { Syndication, Video } from '../shared-main' 30import { Syndication, Video } from '../shared-main'
31import { GenericHeaderComponent, VideoListHeaderComponent } from './video-list-header.component' 31import { GenericHeaderComponent, VideoListHeaderComponent } from './video-list-header.component'
@@ -100,7 +100,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte
100 100
101 protected onUserLoadedSubject = new ReplaySubject<void>(1) 101 protected onUserLoadedSubject = new ReplaySubject<void>(1)
102 102
103 protected serverConfig: ServerConfig 103 protected serverConfig: HTMLServerConfig
104 104
105 protected abstract notifier: Notifier 105 protected abstract notifier: Notifier
106 protected abstract authService: AuthService 106 protected abstract authService: AuthService
@@ -126,9 +126,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte
126 abstract generateSyndicationList (): void 126 abstract generateSyndicationList (): void
127 127
128 ngOnInit () { 128 ngOnInit () {
129 this.serverConfig = this.serverService.getTmpConfig() 129 this.serverConfig = this.serverService.getHTMLConfig()
130 this.serverService.getConfig()
131 .subscribe(config => this.serverConfig = config)
132 130
133 this.groupedDateLabels = { 131 this.groupedDateLabels = {
134 [GroupDate.UNKNOWN]: null, 132 [GroupDate.UNKNOWN]: null,
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts
index aac55a6e9..fc066846a 100644
--- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts
+++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts
@@ -11,7 +11,7 @@ import {
11 Output 11 Output
12} from '@angular/core' 12} from '@angular/core'
13import { AuthService, ScreenService, ServerService, User } from '@app/core' 13import { AuthService, ScreenService, ServerService, User } from '@app/core'
14import { ServerConfig, VideoPlaylistType, VideoPrivacy, VideoState } from '@shared/models' 14import { HTMLServerConfig, VideoPlaylistType, VideoPrivacy, VideoState } from '@shared/models'
15import { ActorAvatarSize } from '../shared-actor-image/actor-avatar.component' 15import { ActorAvatarSize } from '../shared-actor-image/actor-avatar.component'
16import { Video } from '../shared-main' 16import { Video } from '../shared-main'
17import { VideoPlaylistService } from '../shared-video-playlist' 17import { VideoPlaylistService } from '../shared-video-playlist'
@@ -74,7 +74,7 @@ export class VideoMiniatureComponent implements OnInit {
74 mute: true 74 mute: true
75 } 75 }
76 showActions = false 76 showActions = false
77 serverConfig: ServerConfig 77 serverConfig: HTMLServerConfig
78 78
79 addToWatchLaterText: string 79 addToWatchLaterText: string
80 addedToWatchLaterText: string 80 addedToWatchLaterText: string
@@ -106,12 +106,8 @@ export class VideoMiniatureComponent implements OnInit {
106 } 106 }
107 107
108 ngOnInit () { 108 ngOnInit () {
109 this.serverConfig = this.serverService.getTmpConfig() 109 this.serverConfig = this.serverService.getHTMLConfig()
110 this.serverService.getConfig() 110 this.buildVideoLink()
111 .subscribe(config => {
112 this.serverConfig = config
113 this.buildVideoLink()
114 })
115 111
116 this.setUpBy() 112 this.setUpBy()
117 113
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts
index 86c281a1e..57eab4dfd 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts
+++ b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, In
2import { AuthService, Notifier, ServerService } from '@app/core' 2import { AuthService, Notifier, ServerService } from '@app/core'
3import { Video } from '@app/shared/shared-main' 3import { Video } from '@app/shared/shared-main'
4import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' 4import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
5import { ServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate } from '@shared/models' 5import { HTMLServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate } from '@shared/models'
6import { secondsToTime } from '../../../assets/player/utils' 6import { secondsToTime } from '../../../assets/player/utils'
7import { VideoPlaylistElement } from './video-playlist-element.model' 7import { VideoPlaylistElement } from './video-playlist-element.model'
8import { VideoPlaylist } from './video-playlist.model' 8import { VideoPlaylist } from './video-playlist.model'
@@ -37,7 +37,7 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit {
37 stopTimestamp: number 37 stopTimestamp: number
38 } = {} as any 38 } = {} as any
39 39
40 private serverConfig: ServerConfig 40 private serverConfig: HTMLServerConfig
41 41
42 constructor ( 42 constructor (
43 private authService: AuthService, 43 private authService: AuthService,
@@ -48,12 +48,7 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit {
48 ) {} 48 ) {}
49 49
50 ngOnInit (): void { 50 ngOnInit (): void {
51 this.serverConfig = this.serverService.getTmpConfig() 51 this.serverConfig = this.serverService.getHTMLConfig()
52 this.serverService.getConfig()
53 .subscribe(config => {
54 this.serverConfig = config
55 this.cdr.detectChanges()
56 })
57 } 52 }
58 53
59 isUnavailable (e: VideoPlaylistElement) { 54 isUnavailable (e: VideoPlaylistElement) {