Compare commits

...

2 commits

Author SHA1 Message Date
zeppi
eefac4af0d lint 2021-09-12 19:38:45 -04:00
zeppi
013461a8cc sso wip 2021-09-12 18:09:39 -04:00
7 changed files with 490 additions and 558 deletions

303
dist/bundle.es.js vendored
View file

@ -260,13 +260,36 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
function makeRequest(url, options) {
return fetch(url, options).then(checkAndParse);
}
} // TOKENS = { auth_token, access_token }
return Lbryio.getAuthToken().then(token => {
const fullParams = {
auth_token: token,
...params
return Lbryio.getTokens().then(tokens => {
// string -=> { auth_token: xyz, authorization: abc }
console.log('LBRYIO CALL TOKEN', tokens);
const fullParams = { ...params
};
const headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}; // TODO refactor this
// Send both tokens to userMe
// find a way to trigger deleting auth token after success
if (action === 'me') {
if (tokens && tokens.access_token) {
headers.Authorization = `Bearer ${tokens.access_token}`;
}
if (tokens && tokens.auth_token) {
fullParams.auth_token = tokens.auth_token;
}
} else {
if (tokens && tokens.access_token) {
headers.Authorization = `Bearer ${tokens.access_token}`;
} else {
fullParams.auth_token = tokens.auth_token;
}
}
Object.keys(fullParams).forEach(key => {
const value = fullParams[key];
@ -277,15 +300,14 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
const qs = querystring.stringify(fullParams);
let url = `${Lbryio.CONNECTION_STRING}${resource}/${action}?${qs}`;
let options = {
method: 'GET'
method: 'GET',
headers
};
if (method === 'post') {
options = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
headers,
body: qs
};
url = `${Lbryio.CONNECTION_STRING}${resource}/${action}`;
@ -300,29 +322,45 @@ Lbryio.authToken = null;
Lbryio.getAuthToken = () => new Promise(resolve => {
if (Lbryio.authToken) {
resolve(Lbryio.authToken);
} else if (Lbryio.overrides.getAuthToken) {
} else {
Lbryio.overrides.getAuthToken().then(token => {
// now { auth_token: <token>, authorization: <token> }
Lbryio.authTokens = token;
resolve(token);
});
} else if (typeof window !== 'undefined') {
const {
store
} = window;
if (store) {
const state = store.getState();
const token = state.auth ? state.auth.authToken : null;
Lbryio.authToken = token;
resolve(token);
}
resolve(null);
} else {
resolve(null);
}
});
Lbryio.getTokens = () => new Promise(resolve => {
Lbryio.overrides.getTokens().then(tokens => {
resolve(tokens);
});
});
Lbryio.getCurrentUser = () => Lbryio.call('user', 'me');
/**
* LBRYIO.AUTHENTICATE()
* @param domain
* @param language
* @returns {null|Promise<any>}
*
* returns user object.
* gets current token,
* then if so, gets current user using lbryio.userMe()
* otherwise calls lbryio.userNew() (with some Lbry.status info)
* then sets the authtoken, and returns the user.
*
* What it actually needs to do is...
* 1) GetAuthTokens( < get tokens from both keycloak and auth_token > )
* a) have auth_token
* b) have sso access token
* 2) Get User Object
* a) access - get user for access token
* b) auth_token - get user for auth_token
* b)
* If <user>
*/
Lbryio.authenticate = (domain, language) => {
if (!Lbryio.enabled) {
@ -341,8 +379,9 @@ Lbryio.authenticate = (domain, language) => {
if (Lbryio.authenticationPromise === null) {
Lbryio.authenticationPromise = new Promise((resolve, reject) => {
Lbryio.getAuthToken().then(token => {
if (!token || token.length > 60) {
// see if we already have a token
Lbryio.getTokens().then(tokens => {
if (!tokens) {
return false;
} // check that token works
@ -368,24 +407,18 @@ Lbryio.authenticate = (domain, language) => {
}, 'post').then(response => {
if (!response.auth_token) {
throw new Error('auth_token was not set in the response');
}
} // const { store } = window;
// Not setting new "auth_tokens"
// if (Lbryio.overrides.setAuthToken) {
// Lbryio.overrides.setAuthToken(response.auth_token);
// }
// if (store) {
// store.dispatch({
// type: ACTIONS.GENERATE_AUTH_TOKEN_SUCCESS,
// data: { authToken: response.auth_token },
// });
// }
const {
store
} = window;
if (Lbryio.overrides.setAuthToken) {
Lbryio.overrides.setAuthToken(response.auth_token);
}
if (store) {
store.dispatch({
type: GENERATE_AUTH_TOKEN_SUCCESS,
data: {
authToken: response.auth_token
}
});
}
Lbryio.authToken = response.auth_token;
return res(response);
@ -508,36 +541,6 @@ function doTransifexUpload(contents, project, token, success, fail) {
});
}
function doGenerateAuthToken(installationId) {
return dispatch => {
dispatch({
type: GENERATE_AUTH_TOKEN_STARTED
});
Lbryio.call('user', 'new', {
auth_token: '',
language: 'en',
app_id: installationId
}, 'post').then(response => {
if (!response.auth_token) {
dispatch({
type: GENERATE_AUTH_TOKEN_FAILURE
});
} else {
dispatch({
type: GENERATE_AUTH_TOKEN_SUCCESS,
data: {
authToken: response.auth_token
}
});
}
}).catch(() => {
dispatch({
type: GENERATE_AUTH_TOKEN_FAILURE
});
});
};
}
function doFetchCostInfoForUri(uri) {
return (dispatch, getState) => {
const state = getState();
@ -1128,31 +1131,6 @@ const doUpdateUploadProgress = (progress, params, xhr) => dispatch => dispatch({
}
});
const reducers = {};
const defaultState = {
authenticating: false
};
reducers[GENERATE_AUTH_TOKEN_FAILURE] = state => Object.assign({}, state, {
authToken: null,
authenticating: false
});
reducers[GENERATE_AUTH_TOKEN_STARTED] = state => Object.assign({}, state, {
authenticating: true
});
reducers[GENERATE_AUTH_TOKEN_SUCCESS] = (state, action) => Object.assign({}, state, {
authToken: action.data.authToken,
authenticating: false
});
function authReducer(state = defaultState, action) {
const handler = reducers[action.type];
if (handler) return handler(state, action);
return state;
}
// util for creating reducers
// based off of redux-actions
// https://redux-actions.js.org/docs/api/handleAction.html#handleactions
@ -1170,7 +1148,7 @@ const handleActions = (actionMap, defaultState) => (state = defaultState, action
return state;
};
const defaultState$1 = {
const defaultState = {
fetching: {},
byUri: {}
};
@ -1199,9 +1177,9 @@ const costInfoReducer = handleActions({
fetching: newFetching
};
}
}, defaultState$1);
}, defaultState);
const defaultState$2 = {
const defaultState$1 = {
fetchingBlackListedOutpoints: false,
fetchingBlackListedOutpointsSucceed: undefined,
blackListedOutpoints: undefined
@ -1232,9 +1210,9 @@ const blacklistReducer = handleActions({
fetchingBlackListedOutpointsError: error
};
}
}, defaultState$2);
}, defaultState$1);
const defaultState$3 = {
const defaultState$2 = {
loading: false,
filteredOutpoints: undefined
};
@ -1260,9 +1238,9 @@ const filteredReducer = handleActions({
fetchingFilteredOutpointsError: error
};
}
}, defaultState$3);
}, defaultState$2);
const defaultState$4 = {
const defaultState$3 = {
fetchingFeaturedContent: false,
fetchingFeaturedContentFailed: false,
featuredUris: undefined,
@ -1299,9 +1277,9 @@ const homepageReducer = handleActions({
trendingUris: uris
};
}
}, defaultState$4);
}, defaultState$3);
const defaultState$5 = {
const defaultState$4 = {
fetchingViewCount: false,
viewCountError: undefined,
viewCountById: {},
@ -1348,10 +1326,10 @@ const statsReducer = handleActions({
subCountById
};
}
}, defaultState$5);
}, defaultState$4);
const reducers$1 = {};
const defaultState$6 = {
const reducers = {};
const defaultState$5 = {
hasSyncedWallet: false,
syncHash: null,
syncData: null,
@ -1365,12 +1343,12 @@ const defaultState$6 = {
hashChanged: false
};
reducers$1[GET_SYNC_STARTED] = state => Object.assign({}, state, {
reducers[GET_SYNC_STARTED] = state => Object.assign({}, state, {
getSyncIsPending: true,
getSyncErrorMessage: null
});
reducers$1[GET_SYNC_COMPLETED] = (state, action) => Object.assign({}, state, {
reducers[GET_SYNC_COMPLETED] = (state, action) => Object.assign({}, state, {
syncHash: action.data.syncHash,
syncData: action.data.syncData,
hasSyncedWallet: action.data.hasSyncedWallet,
@ -1378,22 +1356,22 @@ reducers$1[GET_SYNC_COMPLETED] = (state, action) => Object.assign({}, state, {
hashChanged: action.data.hashChanged
});
reducers$1[GET_SYNC_FAILED] = (state, action) => Object.assign({}, state, {
reducers[GET_SYNC_FAILED] = (state, action) => Object.assign({}, state, {
getSyncIsPending: false,
getSyncErrorMessage: action.data.error
});
reducers$1[SET_SYNC_STARTED] = state => Object.assign({}, state, {
reducers[SET_SYNC_STARTED] = state => Object.assign({}, state, {
setSyncIsPending: true,
setSyncErrorMessage: null
});
reducers$1[SET_SYNC_FAILED] = (state, action) => Object.assign({}, state, {
reducers[SET_SYNC_FAILED] = (state, action) => Object.assign({}, state, {
setSyncIsPending: false,
setSyncErrorMessage: action.data.error
});
reducers$1[SET_SYNC_COMPLETED] = (state, action) => Object.assign({}, state, {
reducers[SET_SYNC_COMPLETED] = (state, action) => Object.assign({}, state, {
setSyncIsPending: false,
setSyncErrorMessage: null,
hasSyncedWallet: true,
@ -1401,30 +1379,30 @@ reducers$1[SET_SYNC_COMPLETED] = (state, action) => Object.assign({}, state, {
syncHash: action.data.syncHash
});
reducers$1[SYNC_APPLY_STARTED] = state => Object.assign({}, state, {
reducers[SYNC_APPLY_STARTED] = state => Object.assign({}, state, {
syncApplyPasswordError: false,
syncApplyIsPending: true,
syncApplyErrorMessage: ''
});
reducers$1[SYNC_APPLY_COMPLETED] = state => Object.assign({}, state, {
reducers[SYNC_APPLY_COMPLETED] = state => Object.assign({}, state, {
syncApplyIsPending: false,
syncApplyErrorMessage: ''
});
reducers$1[SYNC_APPLY_FAILED] = (state, action) => Object.assign({}, state, {
reducers[SYNC_APPLY_FAILED] = (state, action) => Object.assign({}, state, {
syncApplyIsPending: false,
syncApplyErrorMessage: action.data.error
});
reducers$1[SYNC_APPLY_BAD_PASSWORD] = state => Object.assign({}, state, {
reducers[SYNC_APPLY_BAD_PASSWORD] = state => Object.assign({}, state, {
syncApplyPasswordError: true
});
reducers$1[SYNC_RESET] = () => defaultState$6;
reducers[SYNC_RESET] = () => defaultState$5;
function syncReducer(state = defaultState$6, action) {
const handler = reducers$1[action.type];
function syncReducer(state = defaultState$5, action) {
const handler = reducers[action.type];
if (handler) return handler(state, action);
return state;
}
@ -1443,12 +1421,12 @@ test mock:
},
*/
const reducers$2 = {};
const defaultState$7 = {
const reducers$1 = {};
const defaultState$6 = {
currentUploads: {}
};
reducers$2[UPDATE_UPLOAD_PROGRESS] = (state, action) => {
reducers$1[UPDATE_UPLOAD_PROGRESS] = (state, action) => {
const {
progress,
params,
@ -1478,77 +1456,71 @@ reducers$2[UPDATE_UPLOAD_PROGRESS] = (state, action) => {
};
};
function webReducer(state = defaultState$7, action) {
const handler = reducers$2[action.type];
function webReducer(state = defaultState$6, action) {
const handler = reducers$1[action.type];
if (handler) return handler(state, action);
return state;
}
const selectState = state => state.auth || {};
const selectAuthToken = reselect.createSelector(selectState, state => state.authToken);
const selectIsAuthenticating = reselect.createSelector(selectState, state => state.authenticating);
const selectState$1 = state => state.costInfo || {};
const selectAllCostInfoByUri = reselect.createSelector(selectState$1, state => state.byUri || {});
const selectState = state => state.costInfo || {};
const selectAllCostInfoByUri = reselect.createSelector(selectState, state => state.byUri || {});
const makeSelectCostInfoForUri = uri => reselect.createSelector(selectAllCostInfoByUri, costInfos => costInfos && costInfos[uri]);
const selectFetchingCostInfo = reselect.createSelector(selectState$1, state => state.fetching || {});
const selectFetchingCostInfo = reselect.createSelector(selectState, state => state.fetching || {});
const makeSelectFetchingCostInfoForUri = uri => reselect.createSelector(selectFetchingCostInfo, fetchingByUri => fetchingByUri && fetchingByUri[uri]);
const selectState$2 = state => state.blacklist || {};
const selectBlackListedOutpoints = reselect.createSelector(selectState$2, state => state.blackListedOutpoints);
const selectState$1 = state => state.blacklist || {};
const selectBlackListedOutpoints = reselect.createSelector(selectState$1, state => state.blackListedOutpoints);
const selectBlacklistedOutpointMap = reselect.createSelector(selectBlackListedOutpoints, outpoints => outpoints ? outpoints.reduce((acc, val) => {
const outpoint = `${val.txid}:${val.nout}`;
acc[outpoint] = 1;
return acc;
}, {}) : {});
const selectState$3 = state => state.filtered || {};
const selectFilteredOutpoints = reselect.createSelector(selectState$3, state => state.filteredOutpoints);
const selectState$2 = state => state.filtered || {};
const selectFilteredOutpoints = reselect.createSelector(selectState$2, state => state.filteredOutpoints);
const selectFilteredOutpointMap = reselect.createSelector(selectFilteredOutpoints, outpoints => outpoints ? outpoints.reduce((acc, val) => {
const outpoint = `${val.txid}:${val.nout}`;
acc[outpoint] = 1;
return acc;
}, {}) : {});
const selectState$4 = state => state.homepage || {};
const selectState$3 = state => state.homepage || {};
const selectFeaturedUris = reselect.createSelector(selectState$4, state => state.featuredUris);
const selectFetchingFeaturedUris = reselect.createSelector(selectState$4, state => state.fetchingFeaturedContent);
const selectTrendingUris = reselect.createSelector(selectState$4, state => state.trendingUris);
const selectFetchingTrendingUris = reselect.createSelector(selectState$4, state => state.fetchingTrendingContent);
const selectFeaturedUris = reselect.createSelector(selectState$3, state => state.featuredUris);
const selectFetchingFeaturedUris = reselect.createSelector(selectState$3, state => state.fetchingFeaturedContent);
const selectTrendingUris = reselect.createSelector(selectState$3, state => state.trendingUris);
const selectFetchingTrendingUris = reselect.createSelector(selectState$3, state => state.fetchingTrendingContent);
const selectState$5 = state => state.stats || {};
const selectState$4 = state => state.stats || {};
const selectViewCount = reselect.createSelector(selectState$5, state => state.viewCountById);
const selectSubCount = reselect.createSelector(selectState$5, state => state.subCountById);
const selectViewCount = reselect.createSelector(selectState$4, state => state.viewCountById);
const selectSubCount = reselect.createSelector(selectState$4, state => state.subCountById);
const makeSelectViewCountForUri = uri => reselect.createSelector(lbryRedux.makeSelectClaimForUri(uri), selectViewCount, (claim, viewCountById) => claim ? viewCountById[claim.claim_id] || 0 : 0);
const makeSelectSubCountForUri = uri => reselect.createSelector(lbryRedux.makeSelectClaimForUri(uri), selectSubCount, (claim, subCountById) => claim ? subCountById[claim.claim_id] || 0 : 0);
const selectState$6 = state => state.sync || {};
const selectState$5 = state => state.sync || {};
const selectHasSyncedWallet = reselect.createSelector(selectState$6, state => state.hasSyncedWallet);
const selectSyncHash = reselect.createSelector(selectState$6, state => state.syncHash);
const selectSyncData = reselect.createSelector(selectState$6, state => state.syncData);
const selectSetSyncErrorMessage = reselect.createSelector(selectState$6, state => state.setSyncErrorMessage);
const selectGetSyncErrorMessage = reselect.createSelector(selectState$6, state => state.getSyncErrorMessage);
const selectGetSyncIsPending = reselect.createSelector(selectState$6, state => state.getSyncIsPending);
const selectSetSyncIsPending = reselect.createSelector(selectState$6, state => state.setSyncIsPending);
const selectHashChanged = reselect.createSelector(selectState$6, state => state.hashChanged);
const selectSyncApplyIsPending = reselect.createSelector(selectState$6, state => state.syncApplyIsPending);
const selectSyncApplyErrorMessage = reselect.createSelector(selectState$6, state => state.syncApplyErrorMessage);
const selectSyncApplyPasswordError = reselect.createSelector(selectState$6, state => state.syncApplyPasswordError);
const selectHasSyncedWallet = reselect.createSelector(selectState$5, state => state.hasSyncedWallet);
const selectSyncHash = reselect.createSelector(selectState$5, state => state.syncHash);
const selectSyncData = reselect.createSelector(selectState$5, state => state.syncData);
const selectSetSyncErrorMessage = reselect.createSelector(selectState$5, state => state.setSyncErrorMessage);
const selectGetSyncErrorMessage = reselect.createSelector(selectState$5, state => state.getSyncErrorMessage);
const selectGetSyncIsPending = reselect.createSelector(selectState$5, state => state.getSyncIsPending);
const selectSetSyncIsPending = reselect.createSelector(selectState$5, state => state.setSyncIsPending);
const selectHashChanged = reselect.createSelector(selectState$5, state => state.hashChanged);
const selectSyncApplyIsPending = reselect.createSelector(selectState$5, state => state.syncApplyIsPending);
const selectSyncApplyErrorMessage = reselect.createSelector(selectState$5, state => state.syncApplyErrorMessage);
const selectSyncApplyPasswordError = reselect.createSelector(selectState$5, state => state.syncApplyPasswordError);
const selectState$7 = state => state.web || {};
const selectState$6 = state => state.web || {};
const selectCurrentUploads = reselect.createSelector(selectState$7, state => state.currentUploads);
const selectCurrentUploads = reselect.createSelector(selectState$6, state => state.currentUploads);
const selectUploadCount = reselect.createSelector(selectCurrentUploads, currentUploads => currentUploads && Object.keys(currentUploads).length);
exports.ERRORS = errors;
exports.LBRYINC_ACTIONS = action_types;
exports.Lbryio = Lbryio;
exports.YOUTUBE_STATUSES = youtube;
exports.authReducer = authReducer;
exports.blacklistReducer = blacklistReducer;
exports.costInfoReducer = costInfoReducer;
exports.doBlackListedOutpointsSubscribe = doBlackListedOutpointsSubscribe;
@ -1559,7 +1531,6 @@ exports.doFetchSubCount = doFetchSubCount;
exports.doFetchTrendingUris = doFetchTrendingUris;
exports.doFetchViewCount = doFetchViewCount;
exports.doFilteredOutpointsSubscribe = doFilteredOutpointsSubscribe;
exports.doGenerateAuthToken = doGenerateAuthToken;
exports.doGetSync = doGetSync;
exports.doResetSync = doResetSync;
exports.doSetDefaultAccount = doSetDefaultAccount;
@ -1575,7 +1546,6 @@ exports.makeSelectFetchingCostInfoForUri = makeSelectFetchingCostInfoForUri;
exports.makeSelectSubCountForUri = makeSelectSubCountForUri;
exports.makeSelectViewCountForUri = makeSelectViewCountForUri;
exports.selectAllCostInfoByUri = selectAllCostInfoByUri;
exports.selectAuthToken = selectAuthToken;
exports.selectBlackListedOutpoints = selectBlackListedOutpoints;
exports.selectBlacklistedOutpointMap = selectBlacklistedOutpointMap;
exports.selectCurrentUploads = selectCurrentUploads;
@ -1589,7 +1559,6 @@ exports.selectGetSyncErrorMessage = selectGetSyncErrorMessage;
exports.selectGetSyncIsPending = selectGetSyncIsPending;
exports.selectHasSyncedWallet = selectHasSyncedWallet;
exports.selectHashChanged = selectHashChanged;
exports.selectIsAuthenticating = selectIsAuthenticating;
exports.selectSetSyncErrorMessage = selectSetSyncErrorMessage;
exports.selectSetSyncIsPending = selectSetSyncIsPending;
exports.selectSyncApplyErrorMessage = selectSyncApplyErrorMessage;

497
dist/bundle.js vendored
View file

@ -112,135 +112,124 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var util_transifex_upload__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doTransifexUpload", function() { return util_transifex_upload__WEBPACK_IMPORTED_MODULE_4__["doTransifexUpload"]; });
/* harmony import */ var redux_actions_auth__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(15);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doGenerateAuthToken", function() { return redux_actions_auth__WEBPACK_IMPORTED_MODULE_5__["doGenerateAuthToken"]; });
/* harmony import */ var redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(15);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchCostInfoForUri", function() { return redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_5__["doFetchCostInfoForUri"]; });
/* harmony import */ var redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(16);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchCostInfoForUri", function() { return redux_actions_cost_info__WEBPACK_IMPORTED_MODULE_6__["doFetchCostInfoForUri"]; });
/* harmony import */ var redux_actions_blacklist__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(16);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doBlackListedOutpointsSubscribe", function() { return redux_actions_blacklist__WEBPACK_IMPORTED_MODULE_6__["doBlackListedOutpointsSubscribe"]; });
/* harmony import */ var redux_actions_blacklist__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(17);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doBlackListedOutpointsSubscribe", function() { return redux_actions_blacklist__WEBPACK_IMPORTED_MODULE_7__["doBlackListedOutpointsSubscribe"]; });
/* harmony import */ var redux_actions_filtered__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(17);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFilteredOutpointsSubscribe", function() { return redux_actions_filtered__WEBPACK_IMPORTED_MODULE_7__["doFilteredOutpointsSubscribe"]; });
/* harmony import */ var redux_actions_filtered__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(18);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFilteredOutpointsSubscribe", function() { return redux_actions_filtered__WEBPACK_IMPORTED_MODULE_8__["doFilteredOutpointsSubscribe"]; });
/* harmony import */ var redux_actions_homepage__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(18);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchFeaturedUris", function() { return redux_actions_homepage__WEBPACK_IMPORTED_MODULE_8__["doFetchFeaturedUris"]; });
/* harmony import */ var redux_actions_homepage__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(19);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchFeaturedUris", function() { return redux_actions_homepage__WEBPACK_IMPORTED_MODULE_9__["doFetchFeaturedUris"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchTrendingUris", function() { return redux_actions_homepage__WEBPACK_IMPORTED_MODULE_8__["doFetchTrendingUris"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchTrendingUris", function() { return redux_actions_homepage__WEBPACK_IMPORTED_MODULE_9__["doFetchTrendingUris"]; });
/* harmony import */ var redux_actions_stats__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(19);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchViewCount", function() { return redux_actions_stats__WEBPACK_IMPORTED_MODULE_9__["doFetchViewCount"]; });
/* harmony import */ var redux_actions_stats__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(20);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchViewCount", function() { return redux_actions_stats__WEBPACK_IMPORTED_MODULE_10__["doFetchViewCount"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchSubCount", function() { return redux_actions_stats__WEBPACK_IMPORTED_MODULE_9__["doFetchSubCount"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doFetchSubCount", function() { return redux_actions_stats__WEBPACK_IMPORTED_MODULE_10__["doFetchSubCount"]; });
/* harmony import */ var redux_actions_sync__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(20);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doCheckSync", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_10__["doCheckSync"]; });
/* harmony import */ var redux_actions_sync__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(21);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doCheckSync", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_11__["doCheckSync"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doGetSync", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_10__["doGetSync"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doGetSync", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_11__["doGetSync"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doSetSync", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_10__["doSetSync"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doSetSync", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_11__["doSetSync"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doSetDefaultAccount", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_10__["doSetDefaultAccount"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doSetDefaultAccount", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_11__["doSetDefaultAccount"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doSyncApply", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_10__["doSyncApply"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doSyncApply", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_11__["doSyncApply"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doResetSync", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_10__["doResetSync"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doResetSync", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_11__["doResetSync"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doSyncEncryptAndDecrypt", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_10__["doSyncEncryptAndDecrypt"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doSyncEncryptAndDecrypt", function() { return redux_actions_sync__WEBPACK_IMPORTED_MODULE_11__["doSyncEncryptAndDecrypt"]; });
/* harmony import */ var redux_actions_web__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(21);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doUpdateUploadProgress", function() { return redux_actions_web__WEBPACK_IMPORTED_MODULE_11__["doUpdateUploadProgress"]; });
/* harmony import */ var redux_actions_web__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(22);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "doUpdateUploadProgress", function() { return redux_actions_web__WEBPACK_IMPORTED_MODULE_12__["doUpdateUploadProgress"]; });
/* harmony import */ var redux_reducers_cost_info__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(22);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "costInfoReducer", function() { return redux_reducers_cost_info__WEBPACK_IMPORTED_MODULE_12__["costInfoReducer"]; });
/* harmony import */ var redux_reducers_auth__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(23);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "authReducer", function() { return redux_reducers_auth__WEBPACK_IMPORTED_MODULE_13__["authReducer"]; });
/* harmony import */ var redux_reducers_blacklist__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(24);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "blacklistReducer", function() { return redux_reducers_blacklist__WEBPACK_IMPORTED_MODULE_13__["blacklistReducer"]; });
/* harmony import */ var redux_reducers_cost_info__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(24);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "costInfoReducer", function() { return redux_reducers_cost_info__WEBPACK_IMPORTED_MODULE_14__["costInfoReducer"]; });
/* harmony import */ var redux_reducers_filtered__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(25);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "filteredReducer", function() { return redux_reducers_filtered__WEBPACK_IMPORTED_MODULE_14__["filteredReducer"]; });
/* harmony import */ var redux_reducers_blacklist__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(26);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "blacklistReducer", function() { return redux_reducers_blacklist__WEBPACK_IMPORTED_MODULE_15__["blacklistReducer"]; });
/* harmony import */ var redux_reducers_homepage__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(26);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "homepageReducer", function() { return redux_reducers_homepage__WEBPACK_IMPORTED_MODULE_15__["homepageReducer"]; });
/* harmony import */ var redux_reducers_filtered__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(27);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "filteredReducer", function() { return redux_reducers_filtered__WEBPACK_IMPORTED_MODULE_16__["filteredReducer"]; });
/* harmony import */ var redux_reducers_stats__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(27);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "statsReducer", function() { return redux_reducers_stats__WEBPACK_IMPORTED_MODULE_16__["statsReducer"]; });
/* harmony import */ var redux_reducers_homepage__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(28);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "homepageReducer", function() { return redux_reducers_homepage__WEBPACK_IMPORTED_MODULE_17__["homepageReducer"]; });
/* harmony import */ var redux_reducers_sync__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(28);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "syncReducer", function() { return redux_reducers_sync__WEBPACK_IMPORTED_MODULE_17__["syncReducer"]; });
/* harmony import */ var redux_reducers_stats__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(29);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "statsReducer", function() { return redux_reducers_stats__WEBPACK_IMPORTED_MODULE_18__["statsReducer"]; });
/* harmony import */ var redux_reducers_web__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(29);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "webReducer", function() { return redux_reducers_web__WEBPACK_IMPORTED_MODULE_18__["webReducer"]; });
/* harmony import */ var redux_reducers_sync__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(30);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "syncReducer", function() { return redux_reducers_sync__WEBPACK_IMPORTED_MODULE_19__["syncReducer"]; });
/* harmony import */ var redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(30);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeSelectFetchingCostInfoForUri", function() { return redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_19__["makeSelectFetchingCostInfoForUri"]; });
/* harmony import */ var redux_reducers_web__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(31);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "webReducer", function() { return redux_reducers_web__WEBPACK_IMPORTED_MODULE_20__["webReducer"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeSelectCostInfoForUri", function() { return redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_19__["makeSelectCostInfoForUri"]; });
/* harmony import */ var redux_selectors_auth__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(32);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectAuthToken", function() { return redux_selectors_auth__WEBPACK_IMPORTED_MODULE_21__["selectAuthToken"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectAllCostInfoByUri", function() { return redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_19__["selectAllCostInfoByUri"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectIsAuthenticating", function() { return redux_selectors_auth__WEBPACK_IMPORTED_MODULE_21__["selectIsAuthenticating"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFetchingCostInfo", function() { return redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_19__["selectFetchingCostInfo"]; });
/* harmony import */ var redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(34);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeSelectFetchingCostInfoForUri", function() { return redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_22__["makeSelectFetchingCostInfoForUri"]; });
/* harmony import */ var redux_selectors_blacklist__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(32);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectBlackListedOutpoints", function() { return redux_selectors_blacklist__WEBPACK_IMPORTED_MODULE_20__["selectBlackListedOutpoints"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeSelectCostInfoForUri", function() { return redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_22__["makeSelectCostInfoForUri"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectBlacklistedOutpointMap", function() { return redux_selectors_blacklist__WEBPACK_IMPORTED_MODULE_20__["selectBlacklistedOutpointMap"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectAllCostInfoByUri", function() { return redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_22__["selectAllCostInfoByUri"]; });
/* harmony import */ var redux_selectors_filtered__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(33);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFilteredOutpoints", function() { return redux_selectors_filtered__WEBPACK_IMPORTED_MODULE_21__["selectFilteredOutpoints"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFetchingCostInfo", function() { return redux_selectors_cost_info__WEBPACK_IMPORTED_MODULE_22__["selectFetchingCostInfo"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFilteredOutpointMap", function() { return redux_selectors_filtered__WEBPACK_IMPORTED_MODULE_21__["selectFilteredOutpointMap"]; });
/* harmony import */ var redux_selectors_blacklist__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(35);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectBlackListedOutpoints", function() { return redux_selectors_blacklist__WEBPACK_IMPORTED_MODULE_23__["selectBlackListedOutpoints"]; });
/* harmony import */ var redux_selectors_homepage__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(34);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFeaturedUris", function() { return redux_selectors_homepage__WEBPACK_IMPORTED_MODULE_22__["selectFeaturedUris"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectBlacklistedOutpointMap", function() { return redux_selectors_blacklist__WEBPACK_IMPORTED_MODULE_23__["selectBlacklistedOutpointMap"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFetchingFeaturedUris", function() { return redux_selectors_homepage__WEBPACK_IMPORTED_MODULE_22__["selectFetchingFeaturedUris"]; });
/* harmony import */ var redux_selectors_filtered__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(36);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFilteredOutpoints", function() { return redux_selectors_filtered__WEBPACK_IMPORTED_MODULE_24__["selectFilteredOutpoints"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectTrendingUris", function() { return redux_selectors_homepage__WEBPACK_IMPORTED_MODULE_22__["selectTrendingUris"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFilteredOutpointMap", function() { return redux_selectors_filtered__WEBPACK_IMPORTED_MODULE_24__["selectFilteredOutpointMap"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFetchingTrendingUris", function() { return redux_selectors_homepage__WEBPACK_IMPORTED_MODULE_22__["selectFetchingTrendingUris"]; });
/* harmony import */ var redux_selectors_homepage__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(37);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFeaturedUris", function() { return redux_selectors_homepage__WEBPACK_IMPORTED_MODULE_25__["selectFeaturedUris"]; });
/* harmony import */ var redux_selectors_stats__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(35);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeSelectViewCountForUri", function() { return redux_selectors_stats__WEBPACK_IMPORTED_MODULE_23__["makeSelectViewCountForUri"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFetchingFeaturedUris", function() { return redux_selectors_homepage__WEBPACK_IMPORTED_MODULE_25__["selectFetchingFeaturedUris"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeSelectSubCountForUri", function() { return redux_selectors_stats__WEBPACK_IMPORTED_MODULE_23__["makeSelectSubCountForUri"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectTrendingUris", function() { return redux_selectors_homepage__WEBPACK_IMPORTED_MODULE_25__["selectTrendingUris"]; });
/* harmony import */ var redux_selectors_sync__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(36);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectHasSyncedWallet", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_24__["selectHasSyncedWallet"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectFetchingTrendingUris", function() { return redux_selectors_homepage__WEBPACK_IMPORTED_MODULE_25__["selectFetchingTrendingUris"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncData", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_24__["selectSyncData"]; });
/* harmony import */ var redux_selectors_stats__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(38);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeSelectViewCountForUri", function() { return redux_selectors_stats__WEBPACK_IMPORTED_MODULE_26__["makeSelectViewCountForUri"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncHash", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_24__["selectSyncHash"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "makeSelectSubCountForUri", function() { return redux_selectors_stats__WEBPACK_IMPORTED_MODULE_26__["makeSelectSubCountForUri"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSetSyncErrorMessage", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_24__["selectSetSyncErrorMessage"]; });
/* harmony import */ var redux_selectors_sync__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(39);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectHasSyncedWallet", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_27__["selectHasSyncedWallet"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectGetSyncErrorMessage", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_24__["selectGetSyncErrorMessage"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncData", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_27__["selectSyncData"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectGetSyncIsPending", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_24__["selectGetSyncIsPending"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncHash", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_27__["selectSyncHash"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSetSyncIsPending", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_24__["selectSetSyncIsPending"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSetSyncErrorMessage", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_27__["selectSetSyncErrorMessage"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyIsPending", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_24__["selectSyncApplyIsPending"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectGetSyncErrorMessage", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_27__["selectGetSyncErrorMessage"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectHashChanged", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_24__["selectHashChanged"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectGetSyncIsPending", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_27__["selectGetSyncIsPending"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyErrorMessage", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_24__["selectSyncApplyErrorMessage"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSetSyncIsPending", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_27__["selectSetSyncIsPending"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyPasswordError", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_24__["selectSyncApplyPasswordError"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyIsPending", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_27__["selectSyncApplyIsPending"]; });
/* harmony import */ var redux_selectors_web__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(37);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectCurrentUploads", function() { return redux_selectors_web__WEBPACK_IMPORTED_MODULE_25__["selectCurrentUploads"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectHashChanged", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_27__["selectHashChanged"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyErrorMessage", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_27__["selectSyncApplyErrorMessage"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyPasswordError", function() { return redux_selectors_sync__WEBPACK_IMPORTED_MODULE_27__["selectSyncApplyPasswordError"]; });
/* harmony import */ var redux_selectors_web__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(40);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectCurrentUploads", function() { return redux_selectors_web__WEBPACK_IMPORTED_MODULE_28__["selectCurrentUploads"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectUploadCount", function() { return redux_selectors_web__WEBPACK_IMPORTED_MODULE_28__["selectUploadCount"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "selectUploadCount", function() { return redux_selectors_web__WEBPACK_IMPORTED_MODULE_25__["selectUploadCount"]; });
@ -251,7 +240,7 @@ __webpack_require__.r(__webpack_exports__);
// utils
// actions
// export { doGenerateAuthToken } from 'redux/actions/auth';
@ -260,7 +249,7 @@ __webpack_require__.r(__webpack_exports__);
// reducers
// export { authReducer } from 'redux/reducers/auth';
@ -269,7 +258,7 @@ __webpack_require__.r(__webpack_exports__);
// selectors
// export { selectAuthToken, selectIsAuthenticating } from 'redux/selectors/auth';
@ -563,12 +552,36 @@ Lbryio.call = function (resource, action) {
function makeRequest(url, options) {
return fetch(url, options).then(checkAndParse);
}
} // TOKENS = { auth_token, access_token }
return Lbryio.getAuthToken().then(function (token) {
var fullParams = _objectSpread({
auth_token: token
}, params);
return Lbryio.getTokens().then(function (tokens) {
// string -=> { auth_token: xyz, authorization: abc }
console.log('LBRYIO CALL TOKEN', tokens);
var fullParams = _objectSpread({}, params);
var headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}; // TODO refactor this
// Send both tokens to userMe
// find a way to trigger deleting auth token after success
if (action === 'me') {
if (tokens && tokens.access_token) {
headers.Authorization = "Bearer ".concat(tokens.access_token);
}
if (tokens && tokens.auth_token) {
fullParams.auth_token = tokens.auth_token;
}
} else {
if (tokens && tokens.access_token) {
headers.Authorization = "Bearer ".concat(tokens.access_token);
} else {
fullParams.auth_token = tokens.auth_token;
}
}
Object.keys(fullParams).forEach(function (key) {
var value = fullParams[key];
@ -580,15 +593,14 @@ Lbryio.call = function (resource, action) {
var qs = querystring__WEBPACK_IMPORTED_MODULE_2___default.a.stringify(fullParams);
var url = "".concat(Lbryio.CONNECTION_STRING).concat(resource, "/").concat(action, "?").concat(qs);
var options = {
method: 'GET'
method: 'GET',
headers: headers
};
if (method === 'post') {
options = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
headers: headers,
body: qs
};
url = "".concat(Lbryio.CONNECTION_STRING).concat(resource, "/").concat(action);
@ -606,31 +618,50 @@ Lbryio.getAuthToken = function () {
return new Promise(function (resolve) {
if (Lbryio.authToken) {
resolve(Lbryio.authToken);
} else if (Lbryio.overrides.getAuthToken) {
} else {
Lbryio.overrides.getAuthToken().then(function (token) {
// now { auth_token: <token>, authorization: <token> }
Lbryio.authTokens = token;
resolve(token);
});
} else if (typeof window !== 'undefined') {
var _window = window,
store = _window.store;
if (store) {
var state = store.getState();
var token = state.auth ? state.auth.authToken : null;
Lbryio.authToken = token;
resolve(token);
}
resolve(null);
} else {
resolve(null);
}
});
};
Lbryio.getTokens = function () {
return new Promise(function (resolve) {
Lbryio.overrides.getTokens().then(function (tokens) {
resolve(tokens);
});
});
};
Lbryio.getCurrentUser = function () {
return Lbryio.call('user', 'me');
};
/**
* LBRYIO.AUTHENTICATE()
* @param domain
* @param language
* @returns {null|Promise<any>}
*
* returns user object.
* gets current token,
* then if so, gets current user using lbryio.userMe()
* otherwise calls lbryio.userNew() (with some Lbry.status info)
* then sets the authtoken, and returns the user.
*
* What it actually needs to do is...
* 1) GetAuthTokens( < get tokens from both keycloak and auth_token > )
* a) have auth_token
* b) have sso access token
* 2) Get User Object
* a) access - get user for access token
* b) auth_token - get user for auth_token
* b)
* If <user>
*/
Lbryio.authenticate = function (domain, language) {
if (!Lbryio.enabled) {
@ -649,8 +680,9 @@ Lbryio.authenticate = function (domain, language) {
if (Lbryio.authenticationPromise === null) {
Lbryio.authenticationPromise = new Promise(function (resolve, reject) {
Lbryio.getAuthToken().then(function (token) {
if (!token || token.length > 60) {
// see if we already have a token
Lbryio.getTokens().then(function (tokens) {
if (!tokens) {
return false;
} // check that token works
@ -679,23 +711,18 @@ Lbryio.authenticate = function (domain, language) {
}, 'post').then(function (response) {
if (!response.auth_token) {
throw new Error('auth_token was not set in the response');
}
} // const { store } = window;
// Not setting new "auth_tokens"
// if (Lbryio.overrides.setAuthToken) {
// Lbryio.overrides.setAuthToken(response.auth_token);
// }
// if (store) {
// store.dispatch({
// type: ACTIONS.GENERATE_AUTH_TOKEN_SUCCESS,
// data: { authToken: response.auth_token },
// });
// }
var _window2 = window,
store = _window2.store;
if (Lbryio.overrides.setAuthToken) {
Lbryio.overrides.setAuthToken(response.auth_token);
}
if (store) {
store.dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GENERATE_AUTH_TOKEN_SUCCESS"],
data: {
authToken: response.auth_token
}
});
}
Lbryio.authToken = response.auth_token;
return res(response);
@ -3120,47 +3147,6 @@ module.exports = Array.isArray || function (arr) {
/* 15 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doGenerateAuthToken", function() { return doGenerateAuthToken; });
/* harmony import */ var constants_action_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony import */ var lbryio__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
function doGenerateAuthToken(installationId) {
return function (dispatch) {
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GENERATE_AUTH_TOKEN_STARTED"]
});
lbryio__WEBPACK_IMPORTED_MODULE_1__["default"].call('user', 'new', {
auth_token: '',
language: 'en',
app_id: installationId
}, 'post').then(function (response) {
if (!response.auth_token) {
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GENERATE_AUTH_TOKEN_FAILURE"]
});
} else {
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GENERATE_AUTH_TOKEN_SUCCESS"],
data: {
authToken: response.auth_token
}
});
}
})["catch"](function () {
dispatch({
type: constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GENERATE_AUTH_TOKEN_FAILURE"]
});
});
};
}
/***/ }),
/* 16 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doFetchCostInfoForUri", function() { return doFetchCostInfoForUri; });
@ -3213,7 +3199,7 @@ function doFetchCostInfoForUri(uri) {
}
/***/ }),
/* 17 */
/* 16 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -3292,7 +3278,7 @@ function doBlackListedOutpointsSubscribe() {
}
/***/ }),
/* 18 */
/* 17 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -3369,7 +3355,7 @@ function doFilteredOutpointsSubscribe() {
}
/***/ }),
/* 19 */
/* 18 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -3465,7 +3451,7 @@ function doFetchTrendingUris() {
}
/***/ }),
/* 20 */
/* 19 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -3526,7 +3512,7 @@ var doFetchSubCount = function doFetchSubCount(claimId) {
};
/***/ }),
/* 21 */
/* 20 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -3862,7 +3848,7 @@ function doSyncEncryptAndDecrypt(oldPassword, newPassword, encrypt) {
}
/***/ }),
/* 22 */
/* 21 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -3884,55 +3870,13 @@ var doUpdateUploadProgress = function doUpdateUploadProgress(progress, params, x
};
/***/ }),
/* 23 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "authReducer", function() { return authReducer; });
/* harmony import */ var constants_action_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
var reducers = {};
var defaultState = {
authenticating: false
};
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GENERATE_AUTH_TOKEN_FAILURE"]] = function (state) {
return Object.assign({}, state, {
authToken: null,
authenticating: false
});
};
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GENERATE_AUTH_TOKEN_STARTED"]] = function (state) {
return Object.assign({}, state, {
authenticating: true
});
};
reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["GENERATE_AUTH_TOKEN_SUCCESS"]] = function (state, action) {
return Object.assign({}, state, {
authToken: action.data.authToken,
authenticating: false
});
};
function authReducer() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
var action = arguments.length > 1 ? arguments[1] : undefined;
var handler = reducers[action.type];
if (handler) return handler(state, action);
return state;
}
/***/ }),
/* 24 */
/* 22 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "costInfoReducer", function() { return costInfoReducer; });
/* harmony import */ var util_redux_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25);
/* harmony import */ var util_redux_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23);
/* harmony import */ var constants_action_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
var _handleActions;
@ -3968,7 +3912,7 @@ var costInfoReducer = Object(util_redux_utils__WEBPACK_IMPORTED_MODULE_0__["hand
}), _handleActions), defaultState);
/***/ }),
/* 25 */
/* 23 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -3996,14 +3940,14 @@ var handleActions = function handleActions(actionMap, defaultState) {
};
/***/ }),
/* 26 */
/* 24 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "blacklistReducer", function() { return blacklistReducer; });
/* harmony import */ var constants_action_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony import */ var util_redux_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(25);
/* harmony import */ var util_redux_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23);
var _handleActions;
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
@ -4042,14 +3986,14 @@ var blacklistReducer = Object(util_redux_utils__WEBPACK_IMPORTED_MODULE_1__["han
}), _handleActions), defaultState);
/***/ }),
/* 27 */
/* 25 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filteredReducer", function() { return filteredReducer; });
/* harmony import */ var constants_action_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony import */ var util_redux_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(25);
/* harmony import */ var util_redux_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(23);
var _handleActions;
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
@ -4081,13 +4025,13 @@ var filteredReducer = Object(util_redux_utils__WEBPACK_IMPORTED_MODULE_1__["hand
}), _handleActions), defaultState);
/***/ }),
/* 28 */
/* 26 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "homepageReducer", function() { return homepageReducer; });
/* harmony import */ var util_redux_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25);
/* harmony import */ var util_redux_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23);
/* harmony import */ var constants_action_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
var _handleActions;
@ -4134,13 +4078,13 @@ var homepageReducer = Object(util_redux_utils__WEBPACK_IMPORTED_MODULE_0__["hand
}), _handleActions), defaultState);
/***/ }),
/* 29 */
/* 27 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "statsReducer", function() { return statsReducer; });
/* harmony import */ var util_redux_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25);
/* harmony import */ var util_redux_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(23);
/* harmony import */ var constants_action_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
var _handleActions;
@ -4199,7 +4143,7 @@ var statsReducer = Object(util_redux_utils__WEBPACK_IMPORTED_MODULE_0__["handleA
}), _handleActions), defaultState);
/***/ }),
/* 30 */
/* 28 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -4311,7 +4255,7 @@ function syncReducer() {
}
/***/ }),
/* 31 */
/* 29 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -4379,30 +4323,41 @@ function webReducer() {
}
/***/ }),
/* 32 */
/* 30 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectAuthToken", function() { return selectAuthToken; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectIsAuthenticating", function() { return selectIsAuthenticating; });
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectState", function() { return selectState; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectAllCostInfoByUri", function() { return selectAllCostInfoByUri; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeSelectCostInfoForUri", function() { return makeSelectCostInfoForUri; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectFetchingCostInfo", function() { return selectFetchingCostInfo; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeSelectFetchingCostInfoForUri", function() { return makeSelectFetchingCostInfoForUri; });
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
var selectState = function selectState(state) {
return state.auth || {};
return state.costInfo || {};
};
var selectAllCostInfoByUri = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.byUri || {};
});
var makeSelectCostInfoForUri = function makeSelectCostInfoForUri(uri) {
return Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectAllCostInfoByUri, function (costInfos) {
return costInfos && costInfos[uri];
});
};
var selectFetchingCostInfo = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.fetching || {};
});
var makeSelectFetchingCostInfoForUri = function makeSelectFetchingCostInfoForUri(uri) {
return Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectFetchingCostInfo, function (fetchingByUri) {
return fetchingByUri && fetchingByUri[uri];
});
};
var selectAuthToken = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.authToken;
});
var selectIsAuthenticating = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.authenticating;
});
/***/ }),
/* 33 */
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -4533,41 +4488,7 @@ function createStructuredSelector(selectors) {
}
/***/ }),
/* 34 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectState", function() { return selectState; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectAllCostInfoByUri", function() { return selectAllCostInfoByUri; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeSelectCostInfoForUri", function() { return makeSelectCostInfoForUri; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectFetchingCostInfo", function() { return selectFetchingCostInfo; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeSelectFetchingCostInfoForUri", function() { return makeSelectFetchingCostInfoForUri; });
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
var selectState = function selectState(state) {
return state.costInfo || {};
};
var selectAllCostInfoByUri = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.byUri || {};
});
var makeSelectCostInfoForUri = function makeSelectCostInfoForUri(uri) {
return Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectAllCostInfoByUri, function (costInfos) {
return costInfos && costInfos[uri];
});
};
var selectFetchingCostInfo = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectState, function (state) {
return state.fetching || {};
});
var makeSelectFetchingCostInfoForUri = function makeSelectFetchingCostInfoForUri(uri) {
return Object(reselect__WEBPACK_IMPORTED_MODULE_0__["createSelector"])(selectFetchingCostInfo, function (fetchingByUri) {
return fetchingByUri && fetchingByUri[uri];
});
};
/***/ }),
/* 35 */
/* 32 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -4575,7 +4496,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectState", function() { return selectState; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectBlackListedOutpoints", function() { return selectBlackListedOutpoints; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectBlacklistedOutpointMap", function() { return selectBlacklistedOutpointMap; });
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
var selectState = function selectState(state) {
@ -4593,7 +4514,7 @@ var selectBlacklistedOutpointMap = Object(reselect__WEBPACK_IMPORTED_MODULE_0__[
});
/***/ }),
/* 36 */
/* 33 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -4601,7 +4522,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectState", function() { return selectState; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectFilteredOutpoints", function() { return selectFilteredOutpoints; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectFilteredOutpointMap", function() { return selectFilteredOutpointMap; });
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
var selectState = function selectState(state) {
@ -4619,7 +4540,7 @@ var selectFilteredOutpointMap = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["cr
});
/***/ }),
/* 37 */
/* 34 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -4628,7 +4549,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectFetchingFeaturedUris", function() { return selectFetchingFeaturedUris; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectTrendingUris", function() { return selectTrendingUris; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectFetchingTrendingUris", function() { return selectFetchingTrendingUris; });
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
@ -4650,7 +4571,7 @@ var selectFetchingTrendingUris = Object(reselect__WEBPACK_IMPORTED_MODULE_0__["c
});
/***/ }),
/* 38 */
/* 35 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -4659,7 +4580,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSubCount", function() { return selectSubCount; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeSelectViewCountForUri", function() { return makeSelectViewCountForUri; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeSelectSubCountForUri", function() { return makeSelectSubCountForUri; });
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var lbry_redux__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
/* harmony import */ var lbry_redux__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lbry_redux__WEBPACK_IMPORTED_MODULE_1__);
@ -4688,7 +4609,7 @@ var makeSelectSubCountForUri = function makeSelectSubCountForUri(uri) {
};
/***/ }),
/* 39 */
/* 36 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -4704,7 +4625,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyIsPending", function() { return selectSyncApplyIsPending; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyErrorMessage", function() { return selectSyncApplyErrorMessage; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectSyncApplyPasswordError", function() { return selectSyncApplyPasswordError; });
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);
@ -4747,14 +4668,14 @@ var selectSyncApplyPasswordError = Object(reselect__WEBPACK_IMPORTED_MODULE_0__[
});
/***/ }),
/* 40 */
/* 37 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectCurrentUploads", function() { return selectCurrentUploads; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectUploadCount", function() { return selectUploadCount; });
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(33);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31);
/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(reselect__WEBPACK_IMPORTED_MODULE_0__);

View file

@ -12,7 +12,7 @@ export { LBRYINC_ACTIONS, YOUTUBE_STATUSES, ERRORS };
export { doTransifexUpload } from 'util/transifex-upload';
// actions
export { doGenerateAuthToken } from 'redux/actions/auth';
// export { doGenerateAuthToken } from 'redux/actions/auth';
export { doFetchCostInfoForUri } from 'redux/actions/cost_info';
export { doBlackListedOutpointsSubscribe } from 'redux/actions/blacklist';
export { doFilteredOutpointsSubscribe } from 'redux/actions/filtered';
@ -30,7 +30,7 @@ export {
export { doUpdateUploadProgress } from 'redux/actions/web';
// reducers
export { authReducer } from 'redux/reducers/auth';
// export { authReducer } from 'redux/reducers/auth';
export { costInfoReducer } from 'redux/reducers/cost_info';
export { blacklistReducer } from 'redux/reducers/blacklist';
export { filteredReducer } from 'redux/reducers/filtered';
@ -40,7 +40,7 @@ export { syncReducer } from 'redux/reducers/sync';
export { webReducer } from 'redux/reducers/web';
// selectors
export { selectAuthToken, selectIsAuthenticating } from 'redux/selectors/auth';
// export { selectAuthToken, selectIsAuthenticating } from 'redux/selectors/auth';
export {
makeSelectFetchingCostInfoForUri,
makeSelectCostInfoForUri,

View file

@ -52,9 +52,33 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
function makeRequest(url, options) {
return fetch(url, options).then(checkAndParse);
}
// TOKENS = { auth_token, access_token }
return Lbryio.getTokens().then(tokens => {
// string -=> { auth_token: xyz, authorization: abc }
console.log('LBRYIO CALL TOKEN', tokens);
const fullParams = { ...params };
const headers = {
'Content-Type': 'application/x-www-form-urlencoded',
};
// TODO refactor this
// Send both tokens to userMe
// find a way to trigger deleting auth token after success
if (action === 'me') {
if (tokens && tokens.access_token) {
headers.Authorization = `Bearer ${tokens.access_token}`;
}
if (tokens && tokens.auth_token) {
fullParams.auth_token = tokens.auth_token;
}
} else {
if (tokens && tokens.access_token) {
headers.Authorization = `Bearer ${tokens.access_token}`;
} else {
fullParams.auth_token = tokens.auth_token;
}
}
return Lbryio.getAuthToken().then(token => {
const fullParams = { auth_token: token, ...params };
Object.keys(fullParams).forEach(key => {
const value = fullParams[key];
if (typeof value === 'object') {
@ -67,14 +91,13 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
let options = {
method: 'GET',
headers,
};
if (method === 'post') {
options = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
headers,
body: qs,
};
url = `${Lbryio.CONNECTION_STRING}${resource}/${action}`;
@ -85,32 +108,49 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
};
Lbryio.authToken = null;
Lbryio.getAuthToken = () =>
new Promise(resolve => {
if (Lbryio.authToken) {
resolve(Lbryio.authToken);
} else if (Lbryio.overrides.getAuthToken) {
} else {
Lbryio.overrides.getAuthToken().then(token => {
// now { auth_token: <token>, authorization: <token> }
Lbryio.authTokens = token;
resolve(token);
});
} else if (typeof window !== 'undefined') {
const { store } = window;
if (store) {
const state = store.getState();
const token = state.auth ? state.auth.authToken : null;
Lbryio.authToken = token;
resolve(token);
}
resolve(null);
} else {
resolve(null);
}
});
Lbryio.getTokens = () => new Promise(resolve => {
Lbryio.overrides.getTokens().then(tokens => {
resolve(tokens);
});
});
Lbryio.getCurrentUser = () => Lbryio.call('user', 'me');
/**
* LBRYIO.AUTHENTICATE()
* @param domain
* @param language
* @returns {null|Promise<any>}
*
* returns user object.
* gets current token,
* then if so, gets current user using lbryio.userMe()
* otherwise calls lbryio.userNew() (with some Lbry.status info)
* then sets the authtoken, and returns the user.
*
* What it actually needs to do is...
* 1) GetAuthTokens( < get tokens from both keycloak and auth_token > )
* a) have auth_token
* b) have sso access token
* 2) Get User Object
* a) access - get user for access token
* b) auth_token - get user for auth_token
* b)
* If <user>
*/
Lbryio.authenticate = (domain, language) => {
if (!Lbryio.enabled) {
const params = {
@ -129,9 +169,10 @@ Lbryio.authenticate = (domain, language) => {
if (Lbryio.authenticationPromise === null) {
Lbryio.authenticationPromise = new Promise((resolve, reject) => {
Lbryio.getAuthToken()
.then(token => {
if (!token || token.length > 60) {
// see if we already have a token
Lbryio.getTokens()
.then(tokens => {
if (!tokens) {
return false;
}
@ -174,17 +215,18 @@ Lbryio.authenticate = (domain, language) => {
throw new Error('auth_token was not set in the response');
}
const { store } = window;
if (Lbryio.overrides.setAuthToken) {
Lbryio.overrides.setAuthToken(response.auth_token);
}
// const { store } = window;
// Not setting new "auth_tokens"
// if (Lbryio.overrides.setAuthToken) {
// Lbryio.overrides.setAuthToken(response.auth_token);
// }
if (store) {
store.dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_SUCCESS,
data: { authToken: response.auth_token },
});
}
// if (store) {
// store.dispatch({
// type: ACTIONS.GENERATE_AUTH_TOKEN_SUCCESS,
// data: { authToken: response.auth_token },
// });
// }
Lbryio.authToken = response.auth_token;
return res(response);
})

View file

@ -1,38 +1,38 @@
import * as ACTIONS from 'constants/action_types';
import Lbryio from 'lbryio';
export function doGenerateAuthToken(installationId) {
return dispatch => {
dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_STARTED,
});
Lbryio.call(
'user',
'new',
{
auth_token: '',
language: 'en',
app_id: installationId,
},
'post'
)
.then(response => {
if (!response.auth_token) {
dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_FAILURE,
});
} else {
dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_SUCCESS,
data: { authToken: response.auth_token },
});
}
})
.catch(() => {
dispatch({
type: ACTIONS.GENERATE_AUTH_TOKEN_FAILURE,
});
});
};
}
// import * as ACTIONS from 'constants/action_types';
// import Lbryio from 'lbryio';
//
// export function doGenerateAuthToken(installationId) {
// return dispatch => {
// dispatch({
// type: ACTIONS.GENERATE_AUTH_TOKEN_STARTED,
// });
//
// Lbryio.call(
// 'user',
// 'new',
// {
// auth_token: '',
// language: 'en',
// app_id: installationId,
// },
// 'post'
// )
// .then(response => {
// if (!response.auth_token) {
// dispatch({
// type: ACTIONS.GENERATE_AUTH_TOKEN_FAILURE,
// });
// } else {
// dispatch({
// type: ACTIONS.GENERATE_AUTH_TOKEN_SUCCESS,
// data: { authToken: response.auth_token },
// });
// }
// })
// .catch(() => {
// dispatch({
// type: ACTIONS.GENERATE_AUTH_TOKEN_FAILURE,
// });
// });
// };
// }

View file

@ -1,29 +1,29 @@
import * as ACTIONS from 'constants/action_types';
const reducers = {};
const defaultState = {
authenticating: false,
};
reducers[ACTIONS.GENERATE_AUTH_TOKEN_FAILURE] = state =>
Object.assign({}, state, {
authToken: null,
authenticating: false,
});
reducers[ACTIONS.GENERATE_AUTH_TOKEN_STARTED] = state =>
Object.assign({}, state, {
authenticating: true,
});
reducers[ACTIONS.GENERATE_AUTH_TOKEN_SUCCESS] = (state, action) =>
Object.assign({}, state, {
authToken: action.data.authToken,
authenticating: false,
});
export function authReducer(state = defaultState, action) {
const handler = reducers[action.type];
if (handler) return handler(state, action);
return state;
}
// import * as ACTIONS from 'constants/action_types';
//
// const reducers = {};
// const defaultState = {
// authenticating: false,
// };
//
// reducers[ACTIONS.GENERATE_AUTH_TOKEN_FAILURE] = state =>
// Object.assign({}, state, {
// authToken: null,
// authenticating: false,
// });
//
// reducers[ACTIONS.GENERATE_AUTH_TOKEN_STARTED] = state =>
// Object.assign({}, state, {
// authenticating: true,
// });
//
// reducers[ACTIONS.GENERATE_AUTH_TOKEN_SUCCESS] = (state, action) =>
// Object.assign({}, state, {
// authToken: action.data.authToken,
// authenticating: false,
// });
//
// export function authReducer(state = defaultState, action) {
// const handler = reducers[action.type];
// if (handler) return handler(state, action);
// return state;
// }

View file

@ -2,6 +2,6 @@ import { createSelector } from 'reselect';
const selectState = state => state.auth || {};
export const selectAuthToken = createSelector(selectState, state => state.authToken);
// export const selectAuthToken = createSelector(selectState, state => state.authToken);
export const selectIsAuthenticating = createSelector(selectState, state => state.authenticating);