Add a check for passthrough and not ffmpeg

This commit is contained in:
Isaac Connor 2021-01-29 09:53:11 -05:00
parent be95bd2fa7
commit ae41998d7c
2 changed files with 7 additions and 0 deletions

View File

@ -175,6 +175,7 @@ $SLANG = array(
'BadNameChars' => 'Names may only contain alphanumeric characters plus spaces, hyphen and underscore', 'BadNameChars' => 'Names may only contain alphanumeric characters plus spaces, hyphen and underscore',
'BadPalette' => 'Palette must be set to a valid value', 'BadPalette' => 'Palette must be set to a valid value',
'BadColours' => 'Target colour must be set to a valid value', 'BadColours' => 'Target colour must be set to a valid value',
'BadPassthrough' => 'Passthrough only works with ffmpeg type monitors.',
'BadPath' => 'Path must be set to a valid value', 'BadPath' => 'Path must be set to a valid value',
'BadPort' => 'Port must be set to a valid number', 'BadPort' => 'Port must be set to a valid number',
'BadPostEventCount' => 'Post event image count must be an integer of zero or more', 'BadPostEventCount' => 'Post event image count must be an integer of zero or more',

View File

@ -56,6 +56,8 @@ function validateForm( form ) {
errors[errors.length] = "<?php echo translate('BadChannel') ?>"; errors[errors.length] = "<?php echo translate('BadChannel') ?>";
if ( !form.elements['newMonitor[Format]'].value || !form.elements['newMonitor[Format]'].value.match( /^\d+$/ ) ) if ( !form.elements['newMonitor[Format]'].value || !form.elements['newMonitor[Format]'].value.match( /^\d+$/ ) )
errors[errors.length] = "<?php echo translate('BadFormat') ?>"; errors[errors.length] = "<?php echo translate('BadFormat') ?>";
if ( form.elements['newMonitor[VideoWriter]'].value == 2 /* Passthrough */ )
errors[errors.length] = "<?php echo translate('BadPassthrough') ?>";
} else if ( form.elements['newMonitor[Type]'].value == 'Remote' ) { } else if ( form.elements['newMonitor[Type]'].value == 'Remote' ) {
//if ( !form.elements['newMonitor[Host]'].value || !form.elements['newMonitor[Host]'].value.match( /^[0-9a-zA-Z_.:@-]+$/ ) ) //if ( !form.elements['newMonitor[Host]'].value || !form.elements['newMonitor[Host]'].value.match( /^[0-9a-zA-Z_.:@-]+$/ ) )
//errors[errors.length] = "<?php echo translate('BadHost') ?>"; //errors[errors.length] = "<?php echo translate('BadHost') ?>";
@ -63,6 +65,8 @@ function validateForm( form ) {
errors[errors.length] = "<?php echo translate('BadPort') ?>"; errors[errors.length] = "<?php echo translate('BadPort') ?>";
//if ( !form.elements['newMonitor[Path]'].value ) //if ( !form.elements['newMonitor[Path]'].value )
//errors[errors.length] = "<?php echo translate('BadPath') ?>"; //errors[errors.length] = "<?php echo translate('BadPath') ?>";
if ( form.elements['newMonitor[VideoWriter]'].value == 2 /* Passthrough */ )
errors[errors.length] = "<?php echo translate('BadPassthrough') ?>";
} else if ( form.elements['newMonitor[Type]'].value == 'Ffmpeg' ) { } else if ( form.elements['newMonitor[Type]'].value == 'Ffmpeg' ) {
if ( !form.elements['newMonitor[Path]'].value ) if ( !form.elements['newMonitor[Path]'].value )
//|| !form.elements['newMonitor[Path]'].value.match( /^\d+$/ ) ) // valid url //|| !form.elements['newMonitor[Path]'].value.match( /^\d+$/ ) ) // valid url
@ -71,6 +75,8 @@ function validateForm( form ) {
} else if ( form.elements['newMonitor[Type]'].value == 'File' ) { } else if ( form.elements['newMonitor[Type]'].value == 'File' ) {
if ( !form.elements['newMonitor[Path]'].value ) if ( !form.elements['newMonitor[Path]'].value )
errors[errors.length] = "<?php echo translate('BadPath') ?>"; errors[errors.length] = "<?php echo translate('BadPath') ?>";
if ( form.elements['newMonitor[VideoWriter]'].value == 2 /* Passthrough */ )
errors[errors.length] = "<?php echo translate('BadPassthrough') ?>";
} else if ( form.elements['newMonitor[Type]'].value == 'WebSite' ) { } else if ( form.elements['newMonitor[Type]'].value == 'WebSite' ) {
if ( form.elements['newMonitor[Function]'].value != 'Monitor' && form.elements['newMonitor[Function]'].value != 'None') if ( form.elements['newMonitor[Function]'].value != 'Monitor' && form.elements['newMonitor[Function]'].value != 'None')
errors[errors.length] = "<?php echo translate('BadSourceType') ?>"; errors[errors.length] = "<?php echo translate('BadSourceType') ?>";