]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
show quota in stats, display quota on the about page, fixes #405 (#421)
authorRigel Kent <par@rigelk.eu>
Tue, 27 Mar 2018 11:42:57 +0000 (13:42 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 27 Mar 2018 11:42:57 +0000 (13:42 +0200)
move videoQuota under a user object, use byte PipeTransform

client/src/app/about/about.component.html
client/src/app/about/about.component.ts
client/src/app/core/server/server.service.ts
server/controllers/api/config.ts
shared/models/server/server-config.model.ts

index 3bb86208c51e03aa77ab186a50abb374bb3b7ff8..bcb4ed2becfb90652744a11d3596f91d06c02f43 100644 (file)
     <div class="section-title">Terms</div>
 
     <div [innerHTML]="termsHTML"></div>
+
+    <div *ngIf="userVideoQuota !== -1;else noQuota">
+      This instance provides a baseline quota of {{ userVideoQuota | bytes: 0 }} space for the videos of its users.
+    </div>
+    
+    <ng-template #noQuota>
+      This instance provides unlimited space for the videos of its users.
+    </ng-template>
   </div>
 
   <div id="p2p-privacy">
index adad32b263825ebd493b5fa9a0dac7b756c37b04..7edc013e1277c97865bebd272987fc83ceb66af8 100644 (file)
@@ -23,6 +23,10 @@ export class AboutComponent implements OnInit {
     return this.serverService.getConfig().instance.name
   }
 
+  get userVideoQuota () {
+    return this.serverService.getConfig().user.videoQuota
+  }
+
   ngOnInit () {
     this.serverService.getAbout()
       .subscribe(
@@ -31,7 +35,7 @@ export class AboutComponent implements OnInit {
           this.termsHTML = this.markdownService.textMarkdownToHTML(res.instance.terms)
         },
 
-        err => this.notificationsService.error('Error', err)
+        err => this.notificationsService.error('Error getting about from server', err)
       )
   }
 
index 206ec7bcd9ec446414272e1f5e3147ed5eaed79f..987d64d2aeb7f77938ac0b2379bf4c349bd302be 100644 (file)
@@ -5,6 +5,7 @@ import 'rxjs/add/operator/do'
 import { ReplaySubject } from 'rxjs/ReplaySubject'
 import { ServerConfig } from '../../../../../shared'
 import { About } from '../../../../../shared/models/server/about.model'
+import { ServerStats } from '../../../../../shared/models/server/server-stats.model'
 import { environment } from '../../../environments/environment'
 
 @Injectable()
@@ -51,6 +52,9 @@ export class ServerService {
       file: {
         extensions: []
       }
+    },
+    user: {
+      videoQuota: -1
     }
   }
   private videoCategories: Array<{ id: number, label: string }> = []
index 62a7839823a981ae259f9007849bd4203e7c4253..8d7fc8cf11a26d375187b715e6acfb1038cf3b18 100644 (file)
@@ -76,6 +76,9 @@ async function getConfig (req: express.Request, res: express.Response, next: exp
       file: {
         extensions: CONSTRAINTS_FIELDS.VIDEOS.EXTNAME
       }
+    },
+    user: {
+      videoQuota: CONFIG.USER.VIDEO_QUOTA
     }
   }
 
index c6fa651a8de9d0fd61ac145bbf78b7ac6ba43401..611d0efe5db9e2392b4adda1a1515486d49d812b 100644 (file)
@@ -39,4 +39,8 @@ export interface ServerConfig {
       extensions: string[]
     }
   }
+
+  user: {
+    videoQuota: number
+  }
 }