Move constants to flipperConfig
Summary: Recently we have added a few constants to be used by our main entry point. This change moves them to a central place: flipperConfig. Reviewed By: aigoncharov Differential Revision: D51307088 fbshipit-source-id: 09f0ef0e69e2067ce5c8501367629eeec7523858
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0889a0e02d
commit
49abb4dd41
@@ -17,12 +17,12 @@ declare global {
|
||||
theme: 'light' | 'dark' | 'system';
|
||||
entryPoint: string;
|
||||
debug: boolean;
|
||||
GRAPH_SECRET: string;
|
||||
FLIPPER_APP_VERSION: string;
|
||||
FLIPPER_SESSION_ID: string;
|
||||
FLIPPER_UNIXNAME: string;
|
||||
FLIPPER_AUTH_TOKEN: string;
|
||||
};
|
||||
GRAPH_SECRET: string;
|
||||
FLIPPER_APP_VERSION: string;
|
||||
FLIPPER_SESSION_ID: string;
|
||||
FLIPPER_UNIXNAME: string;
|
||||
FLIPPER_AUTH_TOKEN: string;
|
||||
|
||||
flipperShowMessage?(message: {title?: string; detail?: string}): void;
|
||||
flipperHideMessage?(): void;
|
||||
|
||||
@@ -56,7 +56,7 @@ async function start() {
|
||||
let token = providerParams.get('token');
|
||||
if (!token) {
|
||||
console.info('[flipper-client][ui-browser] Get token from HTML instead');
|
||||
token = window.FLIPPER_AUTH_TOKEN;
|
||||
token = window.flipperConfig.FLIPPER_AUTH_TOKEN;
|
||||
if (!token || token === 'FLIPPER_AUTH_TOKEN_REPLACE_ME') {
|
||||
console.warn(
|
||||
'[flipper-client][ui-browser] Failed to get token from HTML',
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
theme: 'light',
|
||||
entryPoint: 'flipper-ui-browser/src/index-fast-refresh.bundle?platform=web&dev=true&minify=false',
|
||||
debug: true,
|
||||
GRAPH_SECRET: 'GRAPH_SECRET_REPLACE_ME',
|
||||
FLIPPER_APP_VERSION: 'FLIPPER_APP_VERSION_REPLACE_ME',
|
||||
FLIPPER_SESSION_ID: 'FLIPPER_SESSION_ID_REPLACE_ME',
|
||||
FLIPPER_UNIXNAME: 'FLIPPER_UNIXNAME_REPLACE_ME',
|
||||
FLIPPER_AUTH_TOKEN: 'FLIPPER_AUTH_TOKEN_REPLACE_ME',
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
@@ -155,16 +160,10 @@
|
||||
window.flipperShowMessage = showMessage;
|
||||
window.flipperHideMessage = hideMessage;
|
||||
|
||||
window.GRAPH_SECRET = 'GRAPH_SECRET_REPLACE_ME';
|
||||
window.FLIPPER_APP_VERSION = 'FLIPPER_APP_VERSION_REPLACE_ME';
|
||||
window.FLIPPER_SESSION_ID = 'FLIPPER_SESSION_ID_REPLACE_ME';
|
||||
window.FLIPPER_UNIXNAME = 'FLIPPER_UNIXNAME_REPLACE_ME';
|
||||
window.FLIPPER_AUTH_TOKEN = 'FLIPPER_AUTH_TOKEN_REPLACE_ME';
|
||||
|
||||
const params = new URL(location.href).searchParams;
|
||||
let token = params.get('token');
|
||||
if (!token) {
|
||||
token = window.FLIPPER_AUTH_TOKEN
|
||||
token = window.flipperConfig.FLIPPER_AUTH_TOKEN
|
||||
}
|
||||
|
||||
const socket = new WebSocket(`ws://${location.host}?token=${token}`);
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
theme: 'light',
|
||||
entryPoint: 'bundle.js',
|
||||
debug: false,
|
||||
GRAPH_SECRET: 'GRAPH_SECRET_REPLACE_ME',
|
||||
FLIPPER_APP_VERSION: 'FLIPPER_APP_VERSION_REPLACE_ME',
|
||||
FLIPPER_SESSION_ID: 'FLIPPER_SESSION_ID_REPLACE_ME',
|
||||
FLIPPER_UNIXNAME: 'FLIPPER_UNIXNAME_REPLACE_ME',
|
||||
FLIPPER_AUTH_TOKEN: 'FLIPPER_AUTH_TOKEN_REPLACE_ME',
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
@@ -103,12 +108,6 @@
|
||||
window.flipperShowMessage = showMessage;
|
||||
window.flipperHideMessage = hideMessage;
|
||||
|
||||
window.GRAPH_SECRET = 'GRAPH_SECRET_REPLACE_ME';
|
||||
window.FLIPPER_APP_VERSION = 'FLIPPER_APP_VERSION_REPLACE_ME';
|
||||
window.FLIPPER_SESSION_ID = 'FLIPPER_SESSION_ID_REPLACE_ME';
|
||||
window.FLIPPER_UNIXNAME = 'FLIPPER_UNIXNAME_REPLACE_ME';
|
||||
window.FLIPPER_AUTH_TOKEN = 'FLIPPER_AUTH_TOKEN_REPLACE_ME';
|
||||
|
||||
// load correct theme (n.b. this doesn't handle system value specifically, will assume light in such cases)
|
||||
try {
|
||||
if (window.flipperConfig.theme === 'dark') {
|
||||
|
||||
Reference in New Issue
Block a user