Endpoint to Open UI
Summary: Expose an endpoint to open Flipper UI. This will be used by the Flipper Server Cocoa app to open the UI. Reviewed By: antonk52 Differential Revision: D51115327 fbshipit-source-id: 1ab1c32d93945cf8d75b145905983738331a6468
This commit is contained in:
committed by
Facebook GitHub Bot
parent
137e75ad46
commit
9b9eb00b63
@@ -23,6 +23,7 @@ import {tracker} from '../tracker';
|
|||||||
import {EnvironmentInfo, isProduction} from 'flipper-common';
|
import {EnvironmentInfo, isProduction} from 'flipper-common';
|
||||||
import {GRAPH_SECRET} from '../fb-stubs/constants';
|
import {GRAPH_SECRET} from '../fb-stubs/constants';
|
||||||
import {sessionId} from '../sessionId';
|
import {sessionId} from '../sessionId';
|
||||||
|
import {UIPreference, openUI} from '../utils/openUI';
|
||||||
|
|
||||||
type Config = {
|
type Config = {
|
||||||
port: number;
|
port: number;
|
||||||
@@ -186,6 +187,13 @@ async function startHTTPServer(
|
|||||||
res.end('flipper-ok');
|
res.end('flipper-ok');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/open-ui', (_req, res) => {
|
||||||
|
tracker.track('server-endpoint-hit', {name: 'open-ui'});
|
||||||
|
const preference = isProduction() ? UIPreference.PWA : UIPreference.Browser;
|
||||||
|
openUI(preference, config.port);
|
||||||
|
res.json({success: true});
|
||||||
|
});
|
||||||
|
|
||||||
app.use(express.static(config.staticPath));
|
app.use(express.static(config.staticPath));
|
||||||
|
|
||||||
const server = http.createServer(app);
|
const server = http.createServer(app);
|
||||||
|
|||||||
Reference in New Issue
Block a user