Commit Graph

383 Commits

Author SHA1 Message Date
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
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