mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 02:09:37 +02:00
Execute Angular migrations
* inject() Function * signal inputs * outputs * signal queries * cleanup unused imports https://angular.dev/reference/migrations
This commit is contained in:
parent
8ae98c5ad5
commit
017795cf45
456 changed files with 6033 additions and 6590 deletions
|
@ -1,5 +1,5 @@
|
|||
import { NgFor, NgIf } from '@angular/common'
|
||||
import { Component, Input, OnInit } from '@angular/core'
|
||||
import { Component, OnInit, inject, model } from '@angular/core'
|
||||
import { ServerService } from '@app/core'
|
||||
import { formatICU } from '@app/helpers'
|
||||
import { ServerConfig, ServerStats } from '@peertube/peertube-models'
|
||||
|
@ -17,55 +17,54 @@ import { FeatureBooleanComponent } from './feature-boolean.component'
|
|||
imports: [ NgIf, FeatureBooleanComponent, HelpComponent, PeerTubeTemplateDirective, NgFor, BytesPipe ]
|
||||
})
|
||||
export class InstanceFeaturesTableComponent implements OnInit {
|
||||
@Input() serverConfig: ServerConfig
|
||||
@Input() serverStats: ServerStats
|
||||
private serverService = inject(ServerService)
|
||||
|
||||
readonly serverConfig = model<ServerConfig>(undefined)
|
||||
readonly serverStats = model<ServerStats>(undefined)
|
||||
|
||||
quotaHelpIndication = ''
|
||||
|
||||
constructor (
|
||||
private serverService: ServerService
|
||||
) { }
|
||||
|
||||
get initialUserVideoQuota () {
|
||||
return this.serverConfig.user.videoQuota
|
||||
return this.serverConfig().user.videoQuota
|
||||
}
|
||||
|
||||
get dailyUserVideoQuota () {
|
||||
return Math.min(this.initialUserVideoQuota, this.serverConfig.user.videoQuotaDaily)
|
||||
return Math.min(this.initialUserVideoQuota, this.serverConfig().user.videoQuotaDaily)
|
||||
}
|
||||
|
||||
get maxInstanceLives () {
|
||||
const value = this.serverConfig.live.maxInstanceLives
|
||||
const value = this.serverConfig().live.maxInstanceLives
|
||||
if (value === -1) return $localize`Unlimited`
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
get maxUserLives () {
|
||||
const value = this.serverConfig.live.maxUserLives
|
||||
const value = this.serverConfig().live.maxUserLives
|
||||
if (value === -1) return $localize`Unlimited`
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
ngOnInit () {
|
||||
const serverConfigObs = this.serverConfig
|
||||
? of(this.serverConfig)
|
||||
const serverConfig = this.serverConfig()
|
||||
const serverConfigObs = serverConfig
|
||||
? of(serverConfig)
|
||||
: this.serverService.getConfig()
|
||||
|
||||
serverConfigObs.subscribe(config => {
|
||||
this.serverConfig = config
|
||||
this.serverConfig.set(config)
|
||||
|
||||
this.buildQuotaHelpIndication()
|
||||
})
|
||||
|
||||
if (!this.serverStats) {
|
||||
this.serverService.getServerStats().subscribe(stats => this.serverStats = stats)
|
||||
if (!this.serverStats()) {
|
||||
this.serverService.getServerStats().subscribe(stats => this.serverStats.set(stats))
|
||||
}
|
||||
}
|
||||
|
||||
buildNSFWLabel () {
|
||||
const policy = this.serverConfig.instance.defaultNSFWPolicy
|
||||
const policy = this.serverConfig().instance.defaultNSFWPolicy
|
||||
|
||||
if (policy === 'do_not_list') return $localize`Hidden`
|
||||
if (policy === 'blur') return $localize`Blurred with confirmation request`
|
||||
|
@ -73,12 +72,12 @@ export class InstanceFeaturesTableComponent implements OnInit {
|
|||
}
|
||||
|
||||
buildRegistrationLabel () {
|
||||
const config = this.serverConfig.signup
|
||||
const config = this.serverConfig().signup
|
||||
|
||||
if (config.allowed !== true) return $localize`Disabled`
|
||||
|
||||
if (config.requiresApproval === true) {
|
||||
const responseTimeMS = this.serverStats?.averageRegistrationRequestResponseTimeMs
|
||||
const responseTimeMS = this.serverStats()?.averageRegistrationRequestResponseTimeMs
|
||||
|
||||
if (!responseTimeMS) {
|
||||
return $localize`Requires approval by moderators`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue