fix(recorders): resolve syntax error caused by double declaration of proto variable
This commit is contained in:
parent
a00e90ecc8
commit
7704988978
1 changed files with 3 additions and 2 deletions
|
|
@ -993,10 +993,11 @@ router.post('/probe', async (req, res) => {
|
|||
|
||||
// Validate URL up-front so we don't even let the capture service see junk.
|
||||
let parsed = null;
|
||||
let proto = '';
|
||||
if (url) {
|
||||
try { parsed = new URL(url); }
|
||||
catch { return res.status(400).json({ error: 'Invalid URL' }); }
|
||||
const proto = (parsed.protocol || '').replace(':', '').toLowerCase();
|
||||
proto = (parsed.protocol || '').replace(':', '').toLowerCase();
|
||||
if (!ALLOWED_PROBE_SCHEMES.has(proto)) {
|
||||
return res.status(400).json({ error: `Scheme "${proto}" is not permitted for probe (#104)` });
|
||||
}
|
||||
|
|
@ -1009,6 +1010,7 @@ router.post('/probe', async (req, res) => {
|
|||
if (parsed.hostname === 'mam-api' || parsed.hostname === 'localhost' || parsed.hostname === '127.0.0.1') {
|
||||
return res.status(403).json({ error: 'Internal probe target is not permitted' });
|
||||
}
|
||||
}
|
||||
|
||||
// Try the capture service first (5s timeout)
|
||||
try {
|
||||
|
|
@ -1033,7 +1035,6 @@ router.post('/probe', async (req, res) => {
|
|||
}
|
||||
|
||||
const host = parsed.hostname;
|
||||
const proto = (parsed.protocol || '').replace(':', '').toLowerCase();
|
||||
const isUdp = proto === 'srt' || source_type === 'srt';
|
||||
const port = parseInt(parsed.port, 10) || (isUdp ? 9000 : 1935);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue