mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-12 09:39: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', () => {
|
||||
const payload = {
|
||||
type: 'osc',
|
||||
targetIP: 'localhost',
|
||||
targetIP: 'qlab',
|
||||
targetPort: 1234,
|
||||
address: '/test',
|
||||
args: 'test',
|
||||
|
||||
@@ -186,9 +186,9 @@ function parseOSCOutput(maybeOSCOutput: object): OSCOutput {
|
||||
assert.isString(maybeOSCOutput.args);
|
||||
|
||||
const target = replaceAutomationTemplates(maybeOSCOutput.targetIP.trim(), 'template.local');
|
||||
const isHostname =
|
||||
target === 'localhost' ||
|
||||
/^(?=.{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);
|
||||
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,
|
||||
);
|
||||
if (isIP(target) === 0 && !isHostname) {
|
||||
throw new Error('Invalid OSC target');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user