Move sending intern requests from client to server

Summary: This diff moves send intern request from the browser to the server. The reason to make this change is that making such requests from a browser environment causes CORS restrictions to kick in.

Reviewed By: nikoant

Differential Revision: D32835449

fbshipit-source-id: e8e92e51ca963aa50b3c859bb61c2381171e85ae
This commit is contained in:
Michel Weststrate
2021-12-08 04:25:28 -08:00
committed by Facebook GitHub Bot
parent ad4a55f263
commit 943d535e86
18 changed files with 180 additions and 96 deletions

View File

@@ -13,9 +13,9 @@ import {ReactReduxContext, ReactReduxContextValue} from 'react-redux';
import {Logger} from 'flipper-common';
import {IdlerImpl} from '../utils/Idler';
import {
shareFlipperData,
DataExportResult,
DataExportError,
shareFlipperData,
} from '../fb-stubs/user';
import {
exportStore,

View File

@@ -10,19 +10,6 @@
import {DeviceOS} from 'flipper-plugin';
export default Object.freeze({
GRAPH_APP_ID: '',
GRAPH_CLIENT_TOKEN: '',
GRAPH_ACCESS_TOKEN: '',
// this provides elevated access to scribe. we really shouldn't be exposing this.
// need to investigate how to abstract the scribe logging so it's safe.
GRAPH_SECRET: '',
GRAPH_SECRET_ACCESS_TOKEN: '',
// Provides access to Insights Validation endpoint on interngraph
INSIGHT_INTERN_APP_ID: '',
INSIGHT_INTERN_APP_TOKEN: '',
// Enables the flipper data to be exported through shareabale link
ENABLE_SHAREABLE_LINK: false,
@@ -44,5 +31,4 @@ export default Object.freeze({
SUPPORT_GROUPS: [],
INTERN_URL: '',
INTERNGRAPH_API: '',
});

View File

@@ -7,6 +7,7 @@
* @format
*/
import {GraphFileUpload} from 'flipper-common';
import {Atom, createState} from 'flipper-plugin';
import {User} from '../reducers/user';
@@ -19,7 +20,11 @@ export async function internGraphPOSTAPIRequest(
_formFields: {
[key: string]: any;
} = {},
_internGraphUrl?: string,
_fileFields: Record<string, GraphFileUpload> = {},
_options: {
timeout?: number;
internGraphUrl?: string;
} = {},
): Promise<any> {
throw new Error('Feature not implemented');
}
@@ -29,7 +34,10 @@ export async function internGraphGETAPIRequest(
_params: {
[key: string]: any;
} = {},
_internGraphUrl?: string,
_options: {
timeout?: number;
internGraphUrl?: string;
} = {},
): Promise<any> {
throw new Error('Feature not implemented');
}

View File

@@ -39,13 +39,7 @@ import styled from '@emotion/styled';
import {CopyOutlined} from '@ant-design/icons';
import {getVersionString} from './utils/versionString';
import {PersistGate} from 'redux-persist/integration/react';
import {
setLoggerInstance,
setUserSessionManagerInstance,
Settings,
FlipperServer,
} from 'flipper-common';
import {internGraphPOSTAPIRequest} from './fb-stubs/user';
import {setLoggerInstance, FlipperServer} from 'flipper-common';
import {getRenderHostInstance} from './RenderHost';
import {startGlobalErrorHandling} from './utils/globalErrorHandling';
import {loadTheme} from './utils/loadTheme';
@@ -168,9 +162,6 @@ function init(flipperServer: FlipperServer) {
else console.warn(msg, r.error);
}
});
setUserSessionManagerInstance({
internGraphPOSTAPIRequest,
});
ReactDOM.render(
<AppFrame logger={logger} persistor={persistor} />,

View File

@@ -33,13 +33,13 @@ import {deconstructClientId} from 'flipper-common';
import {processMessageQueue} from './messageQueue';
import {getPluginTitle} from './pluginUtils';
import {capture} from './screenshot';
import {uploadFlipperMedia} from '../fb-stubs/user';
import {Dialog, Idler} from 'flipper-plugin';
import {ClientQuery} from 'flipper-common';
import ShareSheetExportUrl from '../chrome/ShareSheetExportUrl';
import ShareSheetExportFile from '../chrome/ShareSheetExportFile';
import ExportDataPluginSheet from '../chrome/ExportDataPluginSheet';
import {getRenderHostInstance} from '../RenderHost';
import {uploadFlipperMedia} from '../fb-stubs/user';
export const IMPORT_FLIPPER_TRACE_EVENT = 'import-flipper-trace';
export const EXPORT_FLIPPER_TRACE_EVENT = 'export-flipper-trace';