From 904e630d43deb133719cadb151f9bfd06df2ad21 Mon Sep 17 00:00:00 2001 From: jessop Date: Mon, 9 Nov 2020 14:53:09 -0500 Subject: [PATCH] pass domain into appid for user new --- dist/bundle.es.js | 5 +++-- dist/bundle.js | 5 +++-- src/lbryio.js | 8 ++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 688b660..5274999 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -320,7 +320,7 @@ Lbryio.getAuthToken = () => new Promise(resolve => { Lbryio.getCurrentUser = () => Lbryio.call('user', 'me'); -Lbryio.authenticate = () => { +Lbryio.authenticate = domain => { if (!Lbryio.enabled) { return new Promise(resolve => { resolve({ @@ -355,10 +355,11 @@ Lbryio.authenticate = () => { } return lbryRedux.Lbry.status().then(status => new Promise((res, rej) => { + const appId = domain && domain !== 'lbry.tv' ? (domain.replace(/[.]/gi, '') + status.installation_id).slice(0, 66) : status.installation_id; Lbryio.call('user', 'new', { auth_token: '', language: 'en', - app_id: status.installation_id + app_id: appId }, 'post').then(response => { if (!response.auth_token) { throw new Error('auth_token was not set in the response'); diff --git a/dist/bundle.js b/dist/bundle.js index 52b42bc..14e1a7b 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -628,7 +628,7 @@ Lbryio.getCurrentUser = function () { return Lbryio.call('user', 'me'); }; -Lbryio.authenticate = function () { +Lbryio.authenticate = function (domain) { if (!Lbryio.enabled) { return new Promise(function (resolve) { resolve({ @@ -666,10 +666,11 @@ Lbryio.authenticate = function () { return lbry_redux__WEBPACK_IMPORTED_MODULE_1__["Lbry"].status().then(function (status) { return new Promise(function (res, rej) { + var appId = domain && domain !== 'lbry.tv' ? (domain.replace(/[.]/gi, '') + status.installation_id).slice(0, 66) : status.installation_id; Lbryio.call('user', 'new', { auth_token: '', language: 'en', - app_id: status.installation_id + app_id: appId }, 'post').then(function (response) { if (!response.auth_token) { throw new Error('auth_token was not set in the response'); diff --git a/src/lbryio.js b/src/lbryio.js index 0b3d2e0..7620095 100644 --- a/src/lbryio.js +++ b/src/lbryio.js @@ -111,7 +111,7 @@ Lbryio.getAuthToken = () => Lbryio.getCurrentUser = () => Lbryio.call('user', 'me'); -Lbryio.authenticate = () => { +Lbryio.authenticate = domain => { if (!Lbryio.enabled) { return new Promise(resolve => { resolve({ @@ -153,13 +153,17 @@ Lbryio.authenticate = () => { .then( status => new Promise((res, rej) => { + const appId = + domain && domain !== 'lbry.tv' + ? (domain.replace(/[.]/gi, '') + status.installation_id).slice(0, 66) + : status.installation_id; Lbryio.call( 'user', 'new', { auth_token: '', language: 'en', - app_id: status.installation_id, + app_id: appId, }, 'post' )