Documentation, screenshots and a couple of tweaks (#142)
* Documentation, screenshots and a couple of tweaks * Changelog * changelog
This commit is contained in:
1 parent
bea7fb209b
commit
0bcf361eb0
27 files changed
+642
-102
No files matched your search
@@ -4,12 +4,18 @@ const path = require('path');
|
||||
|
||||
const envFile = path.join(__dirname, '../.env');
|
||||
|
||||
function getEnvVars() {
|
||||
function getEnvVars(requiredVars = undefined) {
|
||||
let envVars = process.env;
|
||||
if (fs.existsSync(envFile)) {
|
||||
const envConfig = dotenv.parse(fs.readFileSync(envFile));
|
||||
envVars = { ...envVars, ...envConfig };
|
||||
}
|
||||
if (requiredVars) {
|
||||
const missingVars = requiredVars.filter((key) => !envVars[key]);
|
||||
if (missingVars.length) {
|
||||
throw new Error(`Missing environment variables: ${missingVars.join(', ')}`);
|
||||
}
|
||||
}
|
||||
|
||||
return envVars;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ async function importInvidiousProfile(invidiousInstance, token, profile) {
|
||||
},
|
||||
method: "POST",
|
||||
body: JSON.stringify(piece.profile)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ async function deleteAccessToken(invidiousInstance, token) {
|
||||
const playlist = playlists[i];
|
||||
try {
|
||||
profile.playlists.push(await generatePlaylist(playlist.url, playlist.title, browser, playlistLimit))
|
||||
playlistsToDelete.push(playlist.title)
|
||||
playlistsToDelete.push(playlist.title)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
@@ -316,11 +316,11 @@ async function deleteAccessToken(invidiousInstance, token) {
|
||||
throw new Error(`Could not connect to Playlet at ${PLAYLEY_SERVER}\n${error}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
token = await getAccessToken(invidiousInstance)
|
||||
|
||||
|
||||
await deletePlaylists(invidiousInstance, token, playlistsToDelete)
|
||||
await importInvidiousProfile(invidiousInstance, token, profile);
|
||||
await importInvidiousProfile(invidiousInstance, token, profile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ process.on('uncaughtException', exitHandler.bind(null, { exit: true }));
|
||||
let success = false;
|
||||
let telnet;
|
||||
try {
|
||||
const config = getEnvVars();
|
||||
const config = getEnvVars(['ROKU_DEV_TARGET', 'ROKU_DEVPASSWORD']);
|
||||
|
||||
const parser = getArgumentParser()
|
||||
const args = parser.parse_args()
|
||||
|
||||
+1
-6
@@ -18,12 +18,7 @@ const parser = getArgumentParser();
|
||||
const args = parser.parse_args()
|
||||
const filename = args.filename;
|
||||
|
||||
const config = getEnvVars();
|
||||
['ROKU_DEV_TARGET', 'ROKU_DEVPASSWORD'].forEach((key) => {
|
||||
if (!config[key]) {
|
||||
throw new Error(`Missing environment variable ${key}`);
|
||||
}
|
||||
});
|
||||
const config = getEnvVars(['ROKU_DEV_TARGET', 'ROKU_DEVPASSWORD']);
|
||||
|
||||
const options = {
|
||||
host: config.ROKU_DEV_TARGET,
|
||||
|
||||
@@ -4,12 +4,7 @@
|
||||
const getEnvVars = require('./get-env-vars');
|
||||
const rokuDeploy = require('roku-deploy');
|
||||
|
||||
const config = getEnvVars();
|
||||
['ROKU_DEV_TARGET', 'ROKU_DEVPASSWORD', 'ROKU_SIGN_PASSWORD'].forEach((key) => {
|
||||
if (!config[key]) {
|
||||
throw new Error(`Missing environment variable ${key}`);
|
||||
}
|
||||
});
|
||||
const config = getEnvVars(['ROKU_DEV_TARGET', 'ROKU_DEVPASSWORD', 'ROKU_SIGN_PASSWORD']);
|
||||
|
||||
const options = {
|
||||
host: config.ROKU_DEV_TARGET,
|
||||
|
||||
Reference in new issue
Block a user