Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

show quota in stats, display quota on the about page, fixes #405 (#421)

Rigel Kent1869c87535d3
diff --git a/client/src/app/about/about.component.html b/client/src/app/about/about.component.html
index 3bb86208c5..bcb4ed2bec 100644
--- a/client/src/app/about/about.component.html
+++ b/client/src/app/about/about.component.html
@@ -13,6 +13,14 @@
<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">
diff --git a/client/src/app/about/about.component.ts b/client/src/app/about/about.component.ts
index adad32b263..7edc013e12 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 {
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)
)
}
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts
index 206ec7bcd9..987d64d2ae 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'
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 }> = []
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 62a7839823..8d7fc8cf11 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
file: {
extensions: CONSTRAINTS_FIELDS.VIDEOS.EXTNAME
}
+ },
+ user: {
+ videoQuota: CONFIG.USER.VIDEO_QUOTA
}
}
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts
index c6fa651a8d..611d0efe5d 100644
--- a/shared/models/server/server-config.model.ts
+++ b/shared/models/server/server-config.model.ts
@@ -39,4 +39,8 @@ export interface ServerConfig {
extensions: string[]
}
}
+
+ user: {
+ videoQuota: number
+ }
}