From a6d716bf69c67b67f53168fb312e5a684f55964d Mon Sep 17 00:00:00 2001 From: UKDTOM Date: Mon, 19 Jul 2021 22:35:08 +0200 Subject: [PATCH] fixed #395 --- CHANGELOG.md | 4 ++++ package.json | 2 +- public/locales/en.json | 4 +++- src/background.js | 1 + src/components/modules/ExportTools/Export.vue | 7 ++++++- src/components/modules/ExportTools/scripts/et.js | 13 ++++++++----- .../modules/ExportTools/scripts/ethelper.js | 2 ++ src/i18n.js | 8 ++++---- src/store/modules/plextv.js | 14 +++++++++----- 9 files changed, 38 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d6e9f0..849ad76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # ![Logo](https://github.com/WebTools-NG/WebTools-NG/blob/master/src/assets/WebTools-48x48.png) WebTools-ng Change log +## V0.3.13 + +* [#395 Show alert if we can't connect to plex.tv](https://github.com/WebTools-NG/WebTools-NG/issues/395) + ## V0.3.12 * [#382 Exporting Posters and Art not working (Revisit)](https://github.com/WebTools-NG/WebTools-NG/issues/382) diff --git a/package.json b/package.json index 0e7ac2d..2facaae 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "webtools-ng", "productName": "WebTools-NG", - "version": "0.3.12", + "version": "0.3.13", "description": "WebTools Next Generation 4 Plex", "author": "dane22 & CPSO", "license": "MPL-2.0", diff --git a/public/locales/en.json b/public/locales/en.json index 1416f0c..e7cf004 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -40,7 +40,9 @@ "LoginBtn": "Sign in", "twoFA": "2Factor Authentication verification code", "twoFAPrompt": "If using 2FA, enter your code here, else leave as blank (optional)", - "Missing2FACode": "Please enter the verification code" + "Missing2FACode": "Please enter the verification code", + "LoginConnectErrToken": "Could not connect to plex.tv with a Token", + "LoginConnectErr": "Could not connect to plex.tv" }, "SelServer": "Select Server", "Menu": { diff --git a/src/background.js b/src/background.js index dd59717..ee5da6c 100644 --- a/src/background.js +++ b/src/background.js @@ -30,6 +30,7 @@ function createWindow () { // Create the browser window. win = new BrowserWindow({ width: 1024, height: 768, icon: __dirname + "/../src/assets/WebTools-512.png", webPreferences: { nodeIntegration: true, + contextIsolation: false, webSecurity: false, enableRemoteModule: true } }) diff --git a/src/components/modules/ExportTools/Export.vue b/src/components/modules/ExportTools/Export.vue index e3bd1cb..49bd632 100644 --- a/src/components/modules/ExportTools/Export.vue +++ b/src/components/modules/ExportTools/Export.vue @@ -382,7 +382,12 @@ this.selLibrary = ''; this.selLibraryOptions = []; this.exportLevels = []; - this.selExpTypeMain= arguments[0]; + this.selExpTypeMain = arguments[0]; + console.log('Ged 99: ' + JSON.stringify(arguments[0])) + console.log('Ged 99-2: ' + JSON.stringify(et.selSecOption[arguments[0]])) + console.log('Ged 99-3: ' + i18n.t('Modules.ET.optExpType.SecMovies')) + console.log('Ged 99-4: ' + JSON.stringify(et.selSecOption2[arguments[0]])) + this.optExpTypeSec = et.selSecOption[arguments[0]] log.verbose(`Export Main type selected: ${arguments[0]}`); }, diff --git a/src/components/modules/ExportTools/scripts/et.js b/src/components/modules/ExportTools/scripts/et.js index d2151f1..f2abffa 100644 --- a/src/components/modules/ExportTools/scripts/et.js +++ b/src/components/modules/ExportTools/scripts/et.js @@ -9,7 +9,9 @@ const defpostURI = '?checkFiles=1&includeRelated=0&includeExtras=1&includeBandwi import {wtconfig, wtutils} from '../../General/wtutils'; import {csv} from './csv'; import {etHelper} from './ethelper'; -import i18n from '../../../../i18n'; +//import i18n from '../../../../i18n'; + +import i18n from '../../../../i18n' import {ipcRenderer} from 'electron'; //const fs = require('fs'); @@ -75,6 +77,10 @@ const et = new class ET { 2003: 'Photo', 3001: 'Playlists' }, + this.selSecOption2 = { + 1: ['Modules.ET.optExpType.SecMovies'], + 2: ['Modules.ET.optExpType.SecTVEpisodes'] + } this.selSecOption = { 1: [ { @@ -301,9 +307,7 @@ const et = new class ET { //await csv.addHeaderToTmp({ stream: stream, item: fields}); // TODO: Add XLS Header } - console.log('Ged 4-5') - log.debug(`Got level as: ${etHelper.Settings.Level} and libType as: ${etHelper.Settings.libType}`) // Get element and postURI @@ -313,8 +317,7 @@ const et = new class ET { element, postURI - console.log(`Ged 55-1 Element: ` + element) - console.log(`Ged 55-2 postURI: ` + postURI) + diff --git a/src/components/modules/ExportTools/scripts/ethelper.js b/src/components/modules/ExportTools/scripts/ethelper.js index e61a85c..fd2bceb 100644 --- a/src/components/modules/ExportTools/scripts/ethelper.js +++ b/src/components/modules/ExportTools/scripts/ethelper.js @@ -80,6 +80,7 @@ const etHelper = new class ETHELPER { default: element = '/library/sections/' + this.selLibKey + '/all'; } + log.debug(`Got element as ${element}`); return element; } @@ -104,6 +105,7 @@ const etHelper = new class ETHELPER { default: postURI = `?X-Plex-Container-Size=${step}&type=${this.Settings.libTypeSec}&${this.uriParams}&X-Plex-Container-Start=`; } + log.debug(`Got postURI as ${postURI}`); return postURI; } diff --git a/src/i18n.js b/src/i18n.js index 74dc0fc..9a21981 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -8,15 +8,15 @@ log.transports.file.fileName = wtutils.logFileName; Vue.use(VueI18n) -function loadLocaleMessages () { +function loadLocaleMessages () { wtutils.MoveToHome(); const messages = {} const fs = require('fs') // Force read en lang, since it's the fallback const langCode = 'en' - var langFile = wtutils.Home + '/locales/' + langCode + '.json' - log.debug(`Loading language: ${langCode}`) - messages[langCode] = JSON.parse(fs.readFileSync(langFile, 'utf8')); + var langFile = wtutils.Home + '/locales/' + langCode + '.json' + log.debug(`Loading language: ${langCode}`) + messages[langCode] = JSON.parse(fs.readFileSync(langFile, 'utf8')); log.debug(`Defined language: ${wtconfig.get('General.language')}`) if (wtconfig.get('General.language', 'en') != 'en'){ // We need to preload an additional language diff --git a/src/store/modules/plextv.js b/src/store/modules/plextv.js index fac06b0..3499e2e 100644 --- a/src/store/modules/plextv.js +++ b/src/store/modules/plextv.js @@ -173,7 +173,9 @@ const actions = { // The request was made but no response was received // `error.request` is an instance of XMLHttpRequest in the browser and an instance of // http.ClientRequest in node.js - log.error('loginToPlex: ' + error.request) + // log.error('loginToPlex: ' + error.request) + log.error('Could not connect to plex.tv'); + alert(i18n.t('Common.Login.LoginConnectErr')); } else { // Something happened in setting up the request that triggered an Error log.error('loginToPlex: ' + error.message) @@ -199,18 +201,20 @@ const actions = { if (error.response) { // The request was made and the server responded with a status code // that falls out of the range of 2xx - log.error('loginToPlex: ' + error.response.status); - log.error('loginToPlex: ' + JSON.stringify(error.response.data)); + log.error('loginToPlexToken1: ' + error.response.status); + log.error('loginToPlexToken2: ' + JSON.stringify(error.response.data)); alert(error.response.data.error) //this.danger(error.response.status, error.response.data.error); } else if (error.request) { // The request was made but no response was received // `error.request` is an instance of XMLHttpRequest in the browser and an instance of // http.ClientRequest in node.js - log.error('loginToPlex: ' + error.request) + // log.error('loginToPlexToken3: ' + JSON.stringify(error.request)); + log.error('Could not connect to plex.tv with a Token'); + alert(i18n.t('Common.Login.LoginConnectErrToken')); } else { // Something happened in setting up the request that triggered an Error - log.error('loginToPlex: ' + error.message) + log.error('loginToPlexToken4: ' + error.message) }}) }, updatingServerAddress({ commit}, status){