import { Component, OnInit } from '@angular/core'
import { ServerService } from '@app/core'
import { I18n } from '@ngx-translate/i18n-polyfill'
-import { ServerConfig } from '../../../../../shared'
+import { ServerConfig } from '@shared/models'
@Component({
selector: 'my-instance-features-table',
styleUrls: [ './instance-features-table.component.scss' ]
})
export class InstanceFeaturesTableComponent implements OnInit {
- features: { label: string, value?: boolean }[] = []
quotaHelpIndication = ''
+ config: ServerConfig
constructor (
private i18n: I18n,
}
get dailyUserVideoQuota () {
- return this.serverService.getConfig().user.videoQuotaDaily
+ return Math.min(this.initialUserVideoQuota, this.serverService.getConfig().user.videoQuotaDaily)
}
ngOnInit () {
this.serverService.configLoaded
.subscribe(() => {
- this.buildFeatures()
+ this.config = this.serverService.getConfig()
this.buildQuotaHelpIndication()
})
}
if (policy === 'display') return this.i18n('Displayed')
}
- private buildFeatures () {
- const config = this.serverService.getConfig()
-
- this.features = [
- {
- label: this.i18n('User registration allowed'),
- value: config.signup.allowed
- },
- {
- label: this.i18n('Transcode your videos in multiple resolutions'),
- value: config.transcoding.enabledResolutions.length !== 0
- },
- {
- label: this.i18n('HTTP import (YouTube, Vimeo, direct URL...)'),
- value: config.import.videos.http.enabled
- },
- {
- label: this.i18n('Torrent import'),
- value: config.import.videos.torrent.enabled
- }
- ]
- }
-
private getApproximateTime (seconds: number) {
const hours = Math.floor(seconds / 3600)
let pluralSuffix = ''