This commit is contained in:
Tommy Mikkelsen 2022-08-17 18:48:14 +02:00
parent 23cbc0e462
commit b6357973bb
4 changed files with 52 additions and 2 deletions

27
.github/workflows/env.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: Create envfile
on: [ push ]
jobs:
create-envfile:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
# os: [macos-latest]
# os: [ubuntu-latest, windows-latest]
# os: [windows-latest]
steps:
- name: Make envfile
uses: SpicyPizza/create-envfile@v1.3
with:
envkey_DEBUG: false
envkey_SECRET_KEY: ${{ secrets.Key_tmdb }}
file_name: .env
fail_on_empty: false
- name: see output
run: ls

View file

@ -16,6 +16,20 @@ import {
const isDevelopment = process.env.NODE_ENV !== 'production'
// Return defined vars from .env.local
ipcMain.on('getAPIKeys', function(event, arg) {
switch( arg ) {
case 'Key_tmdb':
event.returnValue = process.env.Key_tmdb
break;
case 'Key_tvdb':
event.returnValue = process.env.Key_tvdb
break;
default:
return false;
}
});
// 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');

View file

@ -2,6 +2,7 @@
//import store from '../../../store';
//import { wtconfig } from './wtutils';
import axios from 'axios';
import { wtutils } from './wtutils';
const log = require('electron-log');
const {JSONPath} = require('jsonpath-plus');
@ -12,7 +13,7 @@ const tmdb = new class TMDB {
constructor() {
this.baseUrl = 'https://www.themoviedb.org/';
this.baseAPIUrl = 'https://api.themoviedb.org';
this.BearerKey = 'eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIwNzZjOTRlOTM5YThkNzhjOTg1NGY4MTc0YTI5NGVhYSIsInN1YiI6IjYyNTA5NjcxYzYxM2NlMDA1MWYwMjMyYSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.Ch9U33tcVeh5qbVUG12LZ7qX8ulbIZjURlyGuj3ULBk';
// this.BearerKey = 'eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIwNzZjOTRlOTM5YThkNzhjOTg1NGY4MTc0YTI5NGVhYSIsInN1YiI6IjYyNTA5NjcxYzYxM2NlMDA1MWYwMjMyYSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.Ch9U33tcVeh5qbVUG12LZ7qX8ulbIZjURlyGuj3ULBk';
this.apiKey = '076c94e939a8d78c9854f8174a294eaa';
}
@ -35,7 +36,8 @@ const tmdb = new class TMDB {
"Accept": "application/json"
};
log.info(`[tmdb.js] (getTMDBShowInfo) - Url is ${url}`)
url = `${url}&api_key=${this.apiKey}`;
const apiKey = wtutils.envVarLocal( 'Key_tmdb' );
url = `${url}&api_key=${apiKey}`;
const result = {};
await axios({
method: 'get',

View file

@ -7,6 +7,8 @@ that we use in our solution.
//storeStatus
import {ipcRenderer} from 'electron';
const log = require('electron-log');
console.log = log.log;
const electron = require('electron');
@ -21,6 +23,11 @@ const wtutils = new class WTUtils {
this.plexTVApi = 'https://plex.tv/api/';
}
envVarLocal( envName ){
const envVar = ipcRenderer.sendSync('getAPIKeys', envName);
return envVar;
}
get ConfigFileName(){
var path = require('path');
const configFileName = path.join( this.Home, this.AppName + '.json');