Fixed #366, as well as some cleanups

This commit is contained in:
UKDTOM 2021-05-28 23:30:15 +02:00
parent 7722810ec9
commit 90bab8e141
8 changed files with 167 additions and 158 deletions

View file

@ -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.10
* [#366 if possible allow lan only connections](https://github.com/WebTools-NG/WebTools-NG/issues/366)
## V0.3.9
* [#359 ET: Log time it took](https://github.com/WebTools-NG/WebTools-NG/issues/359)

View file

@ -1,7 +1,7 @@
{
"name": "webtools-ng",
"productName": "WebTools-NG",
"version": "0.3.9",
"version": "0.3.10",
"description": "WebTools Next Generation 4 Plex",
"author": "dane22 & CPSO",
"license": "MPL-2.0",

View file

@ -9,13 +9,15 @@ console.log = log.log;
log.transports.file.fileName = wtutils.AppName;
import {
createProtocol
createProtocol
} from 'vue-cli-plugin-electron-builder/lib'
//import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
const isDevelopment = process.env.NODE_ENV !== 'production'
// Bad thing, but need to disable cert checks, since connecting via ip
// to a cert issued for plex.direct
app.commandLine.appendSwitch('ignore-certificate-errors', 'true');
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
@ -47,9 +49,9 @@ function createWindow () {
})
// Set proper title for main window
win.webContents.on('did-finish-load', () => {
let windowtitle = wtutils.AppName + " v" + wtutils.AppVersion;
win.setTitle(windowtitle);
win.webContents.on('did-finish-load', () => {
let windowtitle = wtutils.AppName + " v" + wtutils.AppVersion;
win.setTitle(windowtitle);
})
}
@ -60,7 +62,7 @@ app.on('window-all-closed', () => {
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
}
})
app.on('activate', () => {
@ -76,9 +78,9 @@ app.on('activate', () => {
// Some APIs can only be used after this event occurs.
app.on('ready', async () => {
if (isDevelopment && !process.env.IS_TEST) {
try {
try {
//await installExtension(VUEJS_DEVTOOLS)
console.log('VUE DevTools disabled for now')
console.log('VUE DevTools disabled for now')
} catch (e) {
console.error('Vue Devtools failed to install:', e.toString())
}

View file

@ -4,7 +4,7 @@ import store from '../../../store';
const ptv = new class PTV {
constructor() {
constructor() {
}
async checkServerConnect(server) {
log.verbose(`Checking address for server: ${server.name}`);
@ -14,26 +14,30 @@ const ptv = new class PTV {
let local = false;
// Start with the local address check first
for (var i = 0; i < server.connections.length; i++) {
//server.connections.forEach((val) => {
let val = server.connections[i];
log.verbose(`Checking: ${val.uri}`);
let baseurl = val.uri;
log.verbose(`Checking: ${val.protocol}://${val.address}:${val.port}`);
let baseurl = val.protocol + '://' + val.address + ':' + val.port;
await axios.get(baseurl + '/identity', {
headers: {
Accept: 'application/json'
},
timeout: 5000
})
.then(response => {
if(response.status == 200){
.then(response => {
if(response.status == 200){
log.verbose(`Address ${baseurl} is alive, so check if local`);
if ( val.local == true){
log.verbose(`It's a local server, so need to check if correct one`);
const machineIdentifier = response.data['MediaContainer']['machineIdentifier'];
if (machineIdentifier == server.clientIdentifier){
log.verbose(`Local server found as: ${baseurl}`);
log.verbose(`Local server found as: ${baseurl}`);
PMSAddress = baseurl;
local = true;
local = true;
}
}
else
@ -44,31 +48,31 @@ const ptv = new class PTV {
log.verbose(`No local server found yet, so checking ${baseurl}`)
const machineIdentifier = response.data['MediaContainer']['machineIdentifier'];
if (machineIdentifier == server.clientIdentifier){
log.verbose(`Remote server found as: ${baseurl}`);
PMSAddress = baseurl;
log.verbose(`Remote server found as: ${baseurl}`);
PMSAddress = baseurl;
}
}
}
}
}
}).catch((error) => {
if (error.response) {
if (error.response) {
// The request was made and server responded with a status code
// that falls out of the range of 2xx
log.warn(error.response.status)
// that falls out of the range of 2xx
log.warn(error.response.status)
} else if (error.request) {
// The request was made but no response was received
// The request was made but no response was received
log.warn('No response recieved');
}
else {
// Something happened in setting up the request that triggered an Error
log.warn('Error', error.message);
}
}
}
)
}
log.info(`Returning valid address as: ${PMSAddress}`)
store.commit("UPDATE_SELECTED_SERVER_ADDRESS", PMSAddress);
store.commit("UPDATE_PLEX_SELECTED_SERVER_STATUS", false);
store.commit("UPDATE_SELECTED_SERVER_ADDRESS", PMSAddress);
store.commit("UPDATE_PLEX_SELECTED_SERVER_STATUS", false);
return PMSAddress
}
}

View file

@ -1,35 +1,35 @@
<template>
<div class="col-lg-10 col-md-12 col-xs-12">
<h3>{{ $t("Modules.PMS.Name") }} <br>
</h3>
<h3>{{ $t("Modules.PMS.Name") }} <br>
</h3>
{{ $t("Modules.PMS.Description") }}
<br />
</div>
</div>
</template>
<script>
<script>
import i18n from '../../../i18n';
import store from '../../../store';
import { wtconfig } from '../General/wtutils';
i18n, store, wtconfig
const log = require("electron-log");
export default {
data() {
return {
selLibraryWait: true,
btnDisable: true,
return {
selLibraryWait: true,
btnDisable: true,
selMediaType: "movie",
selLibrary: "",
selLibraryOptions: [],
selLevel: "",
selLevel: "",
};
},
},
created() {
log.info("PMS Created");
this.serverSelected();
@ -42,10 +42,10 @@
log.debug("serverCheck is none");
this.$bvToast.toast(this.$t("Modules.PMS.ErrorNoServerSelectedMsg"), {
title: this.$t("Modules.PMS.ErrorNoServerSelectedTitle"),
autoHideDelay: 4000,
autoHideDelay: 4000,
solid: true,
variant: 'primary',
toaster: 'b-toaster-bottom-right'
toaster: 'b-toaster-bottom-right'
});
}
}

View file

@ -2,11 +2,11 @@
<b-container fluid>
<div class="col-lg-10 col-md-12 col-xs-12">
<h1>{{ $t("Modules.PMS.Settings.Settings") }}</h1>
<p>{{ $t("Modules.PMS.Settings.Description") }}</p>
<p>{{ $t("Modules.PMS.Settings.Notice") }}</p>
<p>{{ $t("Modules.PMS.Settings.Description") }}</p>
<p>{{ $t("Modules.PMS.Settings.Notice") }}</p>
</div>
<div> <!-- Settings to show -->
<div> <!-- Settings to show -->
<b-form-group id="FilterSettingsGroup" v-bind:label="$t('Modules.PMS.Settings.SettingsFilter')" label-size="lg" label-class="font-weight-bold pt-0">
<b-tooltip target="FilterSettingsGroup" triggers="hover">
{{ $t('Modules.PMS.Settings.TTSettingsFilter') }}
@ -18,7 +18,7 @@
:options="FilterSettingsOptions"
name="FilterSettings"
></b-form-radio-group>
</b-form-group>
</b-form-group>
</div>
<div class="d-flex align-items-center">
@ -26,14 +26,14 @@
<b-tooltip target="etLibraryGroup" triggers="hover">
{{ $t('Modules.PMS.Settings.TTSelectSettingsSelection') }}
</b-tooltip>
<b-form-select
v-model="selSection"
<b-form-select
v-model="selSection"
id="selSection"
v-on:change="getGroupSelectedItem"
v-on:change="getGroupSelectedItem"
:options="selSectionOptions"
name="selSection">
name="selSection">
</b-form-select>
</b-form-group>
</b-form-group>
</div>
<div> <!-- Modal popup -->
<b-modal ref="edtSetting" hide-footer v-bind:title=this.newSettingTitle >
@ -45,7 +45,7 @@
<label for="textarea-curSetting">{{ $t('Modules.PMS.Settings.curSetting') }}:</label>
</b-col>
<b-col sm="10">
<b-form-textarea
<b-form-textarea
id="textarea-curSetting"
plaintext
size="sm"
@ -61,7 +61,7 @@
<label for="textarea-defSetting">{{ $t('Modules.PMS.Settings.defSetting') }}:</label>
</b-col>
<b-col sm="10">
<b-form-textarea
<b-form-textarea
id="textarea-defSetting"
plaintext
size="sm"
@ -73,52 +73,51 @@
</b-row>
</b-container>
<br>
<b-form-input
<b-form-input
v-model="newSettingValue"
v-bind:placeholder=this.newSettingValueTXT >
</b-form-input>
</b-form-input>
</div>
<b-button class="mt-3" variant="outline-primary" block @click="saveNewSetting">{{ this.newSettingSaveTxt }}</b-button>
</b-modal>
</div>
<div>
<b-table
<div>
<b-table
striped
hover
sticky-header
:items="settingsItems"
:fields="settingsFields"
sticky-header
:items="settingsItems"
:fields="settingsFields"
caption-top
bordered
bordered
@row-clicked="tblRowClicked">
<template #table-caption>{{ $t('Modules.PMS.Settings.tblCaption') }}</template>
</b-table>
</div>
<br>
<div class="buttons">
<div class="buttons">
<!-- Buttons -->
<div id="buttons" class="text-center">
<b-button-group >
<b-button variant="success" class="mr-1" :disabled="this.selSection == ''" @click="exportSettings"> {{ $t('Modules.PMS.Settings.ExportGroupSettings') }} </b-button>
<b-button variant="success" class="mr-1" :disabled="this.selSection == ''" @click="exportSettings"> {{ $t('Modules.PMS.Settings.ExportGroupSettings') }} </b-button>
<b-button variant="success" class="mr-1" @click="exportAllSettings">{{ $t('Modules.PMS.Settings.ExportAllSettings') }}</b-button>
</b-button-group>
</div>
</div>
<br>
</div>
</div>
<br>
<p class="text-center">{{ $t('Modules.PlexTV.Settings') }}</p>
{{ this.selSection }}
</b-container>
</template>
<script>
const log = require("electron-log");
const {JSONPath} = require('jsonpath-plus');
const {JSONPath} = require('jsonpath-plus');
import {wtconfig} from './../../General/wtutils';
import i18n from '../../../../i18n';
import store from '../../../../store';
import { pmssettings } from "./scripts/settings";
export default {
data() {
import { pmssettings } from "./scripts/settings";
export default {
data() {
return {
newSettingTitle: "",
newSettingValueTXT: this.$t('Modules.PMS.Settings.newSettingValueTXT'),
@ -128,14 +127,14 @@
newSettingValue: "",
edtSettingKey: "",
selSectionOptions: [],
selSection : "",
selFilterSetting: "",
selSection : "",
selFilterSetting: "",
FilterSettingsOptions: [
{ text: i18n.t('Modules.PMS.Settings.OnlyHidden'), value: 'OnlyHidden' },
{ text: i18n.t('Modules.PMS.Settings.OnlyAdvanced'), value: 'OnlyAdvanced' },
{ text: i18n.t('Modules.PMS.Settings.AllSettings'), value: 'AllSettings' }
{ text: i18n.t('Modules.PMS.Settings.AllSettings'), value: 'AllSettings' }
],
settingsFields: [
settingsFields: [
{name: { label: this.$i18n.t('Modules.PMS.Settings.tblName') }},
{label: { label: this.$i18n.t('Modules.PMS.Settings.tblLabel') }},
{summary: { label: this.$i18n.t('Modules.PMS.Settings.tblSummary') }},
@ -143,15 +142,15 @@
{default: { label: this.$i18n.t('Modules.PMS.Settings.tblDefault') }},
{value: { label: this.$i18n.t('Modules.PMS.Settings.tblValue') }}
],
settingsItems: []
};
settingsItems: []
};
},
created() {
log.info("PMS Settings Created");
this.serverSelected();
this.getFilterSettings();
this.getServerSettings();
this.getcbDefaults();
this.getServerSettings();
this.getcbDefaults();
},
computed: {
selectedServerAddress: function(){
@ -162,58 +161,58 @@
exportSettings: async function(){
if (wtconfig.get('General.ExportPath', "") == "")
{
log.info('ET: No output dir defined')
log.info('ET: No output dir defined')
this.$bvToast.toast(this.$t("Common.ErrorNoOutDirMsg"), {
title: this.$t("Common.ErrorNoOutDirTitle"),
autoHideDelay: 3000,
autoHideDelay: 3000,
solid: true,
variant: 'primary',
toaster: 'b-toaster-bottom-right'
})
toaster: 'b-toaster-bottom-right'
})
return
}
}
log.info(`Export Group Settings: ${this.selSection}`);
const path = require('path');
const dirPath = path.join(i18n.t("Modules.PMS.Name"), i18n.t("Modules.PMS.Settings.Settings"));
const outFile = await pmssettings.exportSettings({Module: dirPath, Grp: this.selSection, Data: this.$store.getters.getPMSSettings});
const bodyStr = i18n.t("Modules.PMS.ExportDoneBody", [outFile]);
this.$bvToast.toast(bodyStr, {
const bodyStr = i18n.t("Modules.PMS.ExportDoneBody", [outFile]);
this.$bvToast.toast(bodyStr, {
title: this.$t("Modules.PMS.ExportDoneTitle"),
autoHideDelay: 400000,
autoHideDelay: 400000,
solid: true,
variant: 'primary',
toaster: 'b-toaster-bottom-right'
toaster: 'b-toaster-bottom-right'
});
},
exportAllSettings: async function(){
if (wtconfig.get('General.ExportPath', "") == "")
{
log.info('ET: No output dir defined')
log.info('ET: No output dir defined')
this.$bvToast.toast(this.$t("Common.ErrorNoOutDirMsg"), {
title: this.$t("Common.ErrorNoOutDirTitle"),
autoHideDelay: 3000,
autoHideDelay: 3000,
solid: true,
variant: 'primary',
toaster: 'b-toaster-bottom-right'
})
toaster: 'b-toaster-bottom-right'
})
return
}
}
log.info(`Export All Settings: ${this.selSection}`);
const path = require('path');
const dirPath = path.join(i18n.t("Modules.PMS.Name"), i18n.t("Modules.PMS.Settings.Settings"));
const outFile = await pmssettings.exportSettings({Module: dirPath, Grp:'All', Data: this.$store.getters.getPMSSettings});
const bodyStr = i18n.t("Modules.PMS.ExportDoneBody", [outFile]);
this.$bvToast.toast(bodyStr, {
const bodyStr = i18n.t("Modules.PMS.ExportDoneBody", [outFile]);
this.$bvToast.toast(bodyStr, {
title: this.$t("Modules.PMS.ExportDoneTitle"),
autoHideDelay: 400000,
autoHideDelay: 400000,
solid: true,
variant: 'primary',
toaster: 'b-toaster-bottom-right'
toaster: 'b-toaster-bottom-right'
});
},
async saveNewSetting() {
async saveNewSetting() {
log.debug(`Saving setting ${this.newSettingValue} for setting ${this.edtSettingKey}`);
// Save setting
// Save setting
await store.dispatch('setPMSSetting', {
Token: this.$store.getters.getAuthToken,
Address: this.$store.getters.getSelectedServerAddress,
@ -231,7 +230,7 @@
if (!record.default)
{
this.defSetting = '';
}
}
else{
this.defSetting = record.default;
}
@ -243,21 +242,21 @@
else {
this.curSetting = '';
}
}
}
else{
this.curSetting = record.value;
}
this.edtSettingKey = record.name;
}
this.edtSettingKey = record.name;
this.newSettingTitle = i18n.t('Modules.PMS.Settings.newSettingTitle', [this.edtSettingKey]);
this.newSettingValue = "";
this.$refs['edtSetting'].show();
this.$refs['edtSetting'].show();
},
updateTbl(group) {
// Update the data table with new settings
// Update the data table with new settings
const filteredResult = JSONPath({path: `$.${group}`, json: this.$store.getters.getPMSSettings})[0];
log.verbose(`filtered settings: ${JSON.stringify(filteredResult)}`);
log.verbose(`filtered settings: ${JSON.stringify(filteredResult)}`);
this.settingsItems = [];
for (var i = 0; i < filteredResult.length; i++) {
for (var i = 0; i < filteredResult.length; i++) {
var entry = {};
entry['name'] = JSONPath({path: `$.*~`, json: filteredResult[i]})[0];
entry['label'] = JSONPath({path: `$..label`, json: filteredResult[i]})[0];
@ -265,12 +264,12 @@
entry['type'] = JSONPath({path: `$..type`, json: filteredResult[i]})[0];
entry['default'] = JSONPath({path: `$..default`, json: filteredResult[i]})[0];
entry['value'] = JSONPath({path: `$..value`, json: filteredResult[i]})[0];
this.settingsItems.push(entry);
this.settingsItems.push(entry);
}
},
getGroupSelectedItem: function(myarg) {
log.debug(`Group changed to: ${myarg}`);
this.updateTbl(myarg);
this.updateTbl(myarg);
},
async serverSelected() {
let serverCheck = this.$store.getters.getSelectedServer;
@ -278,10 +277,10 @@
log.debug("serverCheck is none");
this.$bvToast.toast(this.$t("Modules.PMS.ErrorNoServerSelectedMsg"), {
title: this.$t("Modules.PMS.ErrorNoServerSelectedTitle"),
autoHideDelay: 4000,
autoHideDelay: 4000,
solid: true,
variant: 'primary',
toaster: 'b-toaster-bottom-right'
toaster: 'b-toaster-bottom-right'
}
);
}
@ -290,21 +289,21 @@
log.debug('Getting Server Settings');
await store.dispatch('fetchPMSSettings', {
Token: this.$store.getters.getAuthToken,
Address: this.$store.getters.getSelectedServerAddress});
log.debug('Options are: ' + JSON.stringify(Object.keys(this.$store.getters.getPMSSettings)))
Address: this.$store.getters.getSelectedServerAddress});
log.debug('Options are: ' + JSON.stringify(Object.keys(this.$store.getters.getPMSSettings)))
this.selSectionOptions = Object.keys(this.$store.getters.getPMSSettings).sort();
},
},
async changeFilterSetting() {
log.debug('Changed FilterSetting');
wtconfig.set('PMS.FilterSetting', this.selFilterSetting);
wtconfig.set('PMS.FilterSetting', this.selFilterSetting);
await this.getServerSettings();
this.updateTbl(this.selSection);
},
getFilterSettings() {
this.selFilterSetting = wtconfig.get('PMS.FilterSetting', 'AllSettings');
}
}
};
}
};
</script>
<style scoped>
@ -314,5 +313,5 @@
#b-form-group{
margin-top: 20px;
}
</style>

View file

@ -31,7 +31,7 @@ log.transports.console.level = wtconfig.get('Log.consoleLevel', 'silly');
// Set logfile to 10Mb
log.transports.file.maxSize = wtconfig.get('Log.maxSize', 1048576);
log.info('*********************************')
log.info('*********************************')
log.info(`Starting ${wtutils.AppName} Version: ${wtutils.AppVersion}`);
log.info(`Running on ${wtutils.RunningOS}`)
log.info(`Log level set to ${log.transports.file.level}`)
@ -39,15 +39,15 @@ log.info(`Log level set to ${log.transports.file.level}`)
// Log Commandline Params
// This will handle any commandline params that we use
const params = require('electron').remote.process.argv;
params.forEach(param => {
const params = require('electron').remote.process.argv;
params.forEach(param => {
// log.verbose(`Param is: ${param}`);
if (param.toLowerCase().startsWith("x-plex-token"))
{
// SECURITY ISSUE...Do not enable next line, except when debugging
// log.verbose(`Found Token as: ${param.split('=')[1]}`)
// log.verbose(`Found Token as: ${param.split('=')[1]}`)
store.commit("UPDATE_AUTHTOKEN", param.split('=')[1]);
}
}
});
// Handles dev stuff from Json
@ -63,7 +63,7 @@ if ( token != ''){
// Prepopulate config file with defaults
if (wtconfig.get("general.version", "") != wtutils.AppVersion){
// Config file out of date, so prepopulate with default values if missing
// Config file out of date, so prepopulate with default values if missing
wtutils.UpdateConfigFile()
}
@ -92,5 +92,5 @@ new Vue({
render: h => h(App),
router: router,
store: store,
i18n
i18n
}).$mount('#app')

View file

@ -15,7 +15,7 @@ const state = {
authToken: '',
avatar: '',
plexname: '',
users: {}
users: {}
};
const mutations = {
@ -27,10 +27,10 @@ const mutations = {
},
UPDATE_SELECTED_SERVER(state, value) {
state.selectedServer = value;
state.selectedServerToken = value.accessToken;
state.selectedServerToken = value.accessToken;
},
UPDATE_SELECTED_SERVER_ADDRESS(state, value) {
state.selectedServerAddress = value;
state.selectedServerAddress = value;
},
UPDATE_AUTHENTICATED(state, value){
state.authenticated = value;
@ -53,38 +53,38 @@ const actions = {
async fetchUsers( { commit, getters }){
log.debug('Getting users from plex.tv');
let header = wtutils.PMSHeader;
header['X-Plex-Token'] = getters.getAuthToken;
header['X-Plex-Token'] = getters.getAuthToken;
await axios({
method: 'get',
url: 'https://plex.tv/api/v2/friends',
url: 'https://plex.tv/api/v2/friends',
headers: header
})
.then((response) => {
.then((response) => {
const ptvusers = {};
log.debug('Response from fetchUsers recieved');
response.data.forEach((req) => {
log.debug('Response from fetchUsers recieved');
response.data.forEach((req) => {
ptvusers[req.id] = req;
})
commit('UPDATE_USERS', ptvusers);
log.verbose('Users added to store')
})
.catch(function (error) {
if (error.response) {
if (error.response) {
log.error('fetchUsers: ' + error.response.data);
alert(error.response.data.errors[0].code + " " + error.response.data.errors[0].message);
} else if (error.request) {
log.error('fetchUsers: ' + error.request);
} else {
log.error('fetchUsers: ' + error.message);
}
}
});
},
fetchPlexServers({ commit, getters }) {
let header = wtutils.PMSHeader;
header['X-Plex-Token'] = getters.getAuthToken;
header['X-Plex-Token'] = getters.getAuthToken;
axios({
method: 'get',
url: 'https://plex.tv/api/v2/resources',
url: 'https://plex.tv/api/v2/resources',
headers: header,
params: {
'includeHttps' : '1',
@ -109,44 +109,44 @@ const actions = {
result.push(pmsServer);
}
} else {
if (req.owned == true && req.product == "Plex Media Server") {
if (req.owned == true && req.product == "Plex Media Server") {
let pmsServer = {};
pmsServer['name'] = req.name;
pmsServer['accessToken'] = req.accessToken;
pmsServer['connections'] = req.connections;
pmsServer['clientIdentifier'] = req.clientIdentifier
pmsServer['clientIdentifier'] = req.clientIdentifier
result.push(pmsServer);
}
}
}
})
commit('UPDATE_PLEX_SERVERS', result);
})
.catch(function (error) {
if (error.response) {
if (error.response) {
log.error('fetchPlexServers: ' + error.response.data);
alert(error.response.data.errors[0].code + " " + error.response.data.errors[0].message);
} else if (error.request) {
log.error('fetchPlexServers: ' + error.request);
} else {
log.error('fetchPlexServers: ' + error.message);
}
}
});
},
loginToPlex({ commit }, payload){
loginToPlex({ commit }, payload){
log.info("loginToPlex called")
var url = 'https://plex.tv/api/v2/users/signin';
var url = 'https://plex.tv/api/v2/users/signin';
url = url + '?login=' + require('querystring').escape(payload.username);
url = url + '&password=' + require('querystring').escape(payload.password);
if ( payload.twoFA ){
url = url + '&verificationCode=' + payload.twoFA
}
}
axios({
method: 'POST',
url: url,
headers: wtutils.PMSHeader
})
url: url,
headers: wtutils.PMSHeader
})
.then(function (response) {
log.debug('loginToPlex: Response from fetchPlexServers recieved')
log.debug('loginToPlex: Response from fetchPlexServers recieved')
commit('UPDATE_AUTHTOKEN', response.data.authToken)
commit('UPDATE_AUTHENTICATED', true)
commit('UPDATE_AVATAR', response.data.thumb)
@ -154,7 +154,7 @@ const actions = {
router.replace({name: "home"});
})
.catch(function (error) {
if (error.response) {
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 status: ${error.response.status}`);
@ -179,24 +179,24 @@ const actions = {
log.error('loginToPlex: ' + error.message)
}})
},
loginToPlexWithToken({ commit }, payload){
loginToPlexWithToken({ commit }, payload){
log.info("loginToPlex called, using a Token")
const url = 'https://plex.tv/users/sign_in.json?X-Plex-Token=' + payload.token;
const url = 'https://plex.tv/users/sign_in.json?X-Plex-Token=' + payload.token;
axios({
method: 'POST',
url: url,
headers: wtutils.PMSHeader
})
headers: wtutils.PMSHeader
})
.then(function (response) {
log.debug('loginToPlex: Response from fetchPlexServers recieved')
commit('UPDATE_AUTHTOKEN', response.data.user.authToken)
commit('UPDATE_AUTHENTICATED', true)
commit('UPDATE_AVATAR', response.data.user.thumb)
commit('UPDATE_PLEXNAME', response.data.user.username)
router.replace({name: "home"});
router.replace({name: "home"});
})
.catch(function (error) {
if (error.response) {
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);
@ -213,7 +213,7 @@ const actions = {
log.error('loginToPlex: ' + error.message)
}})
},
updatingServerAddress({ commit}, status){
updatingServerAddress({ commit}, status){
commit('UPDATE_PLEX_SELECTED_SERVER_STATUS', status)
}
};