Summary: This is a duplicate, is not needed, causes confusion.
Reviewed By: aigoncharov
Differential Revision: D51307091
fbshipit-source-id: 4d55d727ea5f20100ecd15ad6e23aa0c01722524
Summary: The token will be generated if one doesn't exist, so always call get token.
Reviewed By: antonk52
Differential Revision: D50494884
fbshipit-source-id: b93ba8ab5ba0c8b48766af3b06e8de94944d08e7
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
Summary: Use the newly exposed HTTP shutdown API. It is simpler.
Reviewed By: antonk52
Differential Revision: D49499264
fbshipit-source-id: 2d81db1d1a66c0b7550ee1245e51d8f1a8671aa6
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
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
Summary:
The sessionId is just uuid() which is held by the config. This changes moves that to a single place.
This achieves two goals:
1) Makes it very clear where is created and what value it holds
2) It allows us to know the sessionId even before the config is available. This becomes useful as we can start logging to Scribe earlier.
Reviewed By: passy
Differential Revision: D48601829
fbshipit-source-id: c54d86d76f0b58d2b59f8dd1c45d7f345c4a84c3
Summary:
Session Id should be shared between client and server, but it was defined deep in the client (redux store).
The proposed solution presented below is to move the session id to the server configuration. By doing this, it becomes available to both server and client VERY early in the application life-cycle for both Electron and non-Electron builds.
Reviewed By: LukeDefeo
Differential Revision: D48520367
fbshipit-source-id: ca959b27ab18b1a2e4cd2fac1d28545664f1b514
Summary: This change removes the UDS support and thus the need for having a proxy server.
Reviewed By: antonk52
Differential Revision: D48265244
fbshipit-source-id: c76bb4afba63959ddd17901b3887aa278b000beb
Summary: As TCP is the only option, remove all branches.
Reviewed By: passy
Differential Revision: D48265093
fbshipit-source-id: 174527f05d8a841797fd95256e77fdeb9b2e6ad5
Summary: For Windows, we cannot use UDS, so use TCP instead.
Reviewed By: antonk52
Differential Revision: D47436314
fbshipit-source-id: ee2454f9f77b3642f4988957eefc250a64bf02b6
Summary:
`setProcessState` does some adjusting to PATH. This was only ever done for Electron.
This change moves that functionality to FlipperServerImpl which is the one what orchestrates. By doing this, flipper server also benefits from getting these adjustments.
Reviewed By: antonk52
Differential Revision: D46836659
fbshipit-source-id: f98291d320cf9b7f3808223af8745c068b1318ce
Summary:
All clients need to provide an authentication token before connecting. Electron app is no different.
This change adds the authentication token whether we are connecting over UDS or TCP.
Before this change, if Flipper server was already running, launching the Electron app would look similar to this:
{F1016961594}
Reviewed By: antonk52
Differential Revision: D46418758
fbshipit-source-id: f00ffe675df78403d5921250e3e9ed9331a55bde
Summary:
The existing error message was not in the centre and didn't give any possible remediation steps.
{F1015240268}
Reviewed By: passy
Differential Revision: D46394149
fbshipit-source-id: 09d450bef9df83c5b3af3ba49c7e0fafb81bfdce
Summary:
Clean initialisation by passing down the environment info to start server.
(Also rename dir to path as that's the name used in other places)
Reviewed By: passy
Differential Revision: D45731751
fbshipit-source-id: a60fdd49c567fc312d1f8da72db3a46a0828c140
Summary: The isHeadlessBuild flag was not properly set.
Reviewed By: antonk52
Differential Revision: D45728435
fbshipit-source-id: 3616c4358114d4f3d96372766dabf48b27b44333
Summary:
FlipperServerClient is a useful abstraction for any JS-based client of headless Flipper. No need to bundle it with flipper-frontend-core, as the rest is not useful for external clients.
Currently, I am planning to add it to jest-e2e to send commands to Flipper
Reviewed By: lblasa
Differential Revision: D40765668
fbshipit-source-id: af48710bb15444ac1ecd649fe9a2ab252f3088f3
Summary: When Flipper starts with Flipper Server enabled, on Windows we forgot to attach the WebSocket handler. It led to a white screen on Electron or to connection timeout messages on Flipper Server.
Reviewed By: passy, lblasa
Differential Revision: D40679781
fbshipit-source-id: 1c8df8012efc54077409eb8891b1d82ddaf16689
Summary:
In D39311893 (094c5bdfdd) we started monkey-patching `require` to resolve global dependencies in the plugins. Apparently, patching `globalThis.require` did not work in the electron env. On my local machine it kept working because I had the experimental `flipper-server` feature enabled which embeds flipper-server into the electron build. In flipper-server we properly patch `require` via `Module.prototype.require` which affected the global require in electron.
With this fix we now properly patch require in electron via Module.prototype.require all the time
Changelog: Fix plugin loading with experimental flipper-server disabled
Reviewed By: nikoant
Differential Revision: D39633821
fbshipit-source-id: 9554f643c625620d116075ae87f573d8447850f6
Summary: At launch, if flipper-server is running, send the shutdown message.
Reviewed By: passy
Differential Revision: D38861178
fbshipit-source-id: 4aab5f2b50938cb70a2dfae0d9056df337baecc3
Summary: We no longer need to Tail the logs as we stream the logs over WebSockets (see D37459924 (dcbc7c40bb))
Reviewed By: lblasa
Differential Revision: D37550482
fbshipit-source-id: 92a87f2ba1ecec140bbbb9e71df107341765ad46
Summary:
Provide an option to enable/disable TCP connections on flipper-server.
The only change at this stage is that Flipper Desktop will use UDS to connect to flipper-server.
Reviewed By: passy
Differential Revision: D37519656
fbshipit-source-id: 3d02084666fde532ec76134edf8cf6a231060a48
Summary:
There are some cases in which we may want to shutdown flipper-server:
- If launching Flipper Desktop and not in GK
- If launching Flipper Desktop and flipper-server usage is disabled via settings
Reviewed By: passy
Differential Revision: D37377059
fbshipit-source-id: 86c11f2726abe47df4aeaca2fd2a9285b112a565
Summary:
There's one setting: to enable or disable flipper-server.
However, I've added some current running state to it. If there's a better way of doing this, please do let me know.
Reviewed By: aigoncharov
Differential Revision: D37276670
fbshipit-source-id: f6c941cf0cfe55c267b9bcb9f799934fba1e28ef
Summary:
This change attaches our event handlers as soon as the ws is created.
As a consequence, we need to wait until the server has created any necessary instances required to process incoming requests.
To achieve this, I created a type called `Lazy`.
This type wraps around a value and a promise to that value. Callers can check if the value is set. If not, callers can wait for it.
Ultimately, the value can be set outside of the promise itself.
Reviewed By: passy
Differential Revision: D37284939
fbshipit-source-id: 17dec548d7155a3d65440c9584cec07cbb826c37
Summary:
Provided that GK passes:
- If a flipper-server instance is running, use and connect.
- If not, start flipper-server and connect.
Reviewed By: passy
Differential Revision: D37034960
fbshipit-source-id: ff79e56e80e74415373f84b78305b4fc3e31f7d0
Summary:
This change aggregates/redirects flipper-server logs with logs generated by the app.
This is a great approach, why:
As we tail the file, we deserialise the logs, and re-log them using console. This means, that they will be intercepted by the logging infrastructure flipper already has in place which will make these logs go to scribe, error reporting, etc.
Reviewed By: passy
Differential Revision: D36473790
fbshipit-source-id: a3547c5c8733217c61bb2d9b94990626bbf0a492
Summary:
CHANGELOG: Upgrade electron to 18.2.0.
In Electron 18.2.0 we no longer have access to `remote`. Instead, we are recommended to implement IPC communications. We re-implement `remote` methods used before as IPC commands. To support type-safe execution of the commands, we create electron IPC clients on both sides: the main process and renderer process. We also move the main menu creation to the main process and track its usage via sending IPC messages to the renderer process where the logging happens.
Reviewed By: mweststrate
Differential Revision: D36593625
fbshipit-source-id: 6dcf531461ef2edceb9cac372a650f84f3370953
Summary: Allows to attribute errors to flipper server or flipper electron
Reviewed By: passy
Differential Revision: D36698504
fbshipit-source-id: 6d07216fd05aa48b7c8cca5b53145916b64526eb
Summary:
^
This is a very small refactoring and addition to the Flipper Desktop app.
The instantiation of FlipperServer was extracted to a separate function.
This a very tiny change that allows to switch the implementation we use for FlipperServer in a more convenient way.
In this same change, an unused function is added which will create a separate FlipperServer instance that uses a web-socket underneath which makes it possible to use with flipper-server.
So, if interested, it is enough to call that function instead of the one currently in use and it will make Flipper connect to flipper-server instead.
https://pxl.cl/24j8R
Reviewed By: passy
Differential Revision: D36440574
fbshipit-source-id: 94ea2ab7208b898a82ac5e7fd7edd9cb824b4810
Summary:
Currently, Flipper Server has a few productions dependencies (mac-ca, node-fetch) that are not bundled with the Flipper Server. It makes it harder to distribute Flipper Server, as now all potential consumers need not only to download the bundle, but also install these additional dependencies.
This diff makes it possible to bundle `mac-ca` and `node-fetch` with Flipper Server. As a result, Flipper Server becomes dependency-free in production.
Reviewed By: lblasa
Differential Revision: D36345213
fbshipit-source-id: 2cd6ba1b3301b45dc2295891964ba020fd107586
Summary:
There appears to be an issue with login on M1 Macs right now. To address this, this resolves the native binary based on a `(platform, arch)` tuple.
The binaries are from here: https://github.com/atom/node-keytar/releases/tag/v7.9.0
The binary size increase here is notable so as a follow-up we could remove the non-relevant binaries as part of the packing process.
Reviewed By: aigoncharov
Differential Revision: D34685236
fbshipit-source-id: d860a59517a769a59055dfca24d01baecd8d1430
Summary:
This diff makes sure that errors are propagated similarly in flipper desktop and browser version, and that they are shown in either case.
Since in the browser version, the UI loads after the error happened, we'll store the error so that any client connecting in the future will read and report it.
Also added a `--failFast` flag to flipper-server, so that the process exits immediately if misconfigured, which is convenient in CI use cases and such
Reviewed By: nikoant
Differential Revision: D33348922
fbshipit-source-id: 0f584104f881141fde38da3f0031748415343ea2
Summary:
If openssl is not available, this would lead to an unhandled rejection exception. That is because a lot initialization logic generates promises that don't get a catch chained on immediately. Changed the flipper server startup flow to be more idiomatically async
Fixes https://github.com/facebook/flipper/issues/2766
Changelog: More clearly communicate if flipper server failed to start (e.d. due to port already taken, openssl not being available)
This change fixes it only for desktop flipper, will make sure the browser UI will support this as well (the error will fire correctly there, but there are no listeners during startup)
Reviewed By: nikoant
Differential Revision: D33348923
fbshipit-source-id: f561bb27b18a3041c514b37f7aed11435a49647f
Summary: This diff is some boyscouting on cleaning up our globals, and stop using them inconsistently icmw global or window
Reviewed By: aigoncharov
Differential Revision: D33171108
fbshipit-source-id: 400893e5f31523631a7ab6fda428524c751901f1
Summary:
This diff removes most deps from the root package.json, which now only contains electron and shared build / test infra structure: lint, prettier, jest, typescript.
This makes it possible to control much better which packages are used where, as all sub packages now have their deps explicitly in their package.json instead of incidentally shared. This allows for example to disable DOM types for all packages by default (flipper-plugin, ui(-core) and app still request it), and in the next diff I hope to add to this that nodeJS types are no longer shared either, so that UI oriented packages will generate compile errors when using Node built-ins
This diff removes most deps that were currently unused, and dedupes a bunch of other ones, so the build should probably be a bit smaller now as well:
{F686704253}
{F686704295}
Reviewed By: antonk52
Differential Revision: D33062859
fbshipit-source-id: 5afaa4f2103d055188382a3370c1fffa295a298a
Summary:
Changelog: Fixed issue where a missing ANDROID_SDK_ROOT env var made it impossible to launch emulators
Run into an issue where ANDROID_SDK_ROOT wasn't set for my user, causing Flipper not to be able to launch emulator, which was looked up from the path rather than using the flipper settings.
Fixes: https://github.com/facebook/flipper/issues/3119
Reviewed By: timur-valiev
Differential Revision: D33158280
fbshipit-source-id: ea5616b10265ed43f1012c58da081be275ff1d5b
Summary: This diff makes most stuff that is read from the `os` package, and version info etc available from the `serverConfig` object, so that flipper-ui-core no longer needs the `os` package.
Reviewed By: passy
Differential Revision: D32694848
fbshipit-source-id: 93af1e95d898da9aaf351a6970b5a7652ee835c8
Summary:
This diff sets up the socket connection between flipper-browser and flipper-server, and verifies that the initial UI initialisation work (e.g. `get-config` command works). The initial RenderHost is initialised as well based on the config and browser APIs.
Note that flipper-ui-core itself isn't started yet, as that has still a plethora of node imports, so Metro will correctly refuse to bundle
Not in this diff
* remove Node usage from flipper-ui-core
* implement all RenderHost APIs
Reviewed By: aigoncharov
Differential Revision: D32644074
fbshipit-source-id: 2c8065caf0191771a3867b69a431ca50eeb7a5a3
Summary: This diff moves keychain storage to the server. Figured to leave request logic itself in the UI-core, as basically all use cases happen there, except for streaming download for mobile build plugin, so sending the requests from the backend doesn't really seem to add value, unless we run into some CORS issues later.
Reviewed By: passy
Differential Revision: D32596715
fbshipit-source-id: f5ab9d794f91a6eb8a8dc07ae723bf2890726771
Summary:
This diff moves a lot of stuff from the client to the server. This diff is fairly large, as a lot of concept closely relate, although some things have split off to the earlier diffs in the stack, or are still to follow (like making intern requests).
This diff primarily moves reading and storing settings and GKs from client to server (both flipper and launcher settings). This means that settings are no longer persisted by Redux (which only exists on client). Most other changes are fallout from that. For now settings are just one big object, although we might need to separate settings that are only make sense in an Electron context. For example launcher settings.
Reviewed By: passy, aigoncharov
Differential Revision: D32498649
fbshipit-source-id: d842faf7a7f03774b621c7656e53a9127afc6192
Summary:
This diff moves all UI code from app/src to app/flipper-ui-core. That is now slightly too much (e.g. node deps are not removed yet), but from here it should be easier to move things out again, as I don't want this diff to be open for too long to avoid too much merge conflicts.
* But at least flipper-ui-core is Electron free :)
* Killed all cross module imports as well, as they where now even more in the way
* Some unit test needed some changes, most not too big (but emotion hashes got renumbered in the snapshots, feel free to ignore that)
* Found some files that were actually meaningless (tsconfig in plugins, WatchTools files, that start generating compile errors, removed those
Follow up work:
* make flipper-ui-core configurable, and wire up flipper-server-core in Electron instead of here
* remove node deps (aigoncharov)
* figure out correct place to load GKs, plugins, make intern requests etc., and move to the correct module
* clean up deps
Reviewed By: aigoncharov
Differential Revision: D32427722
fbshipit-source-id: 14fe92e1ceb15b9dcf7bece367c8ab92df927a70
Summary:
This diff removes most remaining Electron imports, by storing env and path constants on the RenderHost. As nice side effect those paths are all cached now as well.
To make sure RenderHost is initialised before Flipper itself, forced loading Flipper through a require. Otherwise the setup is super sensitive to circular import statements, since a lot of module initialisation code depends on those paths / env vars.
Reviewed By: nikoant
Differential Revision: D31992230
fbshipit-source-id: 91beb430902272aaf4b051b35cdf12d2fc993347
Summary: Removed the usage of electron's native context menus, and replaces it with Antd based context menu's.
Reviewed By: passy
Differential Revision: D31990756
fbshipit-source-id: 0312cbac5fd20a1a30603ce1058c03f4291b23b1