Commit Graph

400 Commits

Author SHA1 Message Date
Andrey Goncharov
5693ac7205 Disconnect all mobile clients when all UI clients leave
Summary: Context https://fb.workplace.com/groups/flippersupport/permalink/1730762380737746/

Reviewed By: lblasa

Differential Revision: D51510348

fbshipit-source-id: afafcdd6b89bf1038fec65a7c3e8c2dd9cfd0768
2023-11-22 02:59:27 -08:00
Andrey Goncharov
fb37f27ff5 Suport device-open-app command
Summary: It is an escape hatch for testing iOS Sample app if `navigate('/')` cannot be made to work easily (D51394323)

Reviewed By: lblasa

Differential Revision: D51466697

fbshipit-source-id: fd6c2f37504807b4b634b85cb10e837523dadba8
2023-11-20 07:14:09 -08:00
Andrey Goncharov
ed7a7f7bd0 Fix processExit
Summary: setTimeout should terminate process if graceful termination takes too long. Before, we scheduled the timer only *after* the graceful termination completes which does not make any sense

Reviewed By: lblasa

Differential Revision: D51346673

fbshipit-source-id: b5adadbcf474a8c66839e1fc70bcc6482c47635e
2023-11-15 03:46:46 -08:00
Lorenzo Blasa
6b54bd3173 Remove no longer needed index.web.dev.html
Summary: This is a duplicate, is not needed, causes confusion.

Reviewed By: aigoncharov

Differential Revision: D51307091

fbshipit-source-id: 4d55d727ea5f20100ecd15ad6e23aa0c01722524
2023-11-14 10:53:09 -08:00
Lorenzo Blasa
7de92cb34a Config set from server
Summary: Instead of having duplicate configs defined on our HTML. Move the config definition to the server.

Reviewed By: aigoncharov

Differential Revision: D51307092

fbshipit-source-id: 68f4afc918cf191b3a15b3981429c5a05d5df8df
2023-11-14 10:53:09 -08:00
Anton Kastritskiy
d88cf41a24 Always write ANDROID_HOME and ANDROID_SDK_ROOT
Summary:
When flipper starts it writes to both env vars the value from settings. This is needed for subprocesses to have access to them.

The problem with the check for both env vars is
- In prod environment applications does not have access to them
- In dev, when developers launch flipper from terminal (`yarn run flipper-server`) it picks up these env vars if they are set which can cause different behaviour in dev and prod

To make flipper work more deterministic, for users and us. I removed this check and now we always write to these env vars what the user has provided in flipper settings or the default.

Reviewed By: lblasa

Differential Revision: D51266495

fbshipit-source-id: cf3adfd4ba83a733a30b5b0b29c270b32ff3a61a
2023-11-14 02:54:59 -08:00
Andrey Goncharov
a400eb2872 Finalize log stream before exiting process
Reviewed By: antonk52

Differential Revision: D51229230

fbshipit-source-id: 0e7f657a170eb8602ade9abf1db1976c5b51dc3f
2023-11-11 08:21:12 -08:00
Anton Kastritskiy
e5f6ad0ca6 default adb path
Summary:
As I was setting up a new mac I had to change this setting in flipper settings.

From a few android people that I've spoken to no one could answer me if the old one is still used.

Ideally we should infer this during the first time flipper starts

- `/opt/android_sdk` current default
- `$HOME/Library/Android/sdk` adb from Android Studio
- `$HOME/fbsource/third-party/toolchains/android-sdk` adb that is always available in fbsource

Reviewed By: lblasa

Differential Revision: D51120929

fbshipit-source-id: edb2a58b9c9f37465ea2fc5493975dd427d5523b
2023-11-10 08:03:34 -08:00
Anton Kastritskiy
d023bcc42e remove shortcuts
Reviewed By: aigoncharov

Differential Revision: D51159922

fbshipit-source-id: fbb59b416f92b9156c74a12247da8d0df07f1a4e
2023-11-10 04:33:02 -08:00
Andrey Goncharov
8348d617d0 Fix token replacements
Reviewed By: lblasa

Differential Revision: D51196650

fbshipit-source-id: 184c104b32a1d619163c799ae70419e6aad23e98
2023-11-10 03:35:14 -08:00
Andrey Goncharov
6e19c4155c Track session length
Differential Revision: D51172955

fbshipit-source-id: d4f93564a94e232066347c945fa4798033dc0da1
2023-11-09 14:34:52 -08:00
Andrey Goncharov
8ef29c8160 Embed auth token into HTML
Summary:
Auth token used be injected in the manifest file. Instead, have the server injected into the main HTML page.

The main driver to this change are:
- Simplify
- There are instances in which for some reason reading/writing the token from the manifest fails. This will address that problem.

Reviewed By: lblasa

Differential Revision: D51160521

fbshipit-source-id: 4626fd8f56bc8b61182a53a5d9cf5acad1e723bc
2023-11-09 14:05:43 -08:00
Lorenzo Blasa
69378c4b09 Add logs for early exit when writing token to manifest
Summary: ^

Reviewed By: aigoncharov

Differential Revision: D51154908

fbshipit-source-id: 0c04ee50d07db1478ec5a77faa6d6157b7c9960b
2023-11-09 09:08:33 -08:00
Andrey Goncharov
d54bd7c3ba Refactor browser connection performance tracking
Reviewed By: lblasa

Differential Revision: D51158256

fbshipit-source-id: 17e020dd3c26ac73bf2cf0ceb4c664638c6778e9
2023-11-09 08:25:28 -08:00
Andrey Goncharov
51e149765e Add more logging
Reviewed By: antonk52

Differential Revision: D51154065

fbshipit-source-id: 7532d1e141562adacb9170b112185bd6f730cc5a
2023-11-09 03:57:59 -08:00
Lorenzo Blasa
3993e7461d Shutdown after 5 hours
Summary:
If after 5 hours there are no connected clients, shutdown the server.

This is to prevent cases whereas the long-lived instance makes users use stale versions of Flipper if Flipper stays indefinitely running in the background.

Reviewed By: passy

Differential Revision: D51111926

fbshipit-source-id: 4c38e392cf8a6a4fb840bffdea92c0b0314aefb9
2023-11-08 10:39:18 -08:00
Lorenzo Blasa
640fb86edc Do not shutdown when there's no connected clients
Summary:
^

Also, track client closes with their code and/or error.

Reviewed By: antonk52

Differential Revision: D51110574

fbshipit-source-id: 2416e36256b000664b7677fcf2c03b045d318ed2
2023-11-08 10:39:18 -08:00
Lorenzo Blasa
9b9eb00b63 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
2023-11-08 09:20:13 -08:00
Lorenzo Blasa
137e75ad46 Refactor Open
Summary: Extract our launch UI logic into flipper-server-core.

Reviewed By: passy

Differential Revision: D51115241

fbshipit-source-id: 185e381eab6b480d86a5e1201f45c070104d0cea
2023-11-08 09:20:13 -08:00
Lorenzo Blasa
afae1bd141 Track unable to become ready within timeout
Summary: This is currently done by querying the 'console-log' event. Instead, make it type safe and official.

Reviewed By: antonk52

Differential Revision: D50927954

fbshipit-source-id: ff767acdc51b942c6deb92ffbfd93288b3367062
2023-11-02 10:42:15 -07:00
Lorenzo Blasa
d5a0c206f2 Track WS server error
Summary: This is currently done by querying the 'console-log' event. Instead, make it type safe and official.

Reviewed By: antonk52

Differential Revision: D50927803

fbshipit-source-id: e0488782dd584e36b6f742f9892fc09ffaf62469
2023-11-02 10:42:15 -07:00
Lorenzo Blasa
8f1b4ffa1c Track UI launches
Summary: This is currently done by querying the 'console-log' event. Instead, make it type safe and official.

Reviewed By: antonk52

Differential Revision: D50927713

fbshipit-source-id: 780c0f158bf8bdaa6d009035a0cee62c7828f479
2023-11-02 10:42:15 -07:00
Lorenzo Blasa
57d4e86545 Additional troubleshoot guidance for idb
Summary:
Reference:
https://fb.workplace.com/groups/flippersupport/permalink/1717333982080586/

The steps added below seem to have fixed the issue.

Still need to investigate why these steps are needed.

Reviewed By: aigoncharov

Differential Revision: D50797561

fbshipit-source-id: a31c71dbedc506344438082846b41ff16b6f459a
2023-10-31 05:16:21 -07:00
Pascal Hartig
ecfa9451db Remove unused which dependency
Summary: This seems to be (no longer) in use.

Reviewed By: lblasa

Differential Revision: D50645270

fbshipit-source-id: 69cf276f97d960a16ffd3e48342420b33fa646da
2023-10-26 03:05:02 -07:00
Andrey Goncharov
8c5078dc08 Catch sync errors while starting HTTP server
Reviewed By: lblasa

Differential Revision: D50636260

fbshipit-source-id: f23fb2005c779b87122ae34bfdd9371d8bdec8b4
2023-10-25 04:52:00 -07:00
Andrey Goncharov
97f01d0057 Check certs are good for TLS
Reviewed By: lblasa

Differential Revision: D50496418

fbshipit-source-id: fb4ee3a91b50d0e02f8b1d0e4618a510cf0c3a54
2023-10-25 04:52:00 -07:00
Lorenzo Blasa
94120d61aa RN-only build flag
Summary: Previously I had created a RN build, locally, with a few minor differences. That had to be reverted. Instead of reverting and re-applying changes, I'm introducing a flag that can be used in the interim to produce the RN-only builds.

Reviewed By: LukeDefeo

Differential Revision: D50555055

fbshipit-source-id: edface9a1587fb51e54eebe73724032baf985c83
2023-10-24 04:18:51 -07:00
Anton Kastritskiy
663380e721 mark unused vars as errors
Reviewed By: lblasa

Differential Revision: D50500690

fbshipit-source-id: 6f739fe25c232ecfe842337af4399681e85f6a13
2023-10-20 12:44:58 -07:00
Andrey Goncharov
aea77cc4da Hide PWA app from Spotlight
Reviewed By: LukeDefeo

Differential Revision: D50411182

fbshipit-source-id: 46c089c69aefb58f85a861c7898ee355f094e03c
2023-10-20 05:13:20 -07:00
Lorenzo Blasa
450e6f2d7c Fixes an issue whereas server configuration is not yet set
Summary: ^

Reviewed By: aigoncharov

Differential Revision: D50470060

fbshipit-source-id: cc59ac7cace092addbf48dfa16219983bd129cb0
2023-10-19 13:57:36 -07:00
Lorenzo Blasa
f6de499171 Export to manifest on get
Summary:
Every time the token is returned, export it to the manifest.

This covers the case in which the token found in the manifest has already expired.

Reviewed By: antonk52

Differential Revision: D50419458

fbshipit-source-id: 8eefa0e97e234985b34f824190b208bf74e2d8ec
2023-10-18 12:28:06 -07:00
Lorenzo Blasa
8b24560bc0 Verify token before return
Summary: If the token has already expired, generate another one.

Reviewed By: aigoncharov

Differential Revision: D50410431

fbshipit-source-id: 108a3b344a1bcafd93a8d9bc94cba5c133d099d7
2023-10-18 08:53:46 -07:00
Anton Kastritskiy
683fbfd6fb doctor result can display copiable CLI commands
Reviewed By: lblasa, ivanmisuno

Differential Revision: D50383150

fbshipit-source-id: 201f239cc7d69bd03011ec817156163f9f6ed653
2023-10-18 05:55:23 -07:00
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
Andrey Goncharov
ee7736caee Add a more complex logger to Flipper UI Browser
Reviewed By: passy, lblasa

Differential Revision: D50223987

fbshipit-source-id: 108e1753b555c7d7b32d3fc2408c2f8efcbadb4d
2023-10-16 09:27:50 -07:00
Lorenzo Blasa
6468665116 Improve device listing
Summary: Do not use mutex for device listing.

Reviewed By: antonk52

Differential Revision: D50265112

fbshipit-source-id: 9b3bf4f9351e28dfb6366b6b787ec8b466b9bc47
2023-10-13 07:50:25 -07:00
Andrey Goncharov
0e664d274a Track browser connections
Reviewed By: lblasa

Differential Revision: D50225630

fbshipit-source-id: 31842fcde494ec05edf2458396d466239397d2c8
2023-10-12 15:16:11 -07:00
Anton Kastritskiy
2edcb29e46 Back out "ESM plugin bundles"
Summary:
Original commit changeset: 2a60315dd5c0

Original Phabricator Diff: D50015827

Reviewed By: lblasa

Differential Revision: D50168201

fbshipit-source-id: 3430c37b0aa6a5e3a5ec35fb4c54f01899236173
2023-10-11 04:21:54 -07:00
Anton Kastritskiy
c4a1c90a1e ESM plugin bundles
Summary:
This change will allow us to display correct stack traces in flipper UI as well as send them to scuba.

Currently correct stack traces are only displayed in the console and we do not have access to them.

Reviewed By: ivanmisuno

Differential Revision: D50015827

fbshipit-source-id: 2a60315dd5c06b2635ce0414f612ff1fdca0e489
2023-10-10 03:37:21 -07:00
Lorenzo Blasa
b11a85c4b3 Server error and endpoint metrics
Summary: Better than using logs.

Reviewed By: antonk52

Differential Revision: D50012506

fbshipit-source-id: 2f0e9bf8cb7282d35dc5619e620d005b96663fd5
2023-10-06 08:26:09 -07:00
Lorenzo Blasa
66dac8112b Aggregated startup ms
Summary: ^

Reviewed By: antonk52

Differential Revision: D50012359

fbshipit-source-id: f71f57e1493e6f9f662e9af24a0f8d0ae1229b1b
2023-10-06 08:26:09 -07:00
Lorenzo Blasa
e8aad89b0b Set unresponsive timeout
Summary: Set a timeout period to become ready. It is better to kill the server if not ready, than keeping it alive.

Reviewed By: antonk52

Differential Revision: D50004605

fbshipit-source-id: be1d2c022c634ece059fc03eb6faea695431ba95
2023-10-06 03:26:14 -07:00
Lorenzo Blasa
c05fe8cb53 Track unable to listen cases
Summary: Track whenever the server is unable to bind to the specified port.

Reviewed By: antonk52

Differential Revision: D49951304

fbshipit-source-id: 971d7c324f27c287036707d21bb51d26acbd6615
2023-10-05 05:48:34 -07:00
Lorenzo Blasa
9fa5671ab0 Remove unused metric
Summary: ^

Reviewed By: antonk52

Differential Revision: D49951285

fbshipit-source-id: 7f3c4e5458dea6875c67b6acbcf2d53b40ea9afa
2023-10-05 05:48:34 -07:00
Lorenzo Blasa
0e90873096 Do not block for device manager to become ready
Summary:
^

Also, if an error happens, do not swallow it, rethrow.

Reviewed By: passy

Differential Revision: D49912780

fbshipit-source-id: 30451110d8c5776e2b0826d6e924ab5fe98cd7e2
2023-10-05 04:37:16 -07:00
Lorenzo Blasa
53eb06a781 Exit if unable to listen at port
Summary: If we are unable to bind to the specified port, exit process.

Reviewed By: passy

Differential Revision: D49908107

fbshipit-source-id: 6d76f3d661ec61867be5307c756e372a7b20a9f6
2023-10-04 05:37:12 -07:00
Pascal Hartig
4905446697 Update deps
Summary: Update a few selected patch-level deps.

Reviewed By: antonk52

Differential Revision: D49779877

fbshipit-source-id: 5f8da30a3802f4ca516ad20ac223cafce5120ba0
2023-10-03 10:58:10 -07:00
Lorenzo Blasa
4d9fb9170d Log endpoint consumption
Summary: ^

Reviewed By: antonk52

Differential Revision: D49830704

fbshipit-source-id: ebec670f85d69abfdc3ff291ba587925f92fcdcf
2023-10-02 10:46:53 -07:00
Lorenzo Blasa
3c73074e29 Log client disconnect code
Summary: Useful to troubleshoot client disconnections

Reviewed By: antonk52

Differential Revision: D49828632

fbshipit-source-id: 55c7d9e212637cac73bf64e6f3e7516778036015
2023-10-02 08:52:40 -07:00
Lorenzo Blasa
1f2a7f9391 Log HTTP server errors
Summary: Currently, we are not interested in these errors. Let's add some logging as a way of knowing if they take place and why.

Reviewed By: antonk52

Differential Revision: D49828378

fbshipit-source-id: f741a45e1ba9892aa54dca85f97bcc419e0b5e25
2023-10-02 08:52:40 -07:00