diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 7b56987..2c20cb4 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -19621,7 +19621,11 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { this.content.appendChild(plexTitle); this.protocol.innerHTML = ''; const protocolItems = document.createElement('paper-listbox'); - protocolItems.appendChild(addDropdownItem('http')); + // eslint-disable-next-line no-restricted-globals + const pageProtocol = location.protocol; + if (lodash.isEqual(pageProtocol, 'http:')) { + protocolItems.appendChild(addDropdownItem('http')); + } protocolItems.appendChild(addDropdownItem('https')); protocolItems.slot = 'dropdown-content'; this.protocol.label = 'Plex Protocol'; @@ -19629,7 +19633,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { this.protocol.style.width = '100%'; this.protocol.addEventListener('value-changed', this.valueUpdated); if (lodash.isEmpty(this.config.protocol)) { - this.protocol.value = 'http'; + if (lodash.isEqual(pageProtocol, 'http:')) { + this.protocol.value = 'http'; + } + else { + this.protocol.value = 'https'; + } } else { this.protocol.value = this.config.protocol; @@ -19945,12 +19954,17 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { else { this.plexPort = false; } + // eslint-disable-next-line no-restricted-globals + const pageProtocol = location.protocol; if (config.protocol) { this.plexProtocol = config.protocol; } - else { + else if (lodash.isEqual(pageProtocol, 'http:')) { this.config.protocol = 'http'; } + else { + this.config.protocol = 'https'; + } if (!config.sort) { this.config.sort = 'titleSort:asc'; } diff --git a/src/editor.ts b/src/editor.ts index 4c7a653..8646a00 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -219,7 +219,11 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { this.protocol.innerHTML = ''; const protocolItems: any = document.createElement('paper-listbox'); - protocolItems.appendChild(addDropdownItem('http')); + // eslint-disable-next-line no-restricted-globals + const pageProtocol = location.protocol; + if (_.isEqual(pageProtocol, 'http:')) { + protocolItems.appendChild(addDropdownItem('http')); + } protocolItems.appendChild(addDropdownItem('https')); protocolItems.slot = 'dropdown-content'; this.protocol.label = 'Plex Protocol'; @@ -227,7 +231,11 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { this.protocol.style.width = '100%'; this.protocol.addEventListener('value-changed', this.valueUpdated); if (_.isEmpty(this.config.protocol)) { - this.protocol.value = 'http'; + if (_.isEqual(pageProtocol, 'http:')) { + this.protocol.value = 'http'; + } else { + this.protocol.value = 'https'; + } } else { this.protocol.value = this.config.protocol; } @@ -556,10 +564,14 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { this.plexPort = false; } + // eslint-disable-next-line no-restricted-globals + const pageProtocol = location.protocol; if (config.protocol) { this.plexProtocol = config.protocol; - } else { + } else if (_.isEqual(pageProtocol, 'http:')) { this.config.protocol = 'http'; + } else { + this.config.protocol = 'https'; } if (!config.sort) {