From 01de67b9a4fcdf01102ccc3cb7dc24beebf6c7ea Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Jan 2018 11:10:40 +0100 Subject: Add avatar max size limit --- .../account-settings/account-settings.component.html | 3 ++- .../account-settings/account-settings.component.scss | 10 +++++++++- .../account/account-settings/account-settings.component.ts | 14 +++++++++++--- client/src/app/core/server/server.service.ts | 11 +++++++++++ 4 files changed, 33 insertions(+), 5 deletions(-) (limited to 'client') 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 @@
Change your avatar - +
+
(extensions: {{ avatarExtensions }}, max size: {{ maxAvatarSize | bytes }})
Account settings
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 @@ } .button-file { - @include peertube-button-file(auto); + @include peertube-button-file(160px); margin-top: 10px; } +.file-max-size { + display: inline-block; + font-size: 13px; + + position: relative; + top: -10px; +} + .account-title { text-transform: uppercase; 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 @@ -import { HttpEventType, HttpResponse } from '@angular/common/http' import { Component, OnInit, ViewChild } from '@angular/core' import { NotificationsService } from 'angular2-notifications' -import { VideoPrivacy } from '../../../../../shared/models/videos' -import { User } from '../../shared' import { AuthService } from '../../core' +import { ServerService } from '../../core/server' +import { User } from '../../shared' import { UserService } from '../../shared/users' @Component({ @@ -19,6 +18,7 @@ export class AccountSettingsComponent implements OnInit { constructor ( private userService: UserService, private authService: AuthService, + private serverService: ServerService, private notificationsService: NotificationsService ) {} @@ -47,4 +47,12 @@ export class AccountSettingsComponent implements OnInit { err => this.notificationsService.error('Error', err.message) ) } + + get maxAvatarSize () { + return this.serverService.getConfig().avatar.file.size.max + } + + get avatarExtensions () { + return this.serverService.getConfig().avatar.file.extensions.join(',') + } } 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 { }, transcoding: { enabledResolutions: [] + }, + avatar: { + file: { + size: { max: 0 }, + extensions: [] + } + }, + video: { + file: { + extensions: [] + } } } private videoCategories: Array<{ id: number, label: string }> = [] -- cgit v1.2.3