Skip to content

Commit

Permalink
Resolved issue bitfocus#42
Browse files Browse the repository at this point in the history
Updated companion yarn dependencies.
Added additional null checks to hostname and targetPort.
Added regex and required fields to hostname and targetPort.
  • Loading branch information
logicallysynced committed Feb 9, 2025
1 parent 90e773d commit 5131c94
Show file tree
Hide file tree
Showing 3 changed files with 259 additions and 216 deletions.
20 changes: 15 additions & 5 deletions osc.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@ class OSCInstance extends InstanceBase {
}

let validate = false;

if (!isValidIPAddress(this.config.host)) {
if (!this.config.host) {
this.updateStatus('bad_config');
this.log('warn', 'No host specified in config (null)');
} else if (!this.config.targetPort) {
this.updateStatus('bad_config');
this.log('warn', 'No targetPort specified in config (null)');
} else if (!isValidIPAddress(this.config.host)) {
await resolveHostname(this, this.config.host)
.then ((ip) => {
this.targetHost = ip;
Expand Down Expand Up @@ -122,14 +127,17 @@ class OSCInstance extends InstanceBase {
type: 'textinput',
id: 'host',
label: 'Target Hostname or IP',
width: 8
width: 8,
regex: Regex.HOSTNAME,
required: true
},
{
type: 'textinput',
id: 'targetPort',
label: 'Target Port',
width: 4,
regex: Regex.PORT
regex: Regex.PORT,
required: true
},
{
type: 'dropdown',
Expand All @@ -141,14 +149,16 @@ class OSCInstance extends InstanceBase {
{ id: 'tcp-raw', label: 'TCP (Raw)' }
],
default: 'udp',
width: 4
width: 4,
required: true
},
{
type: 'checkbox',
id: 'listen',
label: 'Listen for Feedback',
width: 4,
default: false,
required: true
},
{
type: 'textinput',
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generic-osc",
"version": "2.4.1",
"version": "2.4.2",
"main": "osc.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand All @@ -12,12 +12,12 @@
"url": "git+https://github.com/bitfocus/companion-module-generic-osc.git"
},
"dependencies": {
"@companion-module/base": "^1.11.0",
"@companion-module/base": "^1.11.3",
"osc": "^2.4.4",
"osc-js": "^2.4.1"
},
"devDependencies": {
"@companion-module/tools": "^2.1.0"
"@companion-module/tools": "^2.1.1"
},
"prettier": "@companion-module/tools/.prettierrc.json"
}
Loading

0 comments on commit 5131c94

Please sign in to comment.