Commit Graph

73 Commits

Author SHA1 Message Date
Andrey Goncharov
fec2650afb Remove redundant GK definition from flipper-common
Summary: Developers should use `getRenderHostInstance().GK(...)` instead

Reviewed By: lblasa

Differential Revision: D37034322

fbshipit-source-id: 41017f53a5256449252917a48fcd3a49a9b984c8
2022-06-09 03:34:04 -07:00
Andrey Goncharov
2b16916a85 Deprecate kaios-portal
Reviewed By: passy

Differential Revision: D36807506

fbshipit-source-id: 660f334a46dbf7847c90ce6e67f2dc974c1daf90
2022-06-07 04:00:02 -07:00
Andrey Goncharov
59761ecd50 Mark deprecated plugins in the UI
Summary:
Changelog: Add a deprecation warning for deprecated plugins.

Closes https://github.com/facebook/flipper/issues/2074

Reviewed By: lblasa, antonk52

Differential Revision: D36760209

fbshipit-source-id: 64cf799644f28aeedf88824c949738a6a766b094
2022-05-30 07:32:12 -07:00
Andrey Goncharov
4eca8d1088 Add isHeadlessBuild to EnvironmentInfo
Summary: Allows to attribute errors to flipper server or flipper electron

Reviewed By: passy

Differential Revision: D36698504

fbshipit-source-id: 6d07216fd05aa48b7c8cca5b53145916b64526eb
2022-05-27 02:37:53 -07:00
Lorenzo Blasa
6d2bc5cc9a Refactor some of the types used by FBLogger into Logger
Summary:
^

This change aims to extract some bits and pieces that are not specific to FBLogger and could be used by other Logger implementations.

Reviewed By: passy

Differential Revision: D36473286

fbshipit-source-id: 57f02d132673dbac97384da4dca51bf3e6fb8738
2022-05-24 10:23:42 -07:00
Andrey Goncharov
4f9ceb2e22 Implement subscribing to data updates for Flipper Server Companion
Summary: Allow subscribing to state updates from the plugin in headless mode

Reviewed By: passy

Differential Revision: D36516754

fbshipit-source-id: 14db51243e1d91332a7327c1792412149339f907
2022-05-23 03:38:23 -07:00
Andrey Goncharov
0f038218f8 Share uuid
Summary: Expose uuid from flipper-common as it is required in multiple packages

Reviewed By: lblasa

Differential Revision: D36441889

fbshipit-source-id: 1fa539cb437976dbefe7d5d9a52e5e098a6402a7
2022-05-18 03:13:31 -07:00
Andrey Goncharov
98dde53cda Add companion logging
Summary: Add top-level error logging to flipper-server. Use the top-level logging mechanism in flipper-companion.

Reviewed By: lblasa

Differential Revision: D36252218

fbshipit-source-id: 58d22b3b9bd51e597b5250478640f54d10277861
2022-05-10 05:13:24 -07:00
Andrey Goncharov
5a5c0ce426 Export typeUtils from flipper-common
Reviewed By: passy

Differential Revision: D36098166

fbshipit-source-id: 0f3da1d17da8ff6d08bc05abe73f9657df3bc3b8
2022-05-10 05:13:24 -07:00
Andrey Goncharov
3dd7583fdc Add device-find, client-find server commands
Reviewed By: passy

Differential Revision: D36098171

fbshipit-source-id: f0d0bbefcafc57a6413f9ffe8da271419c0d4deb
2022-05-10 05:13:24 -07:00
Andrey Goncharov
50111ef24b Add headless plugin definition
Summary: Support explicitly marking headless plugins as "headless"

Reviewed By: passy

Differential Revision: D35891387

fbshipit-source-id: 50b5acb3a7c52d7aedf32e271ebe6fc6d4fcef73
2022-05-10 05:13:24 -07:00
Andrey Goncharov
ba9a80545d Support globally installed React DevTools
Summary:
- Support loading globally installed DevTools

Background:
1. Initially, I wanted to use react-devtools-core as before. react-devtools-core standalone contains quite a few imports of node.js APIs. After [a conversation with Brian](https://fb.workplace.com/groups/react.devtools/permalink/3131548550392044), I pivoted to react-devtools-inline
2. Technical design doc of react-devtools-inline integration: https://docs.google.com/document/d/1STUSUhXzrW_KkvqSu7Ge-rxjVFF7oU3_NbwzimkO_Z4
3. We support usage of globally installed devtools. Code of react-devtools-inline is not ready to be used by the browser as is. We need to bundle it and substitute React and ReactDOM imports with the globals.
4. As we can't pre-compile what users install globally, we need to bundle global devtools on demand,
5. I tried re-using our Metro bundling pipeline initially, but gave up after fighting it for 2 days. Included, `rollup` instead.
6. Size of a `tgz` archive with a plugin is 2.1MB

allow-large-files

Reviewed By: mweststrate

Differential Revision: D34968770

fbshipit-source-id: 352299964ccc195b8677dbda47db84ffaf38737b
2022-03-31 04:01:33 -07:00
Andres Orozco Gonzalez
83133618d6 add adbkit configurations settings
Summary: Adbkit configurations settings may be neccesary when we want to run flipper-server in an IPv6 stack machine as localhost would bind to [::1] rather than 127.0.0.1 which is where the adb server usually runs

Reviewed By: mweststrate

Differential Revision: D34964851

fbshipit-source-id: 9cf70f9bdc0c40e92382b1537013439f85983f65
2022-03-23 04:24:23 -07:00
Pascal Hartig
9c5d1a32c5 Recover from malformed JSON
Summary: Following up on D34787674 (f85def32fb).

Reviewed By: aigoncharov

Differential Revision: D34930249

fbshipit-source-id: f209a638c1281957fd2b03b6fc50389bd98bc5f6
2022-03-16 16:39:23 -07:00
Lorenzo Blasa
76847bbef1 Do not emit errors when unable to extract client query
Summary:
^

Usually, when launching Chrome, this error will take place a significat amount of times. By looking at the HTTP request, it is difficult to determine the origin other than being a Chrome extension.

There's no actionable items in Flipper, so do not emit the error.

Changelog: Do not emit errors when unable to extract client query

Reviewed By: antonk52

Differential Revision: D34898603

fbshipit-source-id: fbeb2db7ec2914669192cbebc2e6b15464e31827
2022-03-16 02:26:42 -07:00
Andrey Goncharov
f85def32fb Migrate from socket.io
Reviewed By: passy

Differential Revision: D34787674

fbshipit-source-id: 63d7c166ea29d14c96f0646a045e3f6fa93472e2
2022-03-10 10:31:24 -08:00
Anton Nikolaev
37ff34390a Enable Marketplace for Flipper (#3491)
Summary:
This is PR on top of: https://github.com/facebook/flipper/pull/3473

It adds an option to Settings to allow distribution of marketplace plugins.

Also includes a simple fetch function to retrieve data from external API/server.

## Changelog

Allow marketplace plugins

Pull Request resolved: https://github.com/facebook/flipper/pull/3491

Test Plan:
1. Enable marketplace
2. Provide custom marketplace server (it will serve the list of internal plugins with downloadURL)
3. Test if can see Available plugins and can download/remove the plugin
4. If new update for the plugin, it should also allow auto update

Reviewed By: antonk52

Differential Revision: D34586339

Pulled By: nikoant

fbshipit-source-id: c887982aa0f0f9abd3b5360f22e8692a2445d345
2022-03-07 02:49:49 -08:00
Andrey Goncharov
6c74f2dd18 Set device features on device initialization
Summary:
1. Identify if device supports screenshots/screen recording when it is created.
2. Disable screen recording/screenshot buttons when they are not supported

Reviewed By: passy

Differential Revision: D34611133

fbshipit-source-id: 82ad2d67e4af482d9becf7995187667b5d99bc36
2022-03-04 02:00:23 -08:00
Andrey Goncharov
5068c8273b Add deprecation notice notification
Summary: Add deprecation notice device icon and notification

Reviewed By: lblasa

Differential Revision: D34582475

fbshipit-source-id: 90fde15caf1925b42f50fbfc77dece88c82833cf
2022-03-02 09:18:15 -08:00
Andrey Goncharov
01a5f3da90 Add generics to server add-on connection
Reviewed By: mweststrate

Differential Revision: D34307356

fbshipit-source-id: 27e61355a85995368ebb197c42d58f4145473567
2022-02-28 03:50:34 -08:00
Andrey Goncharov
8b94186783 Load installed server add-ons
Reviewed By: nikoant

Differential Revision: D34300475

fbshipit-source-id: 6bb6c0ab811e28806a0924b3487931bdb0dd2c59
2022-02-28 03:50:34 -08:00
Andrey Goncharov
b4b9c0ab28 Implement receiving messages from add-on on the client
Reviewed By: mweststrate

Differential Revision: D34249101

fbshipit-source-id: 07297b84ed8640e3b41599726ba613b6b4e2b62e
2022-02-28 03:50:34 -08:00
Andrey Goncharov
4067f5bd88 Implement sending messages from desktop to add-on
Reviewed By: antonk52

Differential Revision: D34239803

fbshipit-source-id: 1a18d522ba877ade3d0703fbb374c15b596241d7
2022-02-28 03:50:34 -08:00
Andrey Goncharov
5cdb7c952e Update build scripts to support bundling server add-ons
Summary: Summary

Reviewed By: nikoant

Differential Revision: D34170565

fbshipit-source-id: be9904809bf33e85536a4c6ead0e753ef05209ff
2022-02-28 03:50:34 -08:00
Andrey Goncharov
04eab80c98 Move server add-on interfaces to flipper-common
Reviewed By: antonk52

Differential Revision: D34169419

fbshipit-source-id: 69fcc8da7d98f59818fbb5b486a488f19830cd81
2022-02-28 03:50:34 -08:00
Andrey Goncharov
db976d5113 Implement sending messages from a server add-on
Reviewed By: mweststrate

Differential Revision: D34074383

fbshipit-source-id: de85e7a22dc9bb780163fc5b522708e8bc976df3
2022-02-28 03:50:34 -08:00
Andrey Goncharov
842b2c810a Implement sending messages to server add-on
Reviewed By: mweststrate

Differential Revision: D34073403

fbshipit-source-id: eacd73811b436f2b5c4255a83d8eb09367a96a67
2022-02-28 03:50:34 -08:00
Andrey Goncharov
12151e4a71 Extend Flipper commands to support server add-on messaging
Reviewed By: mweststrate

Differential Revision: D34046466

fbshipit-source-id: 9acc172c1805ec724b8709999bacf9e899c39e6b
2022-02-28 03:50:34 -08:00
Andrey Goncharov
3b390b74ff Track client connections and autostop server add-ons when all clients leave
Reviewed By: mweststrate

Differential Revision: D34045584

fbshipit-source-id: 1ad0cfffb9d304f0359c973d76d6956f7e932f72
2022-02-28 03:50:34 -08:00
Andrey Goncharov
9113006851 Make Client initialize server add-ons
Reviewed By: mweststrate

Differential Revision: D34044353

fbshipit-source-id: 99bcb1559787b2a904bdd796233666a7a4783ea4
2022-02-28 03:50:34 -08:00
Andrey Goncharov
fc20abf392 Add Flipper server command definitions
Reviewed By: lblasa

Differential Revision: D33980529

fbshipit-source-id: b64f48134d4816d3502c70d15beff90a044490a4
2022-02-28 03:50:34 -08:00
Anton Nikolaev
5da0a83a36 Refactor recommended plugin API
Summary:
This is just refactoring in preparation to open-sourcing internal plugin distribution code to make it available for other orgs so they can distribute their internal plugins. See other diffs in the same stack.

This diff moves recommended plugins handling from `pluginMarketplace` which will be the same for fb-internal and OS versions into `pluginMarketplaceAPI` which will differ for fb-internal and OS versions. This will make it possible for other orgs to define their own "recommended" plugins which then will be automatically installed/enabled for new users.

Reviewed By: aigoncharov

Differential Revision: D34379981

fbshipit-source-id: 5c3a4efb6d0171256cf508f9005d914d7332e14f
2022-02-22 05:23:05 -08:00
Lawrence Lomax
ef2b03ea95 Specialize error message when no xcode selected
Summary:
We can detect an xcode-select failure earlier on, right now this will be misleading as later healtchecks around `xctrace`/`xcodebuild` will fail and it's not clear why.

If you don't have any Xcode selected, then we can detect this and mark it as an error. This can be done by looking out the output of the command.

To do this we have to propogate the stdout of the shell-out back, so there's a subtype of the regular healtcheck. This is then inspected for it's path since `xcode-select` returns the same exit code if xcode isn't selected or at it's default state.

Reviewed By: passy

Differential Revision: D34168673

fbshipit-source-id: c0aa846bb251aaf026beb976a042b727c7cf1c24
2022-02-11 04:21:05 -08:00
Michel Weststrate
c97cf6eaf8 Add logging for "Attempted to build clientId with invalid app" event
Summary: The `Error: Attempted to build clientId with invalid app: "` event shows up in our monitoring regularly, but it is unclear which kind of app is trying to connect, so adding some more info to the error, to be able to pin point it better a next time

Reviewed By: lawrencelomax

Differential Revision: D33982871

fbshipit-source-id: 34c2612a9fe86a6815f1cc655f6def1f734e4b1e
2022-02-04 01:15:41 -08:00
Michel Weststrate
e4a3696fd5 Don't create always rejecting promises for timeout
Summary:
Our existing `timeout` implementation was always throwing an exception, due to sleeping and then throw an exception, which is than handled but ignored by `Promise.race`.

This implementation has a few problems

1. Because it always throws, having a debugger session with 'break on caught exceptions' will pause on every usage of timeout (rather than just the ones that actually timeout). This makes this way of debugging a bit useless.
2. Throwing exceptions is in principle an expensive process (due to the stack trace generation)
3. Not cancelling the timeout used by sleep is a bit of a waste as well

Reviewed By: lawrencelomax

Differential Revision: D33982717

fbshipit-source-id: d739c02112e1c1bc4cd691af852371d08a99abc6
2022-02-04 01:15:41 -08:00
Anton Kastritskiy
c5dd1fc350 rename files from ts to tsx in flipper-* packages
Summary: mass files rename

Reviewed By: nikoant

Differential Revision: D33890252

fbshipit-source-id: d5afaa60af7340313a97d8e4967fe37f00abd9db
2022-01-31 10:16:19 -08:00
Michel Weststrate
b6c884f011 Make sure flipper server initialization errors are propagated properly
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
2022-01-04 02:57:25 -08:00
Andres Suarez
79023ee190 Update copyright headers from Facebook to Meta
Reviewed By: bhamodi

Differential Revision: D33331422

fbshipit-source-id: 016e8dcc0c0c7f1fc353a348b54fda0d5e2ddc01
2021-12-27 14:31:45 -08:00
Andrey Goncharov
debf872806 Allow to start only one instance of log listener and crash watcher
Summary:
Changelog: Allow only a single crash watcher and a single log listener per device. Start log listener and crash watcher for every device upon connection. Remove commands to start/stop them externally.

Monitored CPU load for a physical Android device with the log listener on and off. Did not notice any real difference.

Resolved crashing adbkit-logcat by forcing the usage of 2.0.1. A proper fix would be to unify babel transforms for browser flipper and electron flipper, but we might re-think how we distribute flipper in the next half, so a simple hot fix might be a better use of time and resources.

Reviewed By: mweststrate

Differential Revision: D33132506

fbshipit-source-id: 39d422682a10a64830ac516e30f43f32f416819d
2021-12-20 11:39:01 -08:00
Andrey Goncharov
731749b41f Move crash reporting listener to the server
Summary: Changelog: Move crash watcher to the server. Add 'device-crash' event. Add 'device-start-crash-watcher', 'device-stop-crash-watcher' commands. Add 'onDeviceCrash' method to Plugin Client.

Reviewed By: mweststrate

Differential Revision: D33089810

fbshipit-source-id: ed62ee7c1129e5e25af18b444744b0796f567b72
2021-12-20 11:39:00 -08:00
Michel Weststrate
4630f37786 Clean up process globals
Summary: Cleaned up some `process` references

Reviewed By: passy

Differential Revision: D33184882

fbshipit-source-id: 6fc56bcea4e145ba97aa8bf9e689e53e2bf239cc
2021-12-17 14:12:50 -08:00
Michel Weststrate
5df34a337c Unshare global types
Summary:
This diff adds `types` fields on the compiler config for every project. This way we can make sure that for example node types and packages are not available in flipper-ui-core. Without an explicit types field, all types would be shared between all packages, and implicitly included into the compilation of everything. For the same reason `types/index.d.ts` has been removed, we want to be intentional on which types are being used in which package.

This diff does most of the work, the next diff will fine tune the globals, and do some further cleanup.

As an alternative solution I first tried a `nohoist: **/node_modules/types/**` and make sure every package list explicitly the types used in package json, which works but is much more error prone, as for example two different react types versions in two packages will cause the most unreadable compiler error due to the types not being shared and not literally the same.

Reviewed By: lawrencelomax

Differential Revision: D33124441

fbshipit-source-id: c2b9d768f845ac28005d8331ef5fa1066c7e4cd7
2021-12-17 07:36:07 -08:00
Michel Weststrate
d95b15094f Implement fs.readFile / fs.writeFile
Summary: Per title. Made an explicit distinction between binary and non binary files, since they need to be encoded differently. This keeps both the implementation and API simpler (in terms of overloading / type checking)

Reviewed By: aigoncharov

Differential Revision: D33016031

fbshipit-source-id: 3c99956eb016849a908a171d88a7a64a88b76268
2021-12-13 05:48:17 -08:00
Michel Weststrate
34a1da3345 Implement fs.stat and fs.readlink
Summary: Fixes issue for the stackTraceMapper

Reviewed By: aigoncharov

Differential Revision: D32987161

fbshipit-source-id: 660f49a1bdf61b2fd2963874ef23dfd284f71128
2021-12-13 05:48:17 -08:00
Michel Weststrate
af83523798 Fixed intern requests not being serializable
Summary: Intern requests didn't work in the browser version of Flipper, as the axios objects that are returned from the server end up as garbage over the socket. Fixed that by construction the proper result object.

Reviewed By: timur-valiev, aigoncharov

Differential Revision: D32984537

fbshipit-source-id: 09c44ed95ce5e3f5e9495f2f9324f1f89e3c62ba
2021-12-13 05:48:16 -08:00
Andrey Goncharov
c96558a524 Remove fs and os usage from Mobile Builds plugin
Summary: Changelog: Expose env info and FS rm command to flipper plugins.

Reviewed By: mweststrate

Differential Revision: D32988478

fbshipit-source-id: 3d0233f9eb34d3478b07e39b9401c0e30ca95135
2021-12-10 06:36:13 -08:00
Andrey Goncharov
92f0ed67f4 Add download file API
Summary: Changelog: Expose "downloadFile" API to Flipper plugins. Allow them to download files form the web to Flipper Server.

Reviewed By: mweststrate

Differential Revision: D32950685

fbshipit-source-id: 7b7f666e165ff7bf209230cdc96078272ede3616
2021-12-10 06:36:12 -08:00
Andrey Goncharov
0e785fb18d Add remote fs API
Summary: Changelog: Expose Flipper Server FS access to Flipper plugins

Reviewed By: lblasa

Differential Revision: D32883144

fbshipit-source-id: 47637b61849ef60a2d8fe91a0a28d2a358e0b8c4
2021-12-10 06:36:12 -08:00
Andrey Goncharov
a87b99cd3d Remove child_process from kaios-allocation, kaios-ram, uiqr
Summary:
Changelog: Remove child_process usage  from kaios-allocation, kaios-ram plugins
Facebok:
Remove child_process usage from uiqr plugin

Reviewed By: mweststrate

Differential Revision: D32881860

fbshipit-source-id: 4270aaf28808baee399e263a6a7528f20242784f
2021-12-10 06:36:12 -08:00
Andrey Goncharov
e458ae76f9 Add exec Node API to FlipperLib
Summary: Changelog: Allow flipper plugins to run "exec" Node API on Flipper server.

Reviewed By: mweststrate

Differential Revision: D32881149

fbshipit-source-id: 46486a47ee9824ca68897c19fd86b4afc7f8bf1d
2021-12-10 06:36:12 -08:00