added https to fetchPlexServers

This commit is contained in:
CPSO 2020-06-18 02:57:41 +02:00
parent 6847a3acb5
commit cb7f1d972c
4 changed files with 41 additions and 11 deletions

View file

@ -20,12 +20,12 @@
<div class="select is-dark">
<b-select v-bind:placeholder="$t('Common.SelServer')"
v-model="selectedOption"
@input="selected">
<option
v-for="option in pserver"
:value="option"
:key="option.clientIdentifier"
v-on:change="onchange()">
:key="option.clientIdentifier">
{{ option.name }}
</option>
</b-select>
@ -52,11 +52,18 @@
<script>
import store from '../../store';
import { et } from "../modules/ExportTools/et";
const log = require('electron-log');
export default {
data(){
return {
selectedOption: []
}
},
methods: {
fetchServers(){
log.info("fetching servers")
@ -66,9 +73,10 @@ export default {
log.info("active2 called")
this.active = e;
},
selected: function (selected) {
this.selected = selected;
this.$store.commit("UPDATE_SELECTED_SERVER", selected);
selected: function () {
log.info('HEADER: selected server: ' + this.selectedOption.name)
et.checkServerConnect(this.selectedOption)
this.$store.commit("UPDATE_SELECTED_SERVER", this.selectedOption);
},
onChange(event) {

View file

@ -1,6 +1,7 @@
var def = JSON.parse(JSON.stringify(require('./definitions.json')));
const log = require('electron-log');
import {wtconfig, wtutils} from '../../../wtutils'
import axios from 'axios'
const et = new class ET {
constructor() {
@ -50,6 +51,25 @@ const et = new class ET {
getFieldKey(libType, fieldName) {
return def[libType]['fields'][fieldName]['key']
}
checkServerConnect(server) {
log.info("NUGGA : ET : checkServerConnect called")
server.connections.forEach((val) => {
log.info(val.uri)
let baseurl = val.uri
axios.get(baseurl + '/identity')
.then(response => {
log.info(response)
}).catch(error => {
log.error(error)
})
}
)
let serverAdress = []
return serverAdress
}
}
const excel = new class Excel {

View file

View file

@ -44,11 +44,12 @@ const actions = {
{
'X-Plex-Client-Identifier' : 'WebTools-NG',
'X-Plex-Token': getters.getAuthToken,
'Accept' : 'application/json',
'includeHttps' : '1',
'includeRelay': '0',
'Accept' : 'application/json'
},
params: {
'includeHttps' : '1',
'includeRelay': '0'
}
})
.then((response) => {
let result=[];
@ -133,7 +134,8 @@ const getters = {
if (req.local == true) {
result = req.address + ":" + req.port
}
})
}
)
}