From 3f2de50368294f150454c58847e48ec74fdd383e Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Mon, 11 Nov 2019 12:17:54 -0500 Subject: [PATCH] bring publish overrides into ui/index.jsx to fix api url being set properly --- lbrytv/setup/api.js | 25 ------------------------- ui/index.jsx | 25 ++++++++++++++++++++++++- ui/redux/actions/app.js | 1 - 3 files changed, 24 insertions(+), 27 deletions(-) delete mode 100644 lbrytv/setup/api.js diff --git a/lbrytv/setup/api.js b/lbrytv/setup/api.js deleted file mode 100644 index 214fb8646..000000000 --- a/lbrytv/setup/api.js +++ /dev/null @@ -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 - ); - }) -); diff --git a/ui/index.jsx b/ui/index.jsx index f3a2a0d24..b874c8000 100644 --- a/ui/index.jsx +++ b/ui/index.jsx @@ -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(); diff --git a/ui/redux/actions/app.js b/ui/redux/actions/app.js index 3ae4f3d26..022cce473 100644 --- a/ui/redux/actions/app.js +++ b/ui/redux/actions/app.js @@ -438,7 +438,6 @@ export function doAnalyticsView(uri, timeToStart) { export function doSignIn() { return (dispatch, getState) => { // @if TARGET='web' - debugger; dispatch(doBalanceSubscribe()); dispatch(doFetchChannelListMine()); // @endif