From 46221d02a76d3fbe8284c263e234c00be38e8b15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Mon, 12 Jul 2021 14:09:02 +0200 Subject: [PATCH] no message --- dist/plex-meets-homeassistant.js | 22 +++++++++++----------- src/editor.ts | 16 +++++++--------- src/plex-meets-homeassistant.ts | 4 +++- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 0111357..de4c755 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -19594,14 +19594,9 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { this.appendChild(this.content); // todo: do verify better, do not query plex every time this.sections = []; - if (this.plex) { - try { - this.sections = await this.plex.getSections(); - } - catch (err) { - // pass - } - } + console.log(this.plexPort); + this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort); + this.sections = await this.plex.getSections(); this.plexValidSection.style.display = 'none'; this.plexValidSection.innerHTML = ''; const viewTitle = document.createElement('h2'); @@ -19707,9 +19702,12 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { }; this.setConfig = (config) => { this.config = JSON.parse(JSON.stringify(config)); - if (config.port) { + if (config.port && !lodash.isEqual(config.port, '')) { this.plexPort = config.port; } + else { + this.plexPort = false; + } if (config.protocol) { this.plexProtocol = config.protocol; } @@ -19719,7 +19717,6 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { if (!config.sort) { this.config.sort = 'titleSort:asc'; } - this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort); this.render(); }; this.configChanged = (newConfig) => { @@ -21746,9 +21743,12 @@ class PlexMeetsHomeAssistant extends HTMLElement { if (config.protocol) { this.plexProtocol = config.protocol; } - if (config.port) { + if (config.port && !lodash.isEqual(config.port, '')) { this.plexPort = config.port; } + else { + this.plexPort = false; + } if (config.maxCount && config.maxCount !== '') { this.maxCount = config.maxCount; } diff --git a/src/editor.ts b/src/editor.ts index af7420f..1b1f25d 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -197,13 +197,10 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { // todo: do verify better, do not query plex every time this.sections = []; - if (this.plex) { - try { - this.sections = await this.plex.getSections(); - } catch (err) { - // pass - } - } + + console.log(this.plexPort); + this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort); + this.sections = await this.plex.getSections(); this.plexValidSection.style.display = 'none'; this.plexValidSection.innerHTML = ''; @@ -316,8 +313,10 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { setConfig = (config: Record): void => { this.config = JSON.parse(JSON.stringify(config)); - if (config.port) { + if (config.port && !_.isEqual(config.port, '')) { this.plexPort = config.port; + } else { + this.plexPort = false; } if (config.protocol) { @@ -330,7 +329,6 @@ class PlexMeetsHomeAssistantEditor extends HTMLElement { this.config.sort = 'titleSort:asc'; } - this.plex = new Plex(this.config.ip, this.plexPort, this.config.token, this.plexProtocol, this.config.sort); this.render(); }; diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index ea35df8..355a0ff 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -1526,8 +1526,10 @@ class PlexMeetsHomeAssistant extends HTMLElement { if (config.protocol) { this.plexProtocol = config.protocol; } - if (config.port) { + if (config.port && !_.isEqual(config.port, '')) { this.plexPort = config.port; + } else { + this.plexPort = false; } if (config.maxCount && config.maxCount !== '') { this.maxCount = config.maxCount;