fix(automation): accept single-label OSC hosts

This commit is contained in:
Carlos Valente
2026-09-11 20:06:01 +02:00
parent dc2d193156
commit 397b54a472
2 changed files with 4 additions and 4 deletions
@@ -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');
}