aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-06 16:43:15 +0100
committerChocobozzz <me@florianbigard.com>2020-01-06 17:10:02 +0100
commit04cda1d7a5f27429acde3ecd9c3c6e18a2b44aed (patch)
treef552ccf360f610f0c8dafe204f8a35022b1a00b4 /client/src/app/+admin
parentc10b638c4b52e9766ef68b58849ee0728647988f (diff)
downloadPeerTube-04cda1d7a5f27429acde3ecd9c3c6e18a2b44aed.tar.gz
PeerTube-04cda1d7a5f27429acde3ecd9c3c6e18a2b44aed.tar.zst
PeerTube-04cda1d7a5f27429acde3ecd9c3c6e18a2b44aed.zip
Add warning if admin disables webtorrent
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html4
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts73
2 files changed, 55 insertions, 22 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
index 27f5ef722..ac0447d25 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
@@ -502,6 +502,10 @@
502 <strong>Experimental, we suggest you to not disable webtorrent support for now</strong> 502 <strong>Experimental, we suggest you to not disable webtorrent support for now</strong>
503 503
504 <p>If you also enabled HLS support, it will multiply videos storage by 2</p> 504 <p>If you also enabled HLS support, it will multiply videos storage by 2</p>
505
506 <br />
507
508 <strong>If disabled, breaks federation with PeerTube instances < 2.1</strong>
505 </ng-container> 509 </ng-container>
506 </ng-template> 510 </ng-template>
507 </my-peertube-checkbox> 511 </my-peertube-checkbox>
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
index 3fda0851e..49bb4db0e 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
@@ -222,25 +222,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
222 } 222 }
223 223
224 this.buildForm(formGroupData) 224 this.buildForm(formGroupData)
225 225 this.loadForm()
226 forkJoin([ 226 this.checkTranscodingFields()
227 this.configService.getCustomConfig(),
228 this.serverService.getVideoLanguages(),
229 this.serverService.getVideoCategories()
230 ]).subscribe(
231 ([ config, languages, categories ]) => {
232 this.customConfig = config
233
234 this.languageItems = languages.map(l => ({ label: l.label, value: l.id }))
235 this.categoryItems = categories.map(l => ({ label: l.label, value: l.id }))
236
237 this.updateForm()
238 // Force form validation
239 this.forceCheck()
240 },
241
242 err => this.notifier.error(err.message)
243 )
244 } 227 }
245 228
246 isTranscodingEnabled () { 229 isTranscodingEnabled () {
@@ -252,9 +235,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
252 } 235 }
253 236
254 async formValidated () { 237 async formValidated () {
255 this.configService.updateCustomConfig(this.form.value) 238 this.configService.updateCustomConfig(this.form.getRawValue())
256 .pipe(
257 )
258 .subscribe( 239 .subscribe(
259 res => { 240 res => {
260 this.customConfig = res 241 this.customConfig = res
@@ -290,4 +271,52 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
290 private updateForm () { 271 private updateForm () {
291 this.form.patchValue(this.customConfig) 272 this.form.patchValue(this.customConfig)
292 } 273 }
274
275 private loadForm () {
276 forkJoin([
277 this.configService.getCustomConfig(),
278 this.serverService.getVideoLanguages(),
279 this.serverService.getVideoCategories()
280 ]).subscribe(
281 ([ config, languages, categories ]) => {
282 this.customConfig = config
283
284 this.languageItems = languages.map(l => ({ label: l.label, value: l.id }))
285 this.categoryItems = categories.map(l => ({ label: l.label, value: l.id }))
286
287 this.updateForm()
288 // Force form validation
289 this.forceCheck()
290 },
291
292 err => this.notifier.error(err.message)
293 )
294 }
295
296 private checkTranscodingFields () {
297 const hlsControl = this.form.get('transcoding.hls.enabled')
298 const webtorrentControl = this.form.get('transcoding.webtorrent.enabled')
299
300 webtorrentControl.valueChanges
301 .subscribe(newValue => {
302 if (newValue === false && !hlsControl.disabled) {
303 hlsControl.disable()
304 }
305
306 if (newValue === true && !hlsControl.enabled) {
307 hlsControl.enable()
308 }
309 })
310
311 hlsControl.valueChanges
312 .subscribe(newValue => {
313 if (newValue === false && !webtorrentControl.disabled) {
314 webtorrentControl.disable()
315 }
316
317 if (newValue === true && !webtorrentControl.enabled) {
318 webtorrentControl.enable()
319 }
320 })
321 }
293} 322}