pass domain into appid for user new

This commit is contained in:
jessop 2020-11-09 14:53:09 -05:00
parent 801f159059
commit 904e630d43
3 changed files with 12 additions and 6 deletions

5
dist/bundle.es.js vendored
View file

@ -320,7 +320,7 @@ Lbryio.getAuthToken = () => new Promise(resolve => {
Lbryio.getCurrentUser = () => Lbryio.call('user', 'me'); Lbryio.getCurrentUser = () => Lbryio.call('user', 'me');
Lbryio.authenticate = () => { Lbryio.authenticate = domain => {
if (!Lbryio.enabled) { if (!Lbryio.enabled) {
return new Promise(resolve => { return new Promise(resolve => {
resolve({ resolve({
@ -355,10 +355,11 @@ Lbryio.authenticate = () => {
} }
return lbryRedux.Lbry.status().then(status => new Promise((res, rej) => { 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', { Lbryio.call('user', 'new', {
auth_token: '', auth_token: '',
language: 'en', language: 'en',
app_id: status.installation_id app_id: appId
}, 'post').then(response => { }, 'post').then(response => {
if (!response.auth_token) { if (!response.auth_token) {
throw new Error('auth_token was not set in the response'); throw new Error('auth_token was not set in the response');

5
dist/bundle.js vendored
View file

@ -628,7 +628,7 @@ Lbryio.getCurrentUser = function () {
return Lbryio.call('user', 'me'); return Lbryio.call('user', 'me');
}; };
Lbryio.authenticate = function () { Lbryio.authenticate = function (domain) {
if (!Lbryio.enabled) { if (!Lbryio.enabled) {
return new Promise(function (resolve) { return new Promise(function (resolve) {
resolve({ resolve({
@ -666,10 +666,11 @@ Lbryio.authenticate = function () {
return lbry_redux__WEBPACK_IMPORTED_MODULE_1__["Lbry"].status().then(function (status) { return lbry_redux__WEBPACK_IMPORTED_MODULE_1__["Lbry"].status().then(function (status) {
return new Promise(function (res, rej) { 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', { Lbryio.call('user', 'new', {
auth_token: '', auth_token: '',
language: 'en', language: 'en',
app_id: status.installation_id app_id: appId
}, 'post').then(function (response) { }, 'post').then(function (response) {
if (!response.auth_token) { if (!response.auth_token) {
throw new Error('auth_token was not set in the response'); throw new Error('auth_token was not set in the response');

View file

@ -111,7 +111,7 @@ Lbryio.getAuthToken = () =>
Lbryio.getCurrentUser = () => Lbryio.call('user', 'me'); Lbryio.getCurrentUser = () => Lbryio.call('user', 'me');
Lbryio.authenticate = () => { Lbryio.authenticate = domain => {
if (!Lbryio.enabled) { if (!Lbryio.enabled) {
return new Promise(resolve => { return new Promise(resolve => {
resolve({ resolve({
@ -153,13 +153,17 @@ Lbryio.authenticate = () => {
.then( .then(
status => status =>
new Promise((res, rej) => { new Promise((res, rej) => {
const appId =
domain && domain !== 'lbry.tv'
? (domain.replace(/[.]/gi, '') + status.installation_id).slice(0, 66)
: status.installation_id;
Lbryio.call( Lbryio.call(
'user', 'user',
'new', 'new',
{ {
auth_token: '', auth_token: '',
language: 'en', language: 'en',
app_id: status.installation_id, app_id: appId,
}, },
'post' 'post'
) )