Commit Graph

374 Commits

Author SHA1 Message Date
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
Lorenzo Blasa
1c4224d716 Running/shutdown utilities
Summary: Create utilities to check for existing running instances and shutdown.

Reviewed By: ivanmisuno

Differential Revision: D49593321

fbshipit-source-id: 10acdb4f340f2f24f9ebd3203153906b34623178
2023-09-25 08:46:43 -07:00
Lorenzo Blasa
c1b0d9d753 Export node as JSON
Summary:
There has been multiple requests to incorporate an export to plain text functionality for a while.

This diff adds it.

It will export a node and optionally its chidren as JSON.

Reviewed By: antonk52

Differential Revision: D49596476

fbshipit-source-id: 3681bc0c2d02e1ea64ff589e0e272f6d54ad0524
2023-09-25 08:44:37 -07:00
Lorenzo Blasa
ddf348faa5 Immediately close server if no clients are connected
Summary: ^

Reviewed By: ivanmisuno

Differential Revision: D49539483

fbshipit-source-id: ffbcffe0f0b0f31bc26ba5881b30ae27960c283e
2023-09-22 10:31:15 -07:00
Lorenzo Blasa
1d29e06b76 Use better API to return JSON from endpoint
Summary: ^

Reviewed By: antonk52

Differential Revision: D49537411

fbshipit-source-id: d5cabcf1c22d57fc47e1e80cbf0edb70effee308
2023-09-22 08:17:48 -07:00
Lorenzo Blasa
bdf5065f10 Expose info endpoint
Summary:
Expose an endpoint to retrieve server environment information.

We can use version information and process number to aid engineers with troubleshooting Flipper.

Reviewed By: antonk52

Differential Revision: D49537325

fbshipit-source-id: 511fe4441638f91cd35f13706ceeeb515051416b
2023-09-22 08:17:48 -07:00
Pascal Hartig
fcd21111a0 Do not prefer ipv4 dns results
Summary: This is the default from Node 17 onwards and should unblock problems we're seeing on some people's machines.

Reviewed By: lblasa

Differential Revision: D49415859

fbshipit-source-id: c15ab82e69db4916838228324a9739c95f3562f3
2023-09-22 06:25:35 -07:00
Lorenzo Blasa
b856180530 Use HTTP shutdown instead
Summary: Use the newly exposed HTTP shutdown API. It is simpler.

Reviewed By: antonk52

Differential Revision: D49499264

fbshipit-source-id: 2d81db1d1a66c0b7550ee1245e51d8f1a8671aa6
2023-09-21 06:59:22 -07:00
Lorenzo Blasa
6df27824b7 Expose HTTP shutdown API
Summary: Expose the shutdown API via the HTTP server.

Reviewed By: ivanmisuno

Differential Revision: D49496840

fbshipit-source-id: df2045edc89e9feabe74b4b513f973d137323d0f
2023-09-21 06:09:19 -07:00
Lorenzo Blasa
0540d240c0 Remove usage of server enabled
Summary: Used last year to GK server usage. This is obsolete so is safe to remove.

Reviewed By: ivanmisuno

Differential Revision: D49414625

fbshipit-source-id: 9eeff932c59c90dff829e4c6c83bad43a0fd74e3
2023-09-20 04:10:39 -07:00
Lorenzo Blasa
9e219b07d8 Fix Loading page
Summary:
The existing loading page was not behaving the way it was intended. The previous implementation triggered a page reload which made the whole retry mechanism useless.

Instead, a new endpoint was defined to expose whether the server is ready or not. Use this instead as a way of knowing whether we are good to reload the page.

Reviewed By: passy

Differential Revision: D49314749

fbshipit-source-id: eb67765d7deab8610fa5d31e710070da43a18c1c
2023-09-15 05:29:40 -07:00
Lorenzo Blasa
045ccec154 Host name verification is not needed
Summary:
There's no need to perform host name verification as we use token-based authentication.

So, remove it.

Original security review: https://docs.google.com/document/d/16iXypCQibPiner061SoaQUFUY9tLVAEpkKfV_hUXI7c/edit#heading=h.kpbj4pk75925

Reviewed By: passy

Differential Revision: D49313595

fbshipit-source-id: 9da1eefa87e5b774d653ab2c5db6f95c51af482d
2023-09-15 05:29:40 -07:00
Lorenzo Blasa
8062e2c9e5 Generate auth token
Summary: Generate auth token on whenever we load the secure server config,  and add more logs.

Reviewed By: antonk52

Differential Revision: D49272857

fbshipit-source-id: 1e549a8bfd7926e9a44b9480432e92ee3c0162b2
2023-09-14 07:04:59 -07:00
Lorenzo Blasa
2b4c631652 Certificate and token generation fixes
Summary:
A few things need to be done which are on this change:

- Certificate generation should execute as an atomic operation, hence, it needs to be synchronised.
- Do not generate client token as part of certificate generation. This causes a deadlock now.
- Add more logs for troubleshooting

Reviewed By: aigoncharov

Differential Revision: D49269624

fbshipit-source-id: 071a8e5b895198730b7d914cc4622837e9094e2f
2023-09-14 04:15:18 -07:00
Lorenzo Blasa
cf599f9c3c Move launch further down, temporarily
Summary: Attempt to fix an ongoing issue whereas there's a race condition generating certificates

Reviewed By: passy

Differential Revision: D49237915

fbshipit-source-id: 2383b20cb6ba786166d5e70206b5fff846ed1211
2023-09-13 11:52:46 -07:00
Lorenzo Blasa
4cdbfff7fb Remove useless tag
Summary: ^

Reviewed By: antonk52

Differential Revision: D49193961

fbshipit-source-id: a51bd8b274a7f6f3bf3cdd7d3ff665430bf7bc3a
2023-09-13 04:06:58 -07:00
Lorenzo Blasa
3292945887 Launch should be blocking and at a later stage
Summary: This should be a blocking call and done later as it depends on the FlipperServerConfig to be set.

Reviewed By: antonk52

Differential Revision: D49193650

fbshipit-source-id: 4f74ca5de30b7f992880bbb9032792fd713203b7
2023-09-13 04:06:58 -07:00
Lorenzo Blasa
93d94c9fc3 More logs around certificates and token generation
Summary: Useful for triaging defects

Reviewed By: passy

Differential Revision: D49186779

fbshipit-source-id: 743746444ce6e28753434a63d1bee2989cf4f66a
2023-09-13 04:06:58 -07:00
Pascal Hartig
cd392929e0 FLIPPER_DISABLE_KEYTAR env var to use in-memory impl
Summary: Changelog: FLIPPER_DISABLE_KEYTAR env var can be used to force in-memory implementation

Reviewed By: lblasa

Differential Revision: D49183501

fbshipit-source-id: 4ce886303678485673750417b09f272dd3f66623
2023-09-12 04:21:41 -07:00
Pascal Hartig
777632b841 Add logging and fallback for failing vpnless requests
Summary:
If a requests fails due to lack of allow-listing or other incompatibilities, we will now fall back to VPN mode while logging an error that will hopefully end up at the plugin owner.

For this, there's a new `vpnMode` option on every request that can also be used to enforce a particular type.

There's a lot of verbose logging that's turned off by default but very handy when debugging. Also potentially useful for plugin authors that are looking into request issues.

Reviewed By: lblasa

Differential Revision: D49023365

fbshipit-source-id: 755393063e379587feda9ae13973877780a1d987
2023-09-11 03:28:06 -07:00
Anton Kastritskiy
4439411d29 bump or ignore types packages
Reviewed By: LukeDefeo

Differential Revision: D48782825

fbshipit-source-id: 00c46fa609847272b48f8f4476291666e9251c95
2023-09-04 14:52:34 -07:00
Anton Kastritskiy
806d684ddc Script to verify @types/* versions
Summary:
We recently raised a concern that for some packages types/* version is different than the package we are using. This can cause runtime errors as typescript can suggest usage that no longer reflects current API of a library. To combat this issue we decided to add a CI check to verify that major versions of types and a libriary match.

This script will be refined if in the next few diffs

Reviewed By: LukeDefeo

Differential Revision: D48779652

fbshipit-source-id: 2a826ba9d00565563553f04cd809ae0638db6282
2023-09-01 09:54:49 -07:00
Lorenzo Blasa
819c75c126 Verify server certificates before returning existing token
Summary:
If the server certificates have expired, then the returned token will no longer be valid as soon as the certificates are renewed.

So, validate this before returning any existing token.

This was not an issue before, as launching used to be the last step during bootstrapping.

Reviewed By: antonk52

Differential Revision: D48902334

fbshipit-source-id: 2458aa0df806db245994ee742f42bff47a533e23
2023-09-01 04:52:09 -07:00
Lorenzo Blasa
4e7a6a70cc Server shutdown only if no errors
Summary:
The socket will close as the endpoint is terminating the connection.

Status code 1000 and 1001 are used for normal closures. Either the connection is no longer needed or the endpoint is going away i.e. browser navigating away from the current page.

WS RFC: https://www.rfc-editor.org/rfc/rfc6455

Reviewed By: LukeDefeo

Differential Revision: D48896696

fbshipit-source-id: 22070ae34b7f35d35589db06108feb718e73e866
2023-09-01 03:25:26 -07:00
Lorenzo Blasa
457767c7cc Ready needs to be able to handle asynchronous code
Summary:
A previous diff introduced the isReady state as to make it possible to serve HTML content sooner than we are ready.

This worked great on debugging. As I was testing a release, it was discovered that there was a race condition and the server was not ready when it was already handling upgrade events.

To solve this, I've added another state flag in the form of a promise.

This one, can be waited on. This is used then during upgrade events as we can safely wait until the server is ready to accept incoming connections before proceeding with the upgrade.

Problem is shown below:

{F1080003241}
{F1080003356}

Reviewed By: passy

Differential Revision: D48829453

fbshipit-source-id: e148a392bbe66dd91710e32871e270c8950e25c2
2023-08-30 09:52:00 -07:00
Lorenzo Blasa
2858259497 Launch early, even if not ready
Summary:
Flipper Launcher downloads, unpacks, launches Flipper, and closes itself.

This is fine except for the fact that Flipper may be initiating and thus there's a gap of a few seconds until engineers see the main Flipper UI.

This change improves this by launching earlier, even if just showing a loading page until Flipper is actually ready.

Reviewed By: passy, aigoncharov

Differential Revision: D48824479

fbshipit-source-id: aa6147a09f313d80592c9b08d089660ba73773a4
2023-08-30 05:08:26 -07:00
Lorenzo Blasa
3e8f94ceda iOS get devices/targets/simulators cleanup
Summary: ^

Reviewed By: passy

Differential Revision: D48781211

fbshipit-source-id: 71133c07d15ca6a380d85e582d55cbdb192b5a19
2023-08-30 04:24:05 -07:00