mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Lazy load static objects
This commit is contained in:
parent
5dfb7c1dec
commit
ba430d7516
55 changed files with 554 additions and 365 deletions
|
@ -10,7 +10,7 @@ import { ServerConfig } from '@shared/models'
|
|||
})
|
||||
export class InstanceFeaturesTableComponent implements OnInit {
|
||||
quotaHelpIndication = ''
|
||||
config: ServerConfig
|
||||
serverConfig: ServerConfig
|
||||
|
||||
constructor (
|
||||
private i18n: I18n,
|
||||
|
@ -19,29 +19,34 @@ export class InstanceFeaturesTableComponent implements OnInit {
|
|||
}
|
||||
|
||||
get initialUserVideoQuota () {
|
||||
return this.serverService.getConfig().user.videoQuota
|
||||
return this.serverConfig.user.videoQuota
|
||||
}
|
||||
|
||||
get dailyUserVideoQuota () {
|
||||
return Math.min(this.initialUserVideoQuota, this.serverService.getConfig().user.videoQuotaDaily)
|
||||
return Math.min(this.initialUserVideoQuota, this.serverConfig.user.videoQuotaDaily)
|
||||
}
|
||||
|
||||
ngOnInit () {
|
||||
this.serverService.configLoaded
|
||||
.subscribe(() => {
|
||||
this.config = this.serverService.getConfig()
|
||||
this.serverConfig = this.serverService.getTmpConfig()
|
||||
this.serverService.getConfig()
|
||||
.subscribe(config => {
|
||||
this.serverConfig = config
|
||||
this.buildQuotaHelpIndication()
|
||||
})
|
||||
}
|
||||
|
||||
buildNSFWLabel () {
|
||||
const policy = this.serverService.getConfig().instance.defaultNSFWPolicy
|
||||
const policy = this.serverConfig.instance.defaultNSFWPolicy
|
||||
|
||||
if (policy === 'do_not_list') return this.i18n('Hidden')
|
||||
if (policy === 'blur') return this.i18n('Blurred with confirmation request')
|
||||
if (policy === 'display') return this.i18n('Displayed')
|
||||
}
|
||||
|
||||
getServerVersionAndCommit () {
|
||||
return this.serverService.getServerVersionAndCommit()
|
||||
}
|
||||
|
||||
private getApproximateTime (seconds: number) {
|
||||
const hours = Math.floor(seconds / 3600)
|
||||
let pluralSuffix = ''
|
||||
|
@ -53,10 +58,6 @@ export class InstanceFeaturesTableComponent implements OnInit {
|
|||
return this.i18n('~ {{minutes}} {minutes, plural, =1 {minute} other {minutes}}', { minutes })
|
||||
}
|
||||
|
||||
getServerVersionAndCommit () {
|
||||
return this.serverService.getServerVersionAndCommit()
|
||||
}
|
||||
|
||||
private buildQuotaHelpIndication () {
|
||||
if (this.initialUserVideoQuota === -1) return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue