diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-04 13:31:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-04 15:45:44 +0200 |
commit | 2989628b7913383b39ac34c7db8666a21f8e5037 (patch) | |
tree | ac7759177c04e524e7845143fd685aefb49e810e /client/src/app/+admin | |
parent | 8e08d415f9473b6b72fef698729453e726da16e7 (diff) | |
download | PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.gz PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.tar.zst PeerTube-2989628b7913383b39ac34c7db8666a21f8e5037.zip |
Use HTML config when possible
Diffstat (limited to 'client/src/app/+admin')
10 files changed, 26 insertions, 39 deletions
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 | |||
2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' | ||
3 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
4 | import { FormGroup } from '@angular/forms' | 2 | import { 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' | |||
3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' | 3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' |
4 | import { FormGroup } from '@angular/forms' | 4 | import { FormGroup } from '@angular/forms' |
5 | import { MenuService } from '@app/core' | 5 | import { MenuService } from '@app/core' |
6 | import { ServerConfig } from '@shared/models' | 6 | import { HTMLServerConfig } from '@shared/models' |
7 | import { ConfigService } from '../shared/config.service' | 7 | import { 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 { | |||
27 | import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators' | 27 | import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators' |
28 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 28 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
29 | import { CustomPageService } from '@app/shared/shared-main/custom-page' | 29 | import { CustomPageService } from '@app/shared/shared-main/custom-page' |
30 | import { CustomConfig, CustomPage, ServerConfig } from '@shared/models' | 30 | import { CustomConfig, CustomPage, HTMLServerConfig } from '@shared/models' |
31 | import { EditConfigurationService } from './edit-configuration.service' | 31 | import { EditConfigurationService } from './edit-configuration.service' |
32 | 32 | ||
33 | type ComponentCustomConfig = CustomConfig & { | 33 | type 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 @@ | |||
2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' | 2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' |
3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' | 3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' |
4 | import { FormGroup } from '@angular/forms' | 4 | import { FormGroup } from '@angular/forms' |
5 | import { ServerConfig } from '@shared/models' | 5 | import { HTMLServerConfig } from '@shared/models' |
6 | import { ConfigService } from '../shared/config.service' | 6 | import { ConfigService } from '../shared/config.service' |
7 | import { EditConfigurationService, ResolutionOption } from './edit-configuration.service' | 7 | import { EditConfigurationService, ResolutionOption } from './edit-configuration.service' |
8 | 8 | ||
@@ -14,7 +14,7 @@ import { EditConfigurationService, ResolutionOption } from './edit-configuration | |||
14 | export class EditLiveConfigurationComponent implements OnInit, OnChanges { | 14 | export 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 @@ | |||
2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' | 2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' |
3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' | 3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' |
4 | import { FormGroup } from '@angular/forms' | 4 | import { FormGroup } from '@angular/forms' |
5 | import { ServerConfig } from '@shared/models' | 5 | import { HTMLServerConfig } from '@shared/models' |
6 | import { ConfigService } from '../shared/config.service' | 6 | import { ConfigService } from '../shared/config.service' |
7 | import { EditConfigurationService, ResolutionOption } from './edit-configuration.service' | 7 | import { EditConfigurationService, ResolutionOption } from './edit-configuration.service' |
8 | 8 | ||
@@ -14,7 +14,7 @@ import { EditConfigurationService, ResolutionOption } from './edit-configuration | |||
14 | export class EditVODTranscodingComponent implements OnInit, OnChanges { | 14 | export 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' | |||
3 | import { AuthService, ScreenService, ServerService, User } from '@app/core' | 3 | import { AuthService, ScreenService, ServerService, User } from '@app/core' |
4 | import { FormReactive } from '@app/shared/shared-forms' | 4 | import { FormReactive } from '@app/shared/shared-forms' |
5 | import { USER_ROLE_LABELS } from '@shared/core-utils/users' | 5 | import { USER_ROLE_LABELS } from '@shared/core-utils/users' |
6 | import { ServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models' | 6 | import { HTMLServerConfig, UserAdminFlag, UserRole, VideoResolution } from '@shared/models' |
7 | import { SelectOptionsItem } from '../../../../types/select-options-item.model' | 7 | import { 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 | |||
5 | import { AdvancedInputFilter } from '@app/shared/shared-forms' | 5 | import { AdvancedInputFilter } from '@app/shared/shared-forms' |
6 | import { DropdownAction } from '@app/shared/shared-main' | 6 | import { DropdownAction } from '@app/shared/shared-main' |
7 | import { UserBanModalComponent } from '@app/shared/shared-moderation' | 7 | import { UserBanModalComponent } from '@app/shared/shared-moderation' |
8 | import { ServerConfig, User, UserRole } from '@shared/models' | 8 | import { User, UserRole } from '@shared/models' |
9 | 9 | ||
10 | type UserForList = User & { | 10 | type 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 @@ | |||
1 | import { Routes } from '@angular/router' | 1 | import { Routes } from '@angular/router' |
2 | import { ServerConfigResolver, UserRightGuard } from '@app/core' | 2 | import { UserRightGuard } from '@app/core' |
3 | import { UserRight } from '@shared/models' | 3 | import { UserRight } from '@shared/models' |
4 | import { UserCreateComponent, UserUpdateComponent } from './user-edit' | 4 | import { UserCreateComponent, UserUpdateComponent } from './user-edit' |
5 | import { UserListComponent } from './user-list' | 5 | import { 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 | { |