aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRigel Kent <par@rigelk.eu>2018-03-27 13:42:57 +0200
committerChocobozzz <me@florianbigard.com>2018-03-27 13:42:57 +0200
commit1869c87535d31a73a26c5d07718cdf94300cc332 (patch)
tree0fa1823002f7a1e76e8ee138da6f5e2088f65981
parentfc27b17c6b4ddaef2db8e7086d3f74c081026bd9 (diff)
downloadPeerTube-1869c87535d31a73a26c5d07718cdf94300cc332.tar.gz
PeerTube-1869c87535d31a73a26c5d07718cdf94300cc332.tar.zst
PeerTube-1869c87535d31a73a26c5d07718cdf94300cc332.zip
show quota in stats, display quota on the about page, fixes #405 (#421)
move videoQuota under a user object, use byte PipeTransform
-rw-r--r--client/src/app/about/about.component.html8
-rw-r--r--client/src/app/about/about.component.ts6
-rw-r--r--client/src/app/core/server/server.service.ts4
-rw-r--r--server/controllers/api/config.ts3
-rw-r--r--shared/models/server/server-config.model.ts4
5 files changed, 24 insertions, 1 deletions
diff --git a/client/src/app/about/about.component.html b/client/src/app/about/about.component.html
index 3bb86208c..bcb4ed2be 100644
--- a/client/src/app/about/about.component.html
+++ b/client/src/app/about/about.component.html
@@ -13,6 +13,14 @@
13 <div class="section-title">Terms</div> 13 <div class="section-title">Terms</div>
14 14
15 <div [innerHTML]="termsHTML"></div> 15 <div [innerHTML]="termsHTML"></div>
16
17 <div *ngIf="userVideoQuota !== -1;else noQuota">
18 This instance provides a baseline quota of {{ userVideoQuota | bytes: 0 }} space for the videos of its users.
19 </div>
20
21 <ng-template #noQuota>
22 This instance provides unlimited space for the videos of its users.
23 </ng-template>
16 </div> 24 </div>
17 25
18 <div id="p2p-privacy"> 26 <div id="p2p-privacy">
diff --git a/client/src/app/about/about.component.ts b/client/src/app/about/about.component.ts
index adad32b26..7edc013e1 100644
--- a/client/src/app/about/about.component.ts
+++ b/client/src/app/about/about.component.ts
@@ -23,6 +23,10 @@ export class AboutComponent implements OnInit {
23 return this.serverService.getConfig().instance.name 23 return this.serverService.getConfig().instance.name
24 } 24 }
25 25
26 get userVideoQuota () {
27 return this.serverService.getConfig().user.videoQuota
28 }
29
26 ngOnInit () { 30 ngOnInit () {
27 this.serverService.getAbout() 31 this.serverService.getAbout()
28 .subscribe( 32 .subscribe(
@@ -31,7 +35,7 @@ export class AboutComponent implements OnInit {
31 this.termsHTML = this.markdownService.textMarkdownToHTML(res.instance.terms) 35 this.termsHTML = this.markdownService.textMarkdownToHTML(res.instance.terms)
32 }, 36 },
33 37
34 err => this.notificationsService.error('Error', err) 38 err => this.notificationsService.error('Error getting about from server', err)
35 ) 39 )
36 } 40 }
37 41
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts
index 206ec7bcd..987d64d2a 100644
--- a/client/src/app/core/server/server.service.ts
+++ b/client/src/app/core/server/server.service.ts
@@ -5,6 +5,7 @@ import 'rxjs/add/operator/do'
5import { ReplaySubject } from 'rxjs/ReplaySubject' 5import { ReplaySubject } from 'rxjs/ReplaySubject'
6import { ServerConfig } from '../../../../../shared' 6import { ServerConfig } from '../../../../../shared'
7import { About } from '../../../../../shared/models/server/about.model' 7import { About } from '../../../../../shared/models/server/about.model'
8import { ServerStats } from '../../../../../shared/models/server/server-stats.model'
8import { environment } from '../../../environments/environment' 9import { environment } from '../../../environments/environment'
9 10
10@Injectable() 11@Injectable()
@@ -51,6 +52,9 @@ export class ServerService {
51 file: { 52 file: {
52 extensions: [] 53 extensions: []
53 } 54 }
55 },
56 user: {
57 videoQuota: -1
54 } 58 }
55 } 59 }
56 private videoCategories: Array<{ id: number, label: string }> = [] 60 private videoCategories: Array<{ id: number, label: string }> = []
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 62a783982..8d7fc8cf1 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -76,6 +76,9 @@ async function getConfig (req: express.Request, res: express.Response, next: exp
76 file: { 76 file: {
77 extensions: CONSTRAINTS_FIELDS.VIDEOS.EXTNAME 77 extensions: CONSTRAINTS_FIELDS.VIDEOS.EXTNAME
78 } 78 }
79 },
80 user: {
81 videoQuota: CONFIG.USER.VIDEO_QUOTA
79 } 82 }
80 } 83 }
81 84
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts
index c6fa651a8..611d0efe5 100644
--- a/shared/models/server/server-config.model.ts
+++ b/shared/models/server/server-config.model.ts
@@ -39,4 +39,8 @@ export interface ServerConfig {
39 extensions: string[] 39 extensions: string[]
40 } 40 }
41 } 41 }
42
43 user: {
44 videoQuota: number
45 }
42} 46}