aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-03 11:10:40 +0100
committerChocobozzz <me@florianbigard.com>2018-01-03 11:10:40 +0100
commit01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea (patch)
tree9e01809f09adbcd512a8dedf73093a123f88e02c /client
parent47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04 (diff)
downloadPeerTube-01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea.tar.gz
PeerTube-01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea.tar.zst
PeerTube-01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea.zip
Add avatar max size limit
Diffstat (limited to 'client')
-rw-r--r--client/src/app/account/account-settings/account-settings.component.html3
-rw-r--r--client/src/app/account/account-settings/account-settings.component.scss10
-rw-r--r--client/src/app/account/account-settings/account-settings.component.ts14
-rw-r--r--client/src/app/core/server/server.service.ts11
4 files changed, 33 insertions, 5 deletions
diff --git a/client/src/app/account/account-settings/account-settings.component.html b/client/src/app/account/account-settings/account-settings.component.html
index fe345207a..0d1637c40 100644
--- a/client/src/app/account/account-settings/account-settings.component.html
+++ b/client/src/app/account/account-settings/account-settings.component.html
@@ -9,8 +9,9 @@
9 9
10<div class="button-file"> 10<div class="button-file">
11 <span>Change your avatar</span> 11 <span>Change your avatar</span>
12 <input #avatarfileInput type="file" name="avatarfile" id="avatarfile" (change)="changeAvatar()" /> 12 <input #avatarfileInput type="file" name="avatarfile" id="avatarfile" [accept]="avatarExtensions" (change)="changeAvatar()" />
13</div> 13</div>
14<div class="file-max-size">(extensions: {{ avatarExtensions }}, max size: {{ maxAvatarSize | bytes }})</div>
14 15
15<div class="account-title">Account settings</div> 16<div class="account-title">Account settings</div>
16<my-account-change-password></my-account-change-password> 17<my-account-change-password></my-account-change-password>
diff --git a/client/src/app/account/account-settings/account-settings.component.scss b/client/src/app/account/account-settings/account-settings.component.scss
index accd65214..c8a27dbcd 100644
--- a/client/src/app/account/account-settings/account-settings.component.scss
+++ b/client/src/app/account/account-settings/account-settings.component.scss
@@ -22,11 +22,19 @@
22} 22}
23 23
24.button-file { 24.button-file {
25 @include peertube-button-file(auto); 25 @include peertube-button-file(160px);
26 26
27 margin-top: 10px; 27 margin-top: 10px;
28} 28}
29 29
30.file-max-size {
31 display: inline-block;
32 font-size: 13px;
33
34 position: relative;
35 top: -10px;
36}
37
30.account-title { 38.account-title {
31 text-transform: uppercase; 39 text-transform: uppercase;
32 color: $orange-color; 40 color: $orange-color;
diff --git a/client/src/app/account/account-settings/account-settings.component.ts b/client/src/app/account/account-settings/account-settings.component.ts
index 3e03085ce..d5f5ff30f 100644
--- a/client/src/app/account/account-settings/account-settings.component.ts
+++ b/client/src/app/account/account-settings/account-settings.component.ts
@@ -1,9 +1,8 @@
1import { HttpEventType, HttpResponse } from '@angular/common/http'
2import { Component, OnInit, ViewChild } from '@angular/core' 1import { Component, OnInit, ViewChild } from '@angular/core'
3import { NotificationsService } from 'angular2-notifications' 2import { NotificationsService } from 'angular2-notifications'
4import { VideoPrivacy } from '../../../../../shared/models/videos'
5import { User } from '../../shared'
6import { AuthService } from '../../core' 3import { AuthService } from '../../core'
4import { ServerService } from '../../core/server'
5import { User } from '../../shared'
7import { UserService } from '../../shared/users' 6import { UserService } from '../../shared/users'
8 7
9@Component({ 8@Component({
@@ -19,6 +18,7 @@ export class AccountSettingsComponent implements OnInit {
19 constructor ( 18 constructor (
20 private userService: UserService, 19 private userService: UserService,
21 private authService: AuthService, 20 private authService: AuthService,
21 private serverService: ServerService,
22 private notificationsService: NotificationsService 22 private notificationsService: NotificationsService
23 ) {} 23 ) {}
24 24
@@ -47,4 +47,12 @@ export class AccountSettingsComponent implements OnInit {
47 err => this.notificationsService.error('Error', err.message) 47 err => this.notificationsService.error('Error', err.message)
48 ) 48 )
49 } 49 }
50
51 get maxAvatarSize () {
52 return this.serverService.getConfig().avatar.file.size.max
53 }
54
55 get avatarExtensions () {
56 return this.serverService.getConfig().avatar.file.extensions.join(',')
57 }
50} 58}
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts
index a5be9e199..45f68b434 100644
--- a/client/src/app/core/server/server.service.ts
+++ b/client/src/app/core/server/server.service.ts
@@ -21,6 +21,17 @@ export class ServerService {
21 }, 21 },
22 transcoding: { 22 transcoding: {
23 enabledResolutions: [] 23 enabledResolutions: []
24 },
25 avatar: {
26 file: {
27 size: { max: 0 },
28 extensions: []
29 }
30 },
31 video: {
32 file: {
33 extensions: []
34 }
24 } 35 }
25 } 36 }
26 private videoCategories: Array<{ id: number, label: string }> = [] 37 private videoCategories: Array<{ id: number, label: string }> = []