This commit is contained in:
zeppi 2021-09-12 19:38:45 -04:00
parent 013461a8cc
commit eefac4af0d
3 changed files with 13 additions and 55 deletions

25
dist/bundle.es.js vendored
View file

@ -276,7 +276,7 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
if (action === 'me') { if (action === 'me') {
if (tokens && tokens.access_token) { if (tokens && tokens.access_token) {
headers.Authorization = 'Bearer ' + tokens.access_token; headers.Authorization = `Bearer ${tokens.access_token}`;
} }
if (tokens && tokens.auth_token) { if (tokens && tokens.auth_token) {
@ -284,7 +284,7 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
} }
} else { } else {
if (tokens && tokens.access_token) { if (tokens && tokens.access_token) {
headers.Authorization = 'Bearer ' + tokens.access_token; headers.Authorization = `Bearer ${tokens.access_token}`;
} else { } else {
fullParams.auth_token = tokens.auth_token; fullParams.auth_token = tokens.auth_token;
} }
@ -337,22 +337,7 @@ Lbryio.getTokens = () => new Promise(resolve => {
}); });
}); });
Lbryio.getCurrentUser = () => Lbryio.call('user', 'me'); // const getAppId = Lbryio.getCurrentUser = () => Lbryio.call('user', 'me');
Lbryio.getUserNew = options => {
const {
language,
appId,
auth_token,
authorization
} = options;
Lbryio.call('user', 'new', {
auth_token: '',
language: language || 'en',
app_id: appId
}, 'post');
};
/** /**
* LBRYIO.AUTHENTICATE() * LBRYIO.AUTHENTICATE()
* @param domain * @param domain
@ -395,8 +380,8 @@ Lbryio.authenticate = (domain, language) => {
if (Lbryio.authenticationPromise === null) { if (Lbryio.authenticationPromise === null) {
Lbryio.authenticationPromise = new Promise((resolve, reject) => { Lbryio.authenticationPromise = new Promise((resolve, reject) => {
// see if we already have a token // see if we already have a token
Lbryio.getAuthToken().then(token => { Lbryio.getTokens().then(tokens => {
if (!token) { if (!tokens) {
return false; return false;
} // check that token works } // check that token works

21
dist/bundle.js vendored
View file

@ -569,7 +569,7 @@ Lbryio.call = function (resource, action) {
if (action === 'me') { if (action === 'me') {
if (tokens && tokens.access_token) { if (tokens && tokens.access_token) {
headers.Authorization = 'Bearer ' + tokens.access_token; headers.Authorization = "Bearer ".concat(tokens.access_token);
} }
if (tokens && tokens.auth_token) { if (tokens && tokens.auth_token) {
@ -577,7 +577,7 @@ Lbryio.call = function (resource, action) {
} }
} else { } else {
if (tokens && tokens.access_token) { if (tokens && tokens.access_token) {
headers.Authorization = 'Bearer ' + tokens.access_token; headers.Authorization = "Bearer ".concat(tokens.access_token);
} else { } else {
fullParams.auth_token = tokens.auth_token; fullParams.auth_token = tokens.auth_token;
} }
@ -638,19 +638,6 @@ Lbryio.getTokens = function () {
Lbryio.getCurrentUser = function () { Lbryio.getCurrentUser = function () {
return Lbryio.call('user', 'me'); return Lbryio.call('user', 'me');
}; // const getAppId =
Lbryio.getUserNew = function (options) {
var language = options.language,
appId = options.appId,
auth_token = options.auth_token,
authorization = options.authorization;
Lbryio.call('user', 'new', {
auth_token: '',
language: language || 'en',
app_id: appId
}, 'post');
}; };
/** /**
* LBRYIO.AUTHENTICATE() * LBRYIO.AUTHENTICATE()
@ -694,8 +681,8 @@ Lbryio.authenticate = function (domain, language) {
if (Lbryio.authenticationPromise === null) { if (Lbryio.authenticationPromise === null) {
Lbryio.authenticationPromise = new Promise(function (resolve, reject) { Lbryio.authenticationPromise = new Promise(function (resolve, reject) {
// see if we already have a token // see if we already have a token
Lbryio.getAuthToken().then(function (token) { Lbryio.getTokens().then(function (tokens) {
if (!token) { if (!tokens) {
return false; return false;
} // check that token works } // check that token works

View file

@ -66,14 +66,14 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
// find a way to trigger deleting auth token after success // find a way to trigger deleting auth token after success
if (action === 'me') { if (action === 'me') {
if (tokens && tokens.access_token) { if (tokens && tokens.access_token) {
headers.Authorization = 'Bearer ' + tokens.access_token; headers.Authorization = `Bearer ${tokens.access_token}`;
} }
if (tokens && tokens.auth_token) { if (tokens && tokens.auth_token) {
fullParams.auth_token = tokens.auth_token; fullParams.auth_token = tokens.auth_token;
} }
} else { } else {
if (tokens && tokens.access_token) { if (tokens && tokens.access_token) {
headers.Authorization = 'Bearer ' + tokens.access_token; headers.Authorization = `Bearer ${tokens.access_token}`;
} else { } else {
fullParams.auth_token = tokens.auth_token; fullParams.auth_token = tokens.auth_token;
} }
@ -129,20 +129,6 @@ Lbryio.getTokens = () => new Promise(resolve => {
Lbryio.getCurrentUser = () => Lbryio.call('user', 'me'); Lbryio.getCurrentUser = () => Lbryio.call('user', 'me');
// const getAppId =
// Lbryio.getUserNew = (options) => {
// const { language, appId, auth_token, authorization } = options;
// Lbryio.call(
// 'user',
// 'new',
// {
// auth_token: '',
// language: language || 'en',
// app_id: appId,
// },
// 'post'
// )}
/** /**
* LBRYIO.AUTHENTICATE() * LBRYIO.AUTHENTICATE()
* @param domain * @param domain
@ -185,8 +171,8 @@ Lbryio.authenticate = (domain, language) => {
Lbryio.authenticationPromise = new Promise((resolve, reject) => { Lbryio.authenticationPromise = new Promise((resolve, reject) => {
// see if we already have a token // see if we already have a token
Lbryio.getTokens() Lbryio.getTokens()
.then(token => { .then(tokens => {
if (!token) { if (!tokens) {
return false; return false;
} }