update metrics url
This commit is contained in:
parent
6e953c098c
commit
ba1cdd3882
2 changed files with 11 additions and 7 deletions
|
@ -3,7 +3,7 @@ import { Lbryio } from 'lbryinc';
|
|||
import ReactGA from 'react-ga';
|
||||
import * as Sentry from '@sentry/browser';
|
||||
import { history } from './store';
|
||||
import { SDK_HOST } from './index';
|
||||
import { SDK_API_PATH } from './index';
|
||||
// @if TARGET='app'
|
||||
import Native from 'native';
|
||||
import ElectronCookies from '@exponent/electron-cookies';
|
||||
|
@ -247,7 +247,7 @@ function sendGaTimingEvent(category: string, action: string, timeInMs: number, l
|
|||
|
||||
function sendPromMetric(name: string, value?: number) {
|
||||
if (IS_WEB) {
|
||||
let url = new URL(SDK_HOST + '/internal/ui_metric');
|
||||
let url = new URL(SDK_API_PATH + '/metric/ui');
|
||||
const params = { name: name, value: value ? value.toString() : '' };
|
||||
url.search = new URLSearchParams(params).toString();
|
||||
return fetch(url);
|
||||
|
|
14
ui/index.jsx
14
ui/index.jsx
|
@ -52,11 +52,15 @@ if (process.env.NODE_ENV === 'production') {
|
|||
});
|
||||
}
|
||||
|
||||
const PROXY_PATH = 'api/v1/proxy';
|
||||
export const SDK_HOST = `${process.env.SDK_API_URL}` || `https://api.lbry.tv`;
|
||||
export const SDK_API_URL = `${SDK_HOST}/${PROXY_PATH}`;
|
||||
if (process.env.SDK_API_URL) {
|
||||
console.warn('SDK_API_URL env var is deprecated. Use sdkAPIHost instead');
|
||||
}
|
||||
|
||||
Lbry.setDaemonConnectionString(SDK_API_URL);
|
||||
const sdkAPIHost = `${process.env.SDK_API_HOST}` || `${process.env.SDK_API_URL}` || `https://api.lbry.tv`;
|
||||
export const SDK_API_PATH = `${sdkAPIHost}/api/v1`;
|
||||
const proxyURL = `${SDK_API_PATH}/proxy`;
|
||||
|
||||
Lbry.setDaemonConnectionString(proxyURL);
|
||||
|
||||
Lbry.setOverride(
|
||||
'publish',
|
||||
|
@ -64,7 +68,7 @@ Lbry.setOverride(
|
|||
new Promise((resolve, reject) => {
|
||||
apiPublishCallViaWeb(
|
||||
apiCall,
|
||||
SDK_API_URL,
|
||||
proxyURL,
|
||||
Lbry.getApiRequestHeaders() && Object.keys(Lbry.getApiRequestHeaders()).includes(X_LBRY_AUTH_TOKEN)
|
||||
? Lbry.getApiRequestHeaders()[X_LBRY_AUTH_TOKEN]
|
||||
: '',
|
||||
|
|
Loading…
Add table
Reference in a new issue