Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
Add support for server host in OBS
Browse files Browse the repository at this point in the history
  • Loading branch information
curtgrimes committed Jun 27, 2021
1 parent d69e5f3 commit d4a5403
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
39 changes: 38 additions & 1 deletion app/components/channels/editors/obs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,27 @@
</strong>
{{ savedChannel.error }}
</div>
<label for="port" class="small">Server Port</label>
<div class="d-flex">
<label for="port" class="small mr-auto"
>Server <span v-if="showHostField">Host and</span> Port</label
>
<a
href="javascript:void(0)"
class="small"
@click="showHostField = !showHostField"
>{{ showHostField ? 'Hide' : '' }} Advanced Settings</a
>
</div>
<input
v-if="showHostField"
id="host"
name="host"
v-model="host"
autofocus
class="form-control mb-3"
type="text"
placeholder="Server Host"
/>
<input
id="port"
name="port"
Expand Down Expand Up @@ -92,19 +112,25 @@ export default {
},
},
mounted() {
this.host = this.savedChannel?.parameters?.host || 'localhost';
this.port = this.savedChannel?.parameters?.port;
this.password = this.savedChannel?.parameters?.password;
this.showHostField = this.host && this.host !== 'localhost';
},
data() {
return {
host: null,
port: 4444,
password: null,
showPassword: false,
showHostField: false,
};
},
methods: {
handleParameterChange() {
this.$emit('parametersUpdated', {
host: this.host,
port: this.port,
...(this.password ? { password: this.password } : {}),
});
Expand All @@ -117,6 +143,17 @@ export default {
},
},
watch: {
showHostField() {
if (!this.showHostField) {
this.host = null;
}
},
host: {
immediate: true,
handler() {
this.handleParameterChange();
},
},
port: {
immediate: true,
handler() {
Expand Down
4 changes: 3 additions & 1 deletion app/plugins/channels/obs.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export default async ({ $store, $axios, channelId, channelParameters }) => {
let obs = new OBSWebSocket();
try {
await obs.connect({
address: `localhost:${channelParameters.port}`,
address: `${channelParameters.host || 'localhost'}:${
channelParameters.port
}`,
password: channelParameters.password,
});

Expand Down

0 comments on commit d4a5403

Please sign in to comment.