mirror of https://github.com/Chocobozzz/PeerTube
Fix custom server configuration numbers
parent
fc62e39c0b
commit
be1fc4bc50
|
@ -13,14 +13,26 @@
|
||||||
<div class="section-title">Terms</div>
|
<div class="section-title">Terms</div>
|
||||||
|
|
||||||
<div [innerHTML]="termsHTML"></div>
|
<div [innerHTML]="termsHTML"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div *ngIf="userVideoQuota !== -1;else noQuota">
|
<div class="signup">
|
||||||
This instance provides a baseline quota of {{ userVideoQuota | bytes: 0 }} space for the videos of its users.
|
<div class="section-title">Signup</div>
|
||||||
|
|
||||||
|
<div *ngIf="isSignupAllowed">
|
||||||
|
User registration is allowed and
|
||||||
|
|
||||||
|
<ng-template [ngIf]="userVideoQuota !== -1">
|
||||||
|
this instance provides a baseline quota of {{ userVideoQuota | bytes }} space for the videos of its users.
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template [ngIf]="userVideoQuota === -1">
|
||||||
|
this instance provides unlimited space for the videos of its users.
|
||||||
|
</ng-template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="isSignupAllowed === false">
|
||||||
|
User registration is currently not allowed.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ng-template #noQuota>
|
|
||||||
This instance provides unlimited space for the videos of its users.
|
|
||||||
</ng-template>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="p2p-privacy">
|
<div id="p2p-privacy">
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.description, .terms {
|
.description, .terms, .signup {
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,10 @@ export class AboutComponent implements OnInit {
|
||||||
return this.serverService.getConfig().user.videoQuota
|
return this.serverService.getConfig().user.videoQuota
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isSignupAllowed () {
|
||||||
|
return this.serverService.getConfig().signup.allowed
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.serverService.getAbout()
|
this.serverService.getAbout()
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|
|
@ -117,14 +117,17 @@ async function deleteCustomConfig (req: express.Request, res: express.Response,
|
||||||
async function updateCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
|
async function updateCustomConfig (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||||
const toUpdate: CustomConfig = req.body
|
const toUpdate: CustomConfig = req.body
|
||||||
|
|
||||||
// Need to change the videoQuota key a little bit
|
// Force number conversion
|
||||||
const toUpdateJSON = omit(toUpdate, 'videoQuota')
|
toUpdate.cache.previews.size = parseInt('' + toUpdate.cache.previews.size, 10)
|
||||||
|
toUpdate.signup.limit = parseInt('' + toUpdate.signup.limit, 10)
|
||||||
|
toUpdate.user.videoQuota = parseInt('' + toUpdate.user.videoQuota, 10)
|
||||||
|
toUpdate.transcoding.threads = parseInt('' + toUpdate.transcoding.threads, 10)
|
||||||
|
|
||||||
|
// camelCase to snake_case key
|
||||||
|
const toUpdateJSON = omit(toUpdate, 'user.videoQuota', 'instance.defaultClientRoute', 'instance.shortDescription')
|
||||||
toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota
|
toUpdateJSON.user['video_quota'] = toUpdate.user.videoQuota
|
||||||
toUpdateJSON.instance['default_client_route'] = toUpdate.instance.defaultClientRoute
|
toUpdateJSON.instance['default_client_route'] = toUpdate.instance.defaultClientRoute
|
||||||
toUpdateJSON.instance['short_description'] = toUpdate.instance.shortDescription
|
toUpdateJSON.instance['short_description'] = toUpdate.instance.shortDescription
|
||||||
delete toUpdate.user.videoQuota
|
|
||||||
delete toUpdate.instance.defaultClientRoute
|
|
||||||
delete toUpdate.instance.shortDescription
|
|
||||||
|
|
||||||
await writeFilePromise(CONFIG.CUSTOM_FILE, JSON.stringify(toUpdateJSON, undefined, 2))
|
await writeFilePromise(CONFIG.CUSTOM_FILE, JSON.stringify(toUpdateJSON, undefined, 2))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue