Change Google auth strategy

This commit is contained in:
Jonathan Cremin 2018-03-11 20:22:17 +00:00
parent 0d4bd47251
commit bd85678303
5 changed files with 20 additions and 10 deletions

View file

@ -8,11 +8,16 @@ const debug = debuglog('combine.fm:google');
const pm = bluebird.promisifyAll(new PlayMusic());
if (!process.env.GOOGLE_EMAIL || !process.env.GOOGLE_PASSWORD) {
debug('GOOGLE_EMAIL or GOOGLE_PASSWORD environment variables not found, deactivating Google Play Music.');
if (!(process.env.GOOGLE_EMAIL && process.env.GOOGLE_PASSWORD) && !(process.env.GOOGLE_ANDROID_ID && process.env.GOOGLE_MASTER_TOKEN)) {
debug('Required GOOGLE_* environment variables not found, deactivating Google Play Music.');
}
let ready = pm.initAsync({email: process.env.GOOGLE_EMAIL, password: process.env.GOOGLE_PASSWORD}).catch(function(err) {
const creds = {
androidId: process.env.GOOGLE_ANDROID_ID,
masterToken: process.env.GOOGLE_MASTER_TOKEN,
}
let ready = pm.initAsync(creds).catch(function(err) {
debug(err);
});