Merge pull request #576 from ukdtom/test-secret

Test secret
This commit is contained in:
Tommy Mikkelsen 2022-08-17 22:47:10 +02:00 committed by GitHub
commit 9cf4735c26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 73 additions and 4 deletions

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

@ -0,0 +1,44 @@
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]
os: [ubuntu-latest]
steps:
# - name: Make envfile
# uses: SpicyPizza/create-envfile@v1.3
# with:
# envkey_DEBUG: false
# envkey_Key_tmdb: ${{ secrets.Key_tmdb }}
# file_name: .env
# fail_on_empty: false
- name: see output
run: echo "${{ secrets.KEY_TMDB }}"
- name: Extract GH secrets
run: 'echo "$KEY_TMDB" > key'
shell: bash
env:
KEY_TMDB: ${{secrets.KEY_TMDB}}
- name: Repo secrets
run: |
echo 'Hello World!'
echo '$KEY_TMDB2 > key'
echo ${{secrets.KEY_TMDB2}}
echo "${{secrets.KEY_TMDB2}}22" > .env
cat .env
echo 'Hello again!'
shell: bash
env:
KEY_TMDB2: ${{secrets.KEY_TMDB2}}

View file

@ -27,6 +27,8 @@ jobs:
run: npm install
- name: see directory with dependencies
run: ls
- name: Add env file
run: echo "${{secrets.KEY_TMDB2}}22" > .env
- name: Deploy Releases
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "webtools-ng",
"version": "1.0.0",
"version": "1.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "webtools-ng",
"version": "1.0.0",
"version": "1.0.1",
"hasInstallScript": true,
"license": "MPL-2.0",
"dependencies": {

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');