diff options
author | Chocobozzz <me@florianbigard.com> | 2019-12-18 15:31:54 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-12-18 15:40:59 +0100 |
commit | ba430d7516bc5b1324b60571ba7594460969b7fb (patch) | |
tree | df5c6952c82f49a94c0a884bbc97d4a0cbd9f867 /client/src/app/shared/images | |
parent | 5dfb7c1dec8222b0bbccac5b56ad46da1438747e (diff) | |
download | PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.gz PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.zst PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.zip |
Lazy load static objects
Diffstat (limited to 'client/src/app/shared/images')
-rw-r--r-- | client/src/app/shared/images/preview-upload.component.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/client/src/app/shared/images/preview-upload.component.ts b/client/src/app/shared/images/preview-upload.component.ts index 44b78866e..f56f5b1f8 100644 --- a/client/src/app/shared/images/preview-upload.component.ts +++ b/client/src/app/shared/images/preview-upload.component.ts | |||
@@ -2,6 +2,7 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core' | |||
2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' | 2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' |
3 | import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' | 3 | import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' |
4 | import { ServerService } from '@app/core' | 4 | import { ServerService } from '@app/core' |
5 | import { ServerConfig } from '@shared/models' | ||
5 | 6 | ||
6 | @Component({ | 7 | @Component({ |
7 | selector: 'my-preview-upload', | 8 | selector: 'my-preview-upload', |
@@ -24,6 +25,7 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor { | |||
24 | imageSrc: SafeResourceUrl | 25 | imageSrc: SafeResourceUrl |
25 | allowedExtensionsMessage = '' | 26 | allowedExtensionsMessage = '' |
26 | 27 | ||
28 | private serverConfig: ServerConfig | ||
27 | private file: File | 29 | private file: File |
28 | 30 | ||
29 | constructor ( | 31 | constructor ( |
@@ -32,14 +34,18 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor { | |||
32 | ) {} | 34 | ) {} |
33 | 35 | ||
34 | get videoImageExtensions () { | 36 | get videoImageExtensions () { |
35 | return this.serverService.getConfig().video.image.extensions | 37 | return this.serverConfig.video.image.extensions |
36 | } | 38 | } |
37 | 39 | ||
38 | get maxVideoImageSize () { | 40 | get maxVideoImageSize () { |
39 | return this.serverService.getConfig().video.image.size.max | 41 | return this.serverConfig.video.image.size.max |
40 | } | 42 | } |
41 | 43 | ||
42 | ngOnInit () { | 44 | ngOnInit () { |
45 | this.serverConfig = this.serverService.getTmpConfig() | ||
46 | this.serverService.getConfig() | ||
47 | .subscribe(config => this.serverConfig = config) | ||
48 | |||
43 | this.allowedExtensionsMessage = this.videoImageExtensions.join(', ') | 49 | this.allowedExtensionsMessage = this.videoImageExtensions.join(', ') |
44 | } | 50 | } |
45 | 51 | ||