Merge pull request #582 from WebTools-NG/secrets

Secrets
This commit is contained in:
Tommy Mikkelsen 2022-09-03 13:46:09 +02:00 committed by GitHub
commit 71ba6a4094
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 42 additions and 79 deletions

View file

@ -1,44 +0,0 @@
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_TMDB > key'
echo ${{secrets.KEY_TMDB}}
echo "${{secrets.KEY_TMDB}}22" > .env
cat .env
echo 'Hello again!'
shell: bash
env:
KEY_TMDB: ${{secrets.KEY_TMDB}}

View file

@ -27,8 +27,21 @@ jobs:
run: npm install
- name: see directory with dependencies
run: ls
- name: Add env file
run: echo "${{secrets.KEY_TMDB2}}22" > .env
- name: Add TMDB Secret
run: echo "${{ secrets.KEY_TMDB }}" > public/locales/.env.local
shell: bash
env:
KEY_TMDB: ${{ secrets.KEY_TMDB }}
- name: Add TVDB Secret
run: echo "${{ secrets.KEY_TVDB }}" >> public/locales/.env.local
shell: bash
env:
KEY_TVDB: ${{ secrets.KEY_TVDB }}
- name: Add POEditor Secret
run: echo "${{ secrets.KEY_POEDITOR }}" >> public/locales/.env.local
shell: bash
env:
KEY_POEDITOR: ${{ secrets.KEY_POEDITOR }}
- name: Deploy Releases
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -18,6 +18,8 @@
* [#554 Find Media and extended characters](https://github.com/WebTools-NG/WebTools-NG/issues/554) (Bug)
* [#570 Find Media and Multi Episodes](https://github.com/WebTools-NG/WebTools-NG/issues/570) (Bug)
* Added credits to tmdb.org for allowing us to use their API for free (Internal)
* Added credits to thetvdb.com for allowing us to use their API for free (Internal)
* [#574 Make secrets work on both Github and local](https://github.com/WebTools-NG/WebTools-NG/issues/574) (Enhancement)
## V1.0.0 First Official Release (20220724)

13
docs/devs/Dev Secrets.md Normal file
View file

@ -0,0 +1,13 @@
# Secrets
We have a few secrets, that we do not want directly exposed in the source code
So as a dev, you need to create the file
public/locales/.env.local
File should have the following contents
Key_tmdb=<YOUR TMDB API KEY>
Key_tvdb=<YOUR TVDB API KEY>
Key_poeditor=<YOUR POEDITOR API KEY>

View file

@ -200,8 +200,6 @@
"Download":{
"Name": "Download",
"Description": "The @:Modules.Download.Name module allows you to download medias, as well as local assets, from servers where you have been granted download rights"
},
"ET": {
"Description": "@:Modules.ET.Name allows you to export detail information about the media in your libraries",
@ -370,7 +368,7 @@
"NavTitle": "About Us",
"WikiDevelopers": "Wiki was made by:",
"Wikitrumpy81": "Andy (aka trumpy81), a Plex community member (trumpy81 on GitHub)",
"TMDBCredit": "And lastly huge thanks to TMDB for providing a beautiful API for free, since we are a non profit project"
"TMDB-TVDBCredit": "Huge thanks also goes to both TMDB and TheTVDB for providing a beautiful API for free, since we are a non profit project"
},
"GlobalSettings": {
"Title": "Global Settings",

View file

@ -16,20 +16,6 @@ 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');
@ -105,13 +91,11 @@ app.on('ready', async () => {
} catch (e) {
console.error('Vue Devtools failed to install:', e.toString())
}
}
// Open system Dialog
ipcMain.handle('dialog', (event, method, params) => {
dialog[method](params);
});
Menu.setApplicationMenu(null)
createWindow()
})

View file

@ -13,9 +13,6 @@ const tmdb = new class TMDB {
constructor() {
this.baseUrl = 'https://www.themoviedb.org/';
this.baseAPIUrl = 'https://api.themoviedb.org';
// this.BearerKey = 'eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIwNzZjOTRlOTM5YThkNzhjOTg1NGY4MTc0YTI5NGVhYSIsInN1YiI6IjYyNTA5NjcxYzYxM2NlMDA1MWYwMjMyYSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.Ch9U33tcVeh5qbVUG12LZ7qX8ulbIZjURlyGuj3ULBk';
this.apiKey = '076c94e939a8d78c9854f8174a294eaa';
}
get tmdbHeader(){
@ -31,7 +28,6 @@ const tmdb = new class TMDB {
async getTMDBShowInfo( tmdbId ){
log.info(`[tmdb.js] (getTMDBShowInfo) - Getting tmdb info for ${tmdbId}`);
let url = `${this.baseAPIUrl}/3/tv/${tmdbId}?language=en-US`
// api_key=<<api_key>>
let header = {
"Accept": "application/json"
};

View file

@ -7,8 +7,6 @@ that we use in our solution.
//storeStatus
import {ipcRenderer} from 'electron';
const log = require('electron-log');
console.log = log.log;
const electron = require('electron');
@ -24,8 +22,12 @@ const wtutils = new class WTUtils {
}
envVarLocal( envName ){
const envVar = ipcRenderer.sendSync('getAPIKeys', envName);
return envVar;
// This will return the value of a line defined in /locales/.env.local
const { readFileSync } = require('fs');
const data = readFileSync( wtutils.Home + '/locales/.env.local', 'utf8').split(/[\n\r]/);
const matches = data.filter(s => s.includes(envName));
const retval = matches[0].split('=')[1];
return retval;
}
get ConfigFileName(){

View file

@ -22,7 +22,7 @@
</div>
<br>
<p>{{ $t("Modules.About.PlexPoCredits") }}</p>
<p>{{ $t("Modules.About.TMDBCredit") }}</p>
<p>{{ $t("Modules.About.TMDB-TVDBCredit") }}</p>
</div>
</b-container>
</template>

View file

@ -1,9 +1,8 @@
import axios from 'axios';
import { wtutils } from '../../components/modules/General/wtutils'
const baseUrl = 'https://api.poeditor.com/v2/'
const api_token = '5166c4294ff7fb3a82cbdc82958e850e';
const api_token = wtutils.envVarLocal( 'Key_poeditor' );
const id = '342617';
let requestBody = {