Add srt passphrase validation + fix srt.token injection

This commit is contained in:
Jan Stabenow 2022-07-14 22:55:46 +02:00
parent 5ccf1d552f
commit bc7697ad57
No known key found for this signature in database
GPG Key ID: 9C22DD65A9AAF133
5 changed files with 25 additions and 3 deletions

View File

@ -53,6 +53,8 @@ export default function Password(props) {
endAdornment={adornment}
label={props.label}
autoComplete={props.autoComplete}
inputProps={props.inputProps}
error={props.error}
/>
{props.helperText && <FormHelperText>{props.helperText}</FormHelperText>}
</FormControl>
@ -67,6 +69,8 @@ Password.defaultProps = {
autoComplete: 'current-password',
env: false,
show: false,
helperText: null,
helperText: false,
inputProps: false,
error: false,
onChange: function (value) {},
};

View File

@ -0,0 +1,11 @@
/* eslint-disable import/no-anonymous-default-export */
import base from '../base';
export default {
styleOverrides: {
root: {
color: base.palette.error.main,
marginLeft: 0,
},
},
};

View File

@ -16,6 +16,7 @@ import dialog from './components/dialog';
import divider from './components/divider';
import fab from './components/fab';
import formControlLabel from './components/formControlLabel';
import formHelperText from './components/formHelperText';
import formLabel from './components/formLabel';
import iconButton from './components/iconButton';
import inputLabel from './components/inputLabel';
@ -61,6 +62,7 @@ const theme = createTheme({
MuiDivider: { ...divider },
MuiFab: { ...fab },
MuiFormControlLabel: { ...formControlLabel },
MuiFormHelperText: { ...formHelperText },
MuiFormLabel: { ...formLabel },
MuiIconButton: { ...iconButton },
MuiInputLabel: { ...inputLabel },

View File

@ -981,7 +981,7 @@ class Restreamer {
address =
`srt://${host}${port}/?mode=caller&transtype=live&streamid=#!:m=request,r=${channelId}` +
(cfg.token.length !== 0 ? `,token=${cfg.srt.token}` : '') +
(cfg.token.length !== 0 ? `,token=${cfg.token}` : '') +
(cfg.passphrase.length !== 0 ? `&passphrase=${cfg.passphrase}` : '');
} else if (what && what === 'snapshot+memfs') {
// snapshot+memfs

View File

@ -1491,7 +1491,9 @@ export default function Settings(props) {
<Checkbox
label={<Trans>Login/JWT authorization</Trans>}
checked={config.api.auth.enable}
disabled={env('api.auth.enable')}
// prob: interface enforces auth.
// disabled={env('api.auth.enable')}
disabled
onChange={handleChange('api.auth.enable')}
/>{' '}
{env('api.auth.enable') && <Env />}
@ -1970,6 +1972,9 @@ export default function Settings(props) {
disabled={env('srt.passphrase') || !config.srt.enable}
value={config.srt.passphrase}
onChange={handleChange('srt.passphrase')}
inputProps={{ maxLength: 79 }}
error={config.srt.passphrase && config.srt.passphrase.length < 10}
helperText={config.srt.passphrase && config.srt.passphrase.length < 10 ? (<Trans>Passphrase must be between 10 and 79 characters long</Trans>) : false}
/>
<ErrorBox configvalue="srt.passphrase" messages={$tabs.srt.messages} />
<Typography variant="caption">