Files
flipper/desktop/static/index.web.html
Andrey Goncharov cc76a21d80 Add more tracking data for UI startup
Reviewed By: lblasa

Differential Revision: D50365803

fbshipit-source-id: b6a601e7bf987738400a86be6814de7cafd50d3d
2023-10-17 08:28:02 -07:00

122 lines
3.2 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="icon.png">
<link rel="apple-touch-icon" href="/icon.png">
<link rel="stylesheet" href="style.css">
<link rel="manifest" href="manifest.json">
<link id="flipper-theme-import" rel="stylesheet">
<title>Flipper</title>
<script>
window.flipperConfig = {
theme: 'light',
entryPoint: 'bundle.js',
debug: false,
}
</script>
<style>
.message {
-webkit-app-region: drag;
z-index: 999999;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
padding: 50px;
overflow: auto;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
color: #525252;
text-align: center;
}
#troubleshoot {
display: none;
background-color: white;
}
</style>
</head>
<body>
<div id="troubleshoot" class="message">
</div>
<div id="root">
<div id="loading" class="message">
Loading...
</div>
</div>
<script>
(function () {
// FIXME: needed to make Metro work
window.global = window;
// Listen to changes in the network state, reload when online.
// This handles the case when the device is completely offline
// i.e. no network connection.
window.addEventListener('online', () => {
window.location.reload();
});
const root = document.getElementById('root');
const troubleshootBox = document.getElementById('troubleshoot');
function showMessage(text) {
troubleshootBox.innerText = text;
root.style.display = 'none';
troubleshootBox.style.display = 'flex';
}
function hideMessage() {
root.style.display = 'block';
troubleshootBox.style.display = 'none';
}
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';
// load correct theme (n.b. this doesn't handle system value specifically, will assume light in such cases)
try {
if (window.flipperConfig.theme === 'dark') {
document.getElementById('flipper-theme-import').href = "themes/dark.css";
} else {
document.getElementById('flipper-theme-import').href = "themes/light.css";
}
} catch (e) {
console.error("Failed to initialize theme", e);
document.getElementById('flipper-theme-import').href = "themes/light.css";
}
function init() {
const script = document.createElement('script');
script.src = window.flipperConfig.entryPoint;
script.onerror = (e) => {
showMessage('Script failure. Check Chrome Dev Tools console for more info.');
};
document.body.appendChild(script);
}
init();
})();
</script>
</body>
</html>