mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-12 17:49:37 +00:00
fix(automation): accept single-label OSC hosts
This commit is contained in:
@@ -18,7 +18,7 @@ describe('parseOutput', () => {
|
|||||||
it('parses a valid payload', () => {
|
it('parses a valid payload', () => {
|
||||||
const payload = {
|
const payload = {
|
||||||
type: 'osc',
|
type: 'osc',
|
||||||
targetIP: 'localhost',
|
targetIP: 'qlab',
|
||||||
targetPort: 1234,
|
targetPort: 1234,
|
||||||
address: '/test',
|
address: '/test',
|
||||||
args: 'test',
|
args: 'test',
|
||||||
|
|||||||
@@ -186,9 +186,9 @@ function parseOSCOutput(maybeOSCOutput: object): OSCOutput {
|
|||||||
assert.isString(maybeOSCOutput.args);
|
assert.isString(maybeOSCOutput.args);
|
||||||
|
|
||||||
const target = replaceAutomationTemplates(maybeOSCOutput.targetIP.trim(), 'template.local');
|
const target = replaceAutomationTemplates(maybeOSCOutput.targetIP.trim(), 'template.local');
|
||||||
const isHostname =
|
const isHostname = /^(?=.{1,253}$)[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*$/i.test(
|
||||||
target === 'localhost' ||
|
target,
|
||||||
/^(?=.{1,253}$)(?:[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?\.)+[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?$/i.test(target);
|
);
|
||||||
if (isIP(target) === 0 && !isHostname) {
|
if (isIP(target) === 0 && !isHostname) {
|
||||||
throw new Error('Invalid OSC target');
|
throw new Error('Invalid OSC target');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user