Fix #42: Visual editor empty if IP not set

realtime_play_button 2.4.3
Juraj Nyíri 3 years ago
parent c40e9e11cd
commit 531d19f584

@ -20041,7 +20041,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
} }
this.content.appendChild(this.protocol); this.content.appendChild(this.protocol);
this.ip.label = 'Plex IP Address / Hostname'; this.ip.label = 'Plex IP Address / Hostname';
if (this.config.ip) {
this.ip.value = this.config.ip.replace(/^https?\:\/\//i, '').replace(/\/$/, ''); this.ip.value = this.config.ip.replace(/^https?\:\/\//i, '').replace(/\/$/, '');
}
else {
this.ip.value = this.config.ip;
}
this.ip.addEventListener('change', this.valueUpdated); this.ip.addEventListener('change', this.valueUpdated);
this.content.appendChild(this.ip); this.content.appendChild(this.ip);
this.port.label = 'Plex Port (Optional)'; this.port.label = 'Plex Port (Optional)';

@ -268,7 +268,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement {
this.content.appendChild(this.protocol); this.content.appendChild(this.protocol);
this.ip.label = 'Plex IP Address / Hostname'; this.ip.label = 'Plex IP Address / Hostname';
if (this.config.ip) {
this.ip.value = this.config.ip.replace(/^https?\:\/\//i, '').replace(/\/$/, ''); this.ip.value = this.config.ip.replace(/^https?\:\/\//i, '').replace(/\/$/, '');
} else {
this.ip.value = this.config.ip;
}
this.ip.addEventListener('change', this.valueUpdated); this.ip.addEventListener('change', this.valueUpdated);
this.content.appendChild(this.ip); this.content.appendChild(this.ip);

Loading…
Cancel
Save