bring publish overrides into ui/index.jsx to fix api url being set properly

This commit is contained in:
Sean Yesmunt 2019-11-11 12:17:54 -05:00
parent ab2ee079e2
commit 3f2de50368
3 changed files with 24 additions and 27 deletions

View file

@ -1,25 +0,0 @@
import { Lbry } from 'lbry-redux';
import apiPublishCallViaWeb from './publish';
import { X_LBRY_AUTH_TOKEN } from '../../ui/constants/token';
const PROXY_PATH = 'api/v1/proxy';
export const SDK_API_URL = `${process.env.SDK_API_URL}/${PROXY_PATH}` || `https://api.lbry.tv/${PROXY_PATH}`;
Lbry.setDaemonConnectionString(SDK_API_URL);
Lbry.setOverride(
'publish',
params =>
new Promise((resolve, reject) => {
apiPublishCallViaWeb(
SDK_API_URL,
Lbry.getApiRequestHeaders() && Object.keys(Lbry.getApiRequestHeaders()).includes(X_LBRY_AUTH_TOKEN)
? Lbry.getApiRequestHeaders()[X_LBRY_AUTH_TOKEN]
: '',
'publish',
params,
resolve,
reject
);
})
);

View file

@ -38,7 +38,30 @@ import { X_LBRY_AUTH_TOKEN } from 'constants/token';
import 'scss/all.scss';
// @if TARGET='web'
import 'lbrytv/setup/api';
// These overrides can't live in lbrytv/ because they need to use the same instance of `Lbry`
import apiPublishCallViaWeb from 'lbrytv/setup/publish';
const PROXY_PATH = 'api/v1/proxy';
export const SDK_API_URL = `${process.env.SDK_API_URL}/${PROXY_PATH}` || `https://api.lbry.tv/${PROXY_PATH}`;
Lbry.setDaemonConnectionString(SDK_API_URL);
Lbry.setOverride(
'publish',
params =>
new Promise((resolve, reject) => {
apiPublishCallViaWeb(
SDK_API_URL,
Lbry.getApiRequestHeaders() && Object.keys(Lbry.getApiRequestHeaders()).includes(X_LBRY_AUTH_TOKEN)
? Lbry.getApiRequestHeaders()[X_LBRY_AUTH_TOKEN]
: '',
'publish',
params,
resolve,
reject
);
})
);
// @endif
const startTime = Date.now();

View file

@ -438,7 +438,6 @@ export function doAnalyticsView(uri, timeToStart) {
export function doSignIn() {
return (dispatch, getState) => {
// @if TARGET='web'
debugger;
dispatch(doBalanceSubscribe());
dispatch(doFetchChannelListMine());
// @endif