Commit Graph

72 Commits

Author SHA1 Message Date
Michel Weststrate
cbda298b9d Add support to build flipper-server from SandCastle
Summary:
This refactors the flipper-server release script in such a way that it works the same as the normal release script, which solves two problems:

1) the official release script modifies versioned files, as it touches the package.json
2) it was slightly confusing that `flipper-server/static` was filled for release builds only, but not used in dev builds
3) running test:npx without running a release build before it, would fail with hard to comprehend errors. this has been solved now by removing that script and make it an arg of `build:flipper-server`

Also some further minor changes to prepare running a corresponding build / release job from SandCastle (later in this stack)

Reviewed By: nikoant

Differential Revision: D33297214

fbshipit-source-id: f6299aa982c3e59d1cc6479a93c56cbe4b57f85c
2021-12-24 07:18:11 -08:00
Michel Weststrate
72fa481d27 Fix generation of bundled.json, make source maps work in prod builds
Summary:
This diff fixes several issues around loading plugin, such as:

* make suresource maps work in the flipper-server production build
* make sure default plugins are no symlinked, which wouldn't work anywhere else but on the the system where it was build
* support release channel param for flipper-server

Bundled flipper-server is now 42MB (with icons (see later diffs) and plugins
```
ll flipper-server-v0.0.0.tgz
-rw-r--r--  1 mweststrate  staff    42M 23 Dec 15:29 flipper-server-v0.0.0.tgz
```

Reviewed By: nikoant

Differential Revision: D33294677

fbshipit-source-id: 63538dc8127f883fee6a3608673ad11ce239b350
2021-12-24 02:16:48 -08:00
Michel Weststrate
86b6d2c99d Make flipper-server NPX-able
Summary: Make sure flipper-server is bundled in such a way that it is self-contained NPX-able. Also added some checks to make sure that dev dependencies don't accidentallly end up in in Flipper buidls

Reviewed By: nikoant

Differential Revision: D33190254

fbshipit-source-id: 443162e537d8ca9f956acac2d7bd52cbf0c92172
2021-12-24 02:16:48 -08:00
Michel Weststrate
f9c769aee3 Fix Metro crash if no origin header is set
Summary:
Changelog: Work-around for missing `origin` header problem https://github.com/facebook/flipper/issues/3189; causing Metro to crash when Flipper tries to connect

Will follow up with separate fix in React Native itself as well

Reviewed By: nikoant

Differential Revision: D33276414

fbshipit-source-id: 34d1510262ac24172ac1c6660799bb755b0f1f11
2021-12-22 03:18:52 -08:00
Andrey Goncharov
5e3e777b5c Enable DownloadFile write stream error test (#3207)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/3207

Followup of D33191515 (e0afebeb32)

Reviewed By: mweststrate

Differential Revision: D33253520

fbshipit-source-id: 30bca740dd8674b9bbba4e157d27f2dcedbc5ed5
2021-12-21 08:10:49 -08:00
dependabot[bot]
3d28991cbe Bump axios from 0.21.4 to 0.24.0 in /desktop (#3166)
Summary:
Bumps [axios](https://github.com/axios/axios) from 0.21.4 to 0.24.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/axios/axios/releases">axios's releases</a>.</em></p>
<blockquote>
<h2>v0.24.0</h2>
<h3>0.24.0 (October 25, 2021)</h3>
<p>Breaking changes:</p>
<ul>
<li>Revert: change type of AxiosResponse to any, please read lengthy discussion here: (<a href="https://github-redirect.dependabot.com/axios/axios/issues/4141">#4141</a>) pull request: (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4186">#4186</a>)</li>
</ul>
<p>Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:</p>
<ul>
<li><a href="https://github.com/axios/axios/blob/HEAD/mailto:jasonsaayman@gmail.com">Jay</a></li>
<li><a href="https://github.com/ImRodry">Rodry</a></li>
<li><a href="https://github.com/remcohaszing">Remco Haszing</a></li>
<li><a href="https://github.com/ITenthusiasm">Isaiah Thomason</a></li>
</ul>
<h2>v0.23.0</h2>
<h3>0.23.0 (October 12, 2021)</h3>
<p>Breaking changes:</p>
<ul>
<li>Distinguish request and response data types (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4116">#4116</a>)</li>
<li>Change never type to unknown (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4142">#4142</a>)</li>
<li>Fixed TransitionalOptions typings (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4147">#4147</a>)</li>
</ul>
<p>Fixes and Functionality:</p>
<ul>
<li>Adding globalObject: 'this' to webpack config (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3176">https://github.com/facebook/flipper/issues/3176</a>)</li>
<li>Adding insecureHTTPParser type to AxiosRequestConfig (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4066">#4066</a>)</li>
<li>Fix missing semicolon in typings (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4115">#4115</a>)</li>
<li>Fix response headers types (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4136">#4136</a>)</li>
</ul>
<p>Internal and Tests:</p>
<ul>
<li>Improve timeout error when timeout is browser default (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3209">#3209</a>)</li>
<li>Fix node version on CI (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4069">#4069</a>)</li>
<li>Added testing to TypeScript portion of project (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4140">#4140</a>)</li>
</ul>
<p>Documentation:</p>
<ul>
<li>Rename Angular to AngularJS (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4114">#4114</a>)</li>
</ul>
<p>Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:</p>
<ul>
<li><a href="https://github.com/axios/axios/blob/HEAD/mailto:jasonsaayman@gmail.com">Jay</a></li>
<li><a href="https://github.com/Evan-Finkelstein">Evan-Finkelstein</a></li>
<li><a href="https://github.com/Jezorko">Paweł Szymański</a></li>
<li><a href="https://github.com/dobesv">Dobes Vandermeer</a></li>
<li><a href="https://github.com/caugner">Claas Augner</a></li>
<li><a href="https://github.com/remcohaszing">Remco Haszing</a></li>
<li><a href="https://github.com/egmen">Evgeniy</a></li>
<li><a href="https://github.com/DigitalBrainJS">Dmitriy Mozgovoy</a></li>
</ul>
<h2>v0.22.0</h2>
<h3>0.22.0 (October 01, 2021)</h3>
<p>Fixes and Functionality:</p>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/axios/axios/blob/master/CHANGELOG.md">axios's changelog</a>.</em></p>
<blockquote>
<h3>0.24.0 (October 25, 2021)</h3>
<p>Breaking changes:</p>
<ul>
<li>Revert: change type of AxiosResponse to any, please read lengthy discussion here: (<a href="https://github-redirect.dependabot.com/axios/axios/issues/4141">#4141</a>) pull request: (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4186">#4186</a>)</li>
</ul>
<p>Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:</p>
<ul>
<li><a href="https://github.com/axios/axios/blob/master/mailto:jasonsaayman@gmail.com">Jay</a></li>
<li><a href="https://github.com/ImRodry">Rodry</a></li>
<li><a href="https://github.com/remcohaszing">Remco Haszing</a></li>
<li><a href="https://github.com/ITenthusiasm">Isaiah Thomason</a></li>
</ul>
<h3>0.23.0 (October 12, 2021)</h3>
<p>Breaking changes:</p>
<ul>
<li>Distinguish request and response data types (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4116">#4116</a>)</li>
<li>Change never type to unknown (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4142">#4142</a>)</li>
<li>Fixed TransitionalOptions typings (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4147">#4147</a>)</li>
</ul>
<p>Fixes and Functionality:</p>
<ul>
<li>Adding globalObject: 'this' to webpack config (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3176">https://github.com/facebook/flipper/issues/3176</a>)</li>
<li>Adding insecureHTTPParser type to AxiosRequestConfig (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4066">#4066</a>)</li>
<li>Fix missing semicolon in typings (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4115">#4115</a>)</li>
<li>Fix response headers types (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4136">#4136</a>)</li>
</ul>
<p>Internal and Tests:</p>
<ul>
<li>Improve timeout error when timeout is browser default (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3209">#3209</a>)</li>
<li>Fix node version on CI (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4069">#4069</a>)</li>
<li>Added testing to TypeScript portion of project (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4140">#4140</a>)</li>
</ul>
<p>Documentation:</p>
<ul>
<li>Rename Angular to AngularJS (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4114">#4114</a>)</li>
</ul>
<p>Huge thanks to everyone who contributed to this release via code (authors listed below) or via reviews and triaging on GitHub:</p>
<ul>
<li><a href="https://github.com/axios/axios/blob/master/mailto:jasonsaayman@gmail.com">Jay</a></li>
<li><a href="https://github.com/Evan-Finkelstein">Evan-Finkelstein</a></li>
<li><a href="https://github.com/Jezorko">Paweł Szymański</a></li>
<li><a href="https://github.com/dobesv">Dobes Vandermeer</a></li>
<li><a href="https://github.com/caugner">Claas Augner</a></li>
<li><a href="https://github.com/remcohaszing">Remco Haszing</a></li>
<li><a href="https://github.com/egmen">Evgeniy</a></li>
<li><a href="https://github.com/DigitalBrainJS">Dmitriy Mozgovoy</a></li>
</ul>
<h3>0.22.0 (October 01, 2021)</h3>
<p>Fixes and Functionality:</p>
<ul>
<li>Caseless header comparing in HTTP adapter (<a href="https://github-redirect.dependabot.com/axios/axios/pull/2880">https://github.com/facebook/flipper/issues/2880</a>)</li>
<li>Avoid package.json import fixing issues and warnings related to this (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4041">#4041</a>), (<a href="https://github-redirect.dependabot.com/axios/axios/pull/4065">#4065</a>)</li>
<li>Fixed cancelToken leakage and added AbortController support (<a href="https://github-redirect.dependabot.com/axios/axios/pull/3305">#3305</a>)</li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="53d6d37556"><code>53d6d37</code></a> Adding minfied files</li>
<li><a href="6d613b4fe4"><code>6d613b4</code></a> Updated changelog</li>
<li><a href="2c9cc76ee9"><code>2c9cc76</code></a> revert: change type of AxiosResponse to any (<a href="https://github-redirect.dependabot.com/axios/axios/issues/4186">#4186</a>)</li>
<li><a href="1025d1231a"><code>1025d12</code></a> Release v0.23.0</li>
<li><a href="6d1e30fd80"><code>6d1e30f</code></a> Prepared release notes</li>
<li><a href="20e8b6bc8c"><code>20e8b6b</code></a> chore(docs): rename Angular to AngularJS (<a href="https://github-redirect.dependabot.com/axios/axios/issues/4114">#4114</a>)</li>
<li><a href="94a9344799"><code>94a9344</code></a> Test types (<a href="https://github-redirect.dependabot.com/axios/axios/issues/4140">#4140</a>)</li>
<li><a href="fce210a67e"><code>fce210a</code></a> Fixed TransitionalOptions typings (<a href="https://github-redirect.dependabot.com/axios/axios/issues/4147">#4147</a>)</li>
<li><a href="547815d9fd"><code>547815d</code></a> Mending merge conflict</li>
<li><a href="e462973a4b"><code>e462973</code></a> fix response headers types (<a href="https://github-redirect.dependabot.com/axios/axios/issues/4136">#4136</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/axios/axios/compare/v0.21.4...v0.24.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=axios&package-manager=npm_and_yarn&previous-version=0.21.4&new-version=0.24.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

 ---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

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

Reviewed By: passy

Differential Revision: D33234007

Pulled By: aigoncharov

fbshipit-source-id: 1be18f528a4f8eae84a7a19afec92d8b11ce7cf9
2021-12-20 13:52:52 -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
e0afebeb32 Disabled consistently failing OSS test (#3188)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/3188

Fixes failing typescript issue (probably case sensitivity thing, on windows it was complaining about `Metro` not being resolvable while we use `metro` everywhere). Put a `ts-ignore` on it, since the metro typings we use are empty anyway

Disabled a test that failed consistently on GH CI. Maybe timing or Node version issue?

Reviewed By: fabiomassimo

Differential Revision: D33191515

fbshipit-source-id: 18a143024824eeeafaffe4941df474591fb7b70a
2021-12-17 14:03:53 -08:00
Michel Weststrate
d9488f06ac Clean up flipper-ui-core deps
Summary: Noticed that flipper-ui-core bundled quite some unused / node based deps. No longer

Reviewed By: aigoncharov

Differential Revision: D33184489

fbshipit-source-id: a180f9b8f3eb00ffa6c91e0cca654d4b9b609692
2021-12-17 10:04:23 -08:00
Michel Weststrate
cea7be7fde Clean up globals
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
2021-12-17 10:04:23 -08:00
Michel Weststrate
8f40949bb0 clean slate package resolutions
Summary:
Over time we collected a lot of harcoded resolutions, but it is really hard to get signal about their sanity:
* some resolutions generate a lot of yarn warnings as they resolve with a different major than required, and it's really hard to tell whether they actually make things worse or better
* some resolutions are for package we don't even use any more
* some resolutions were there to fix type incompatibilities which have been solved now by keeping them uniquely required
* some resolutions are there to fix "security issues" or security issues in transient dependencies that might have been upgraded int he mean time

So this diff radically removes all of them, trusting Github to propose restoring the sane ones of them :). In terms of functionality everything seems to be working at least

Reviewed By: timur-valiev

Differential Revision: D33158981

fbshipit-source-id: 83e74cdbc8e47ccbf554b97620cf7caa2c6599ce
2021-12-17 07:36:07 -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
dcfeb4a4d5 Clean up packages and types
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
2021-12-16 14:54:59 -08:00
Michel Weststrate
ef2a86e7a8 Sdk path should be used when launching emulator
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
2021-12-16 14:51:08 -08:00
Michel Weststrate
3ef1923b29 Use uniform Socket message size to avoid disconnects
Summary: During startup the socket connection would close a few times, among others because Scribe dumps 1.3 MB of data after startup, and the maximum payload of `socket.io` defaults to 1MB. This diff changes it to 100MB (the max size used by `ws` library). We know that we need at least > 10 MB, as that is what plugins like Network cap at.

Reviewed By: aigoncharov

Differential Revision: D33017653

fbshipit-source-id: 1233af6fbdc4b9eed42786ee418cfd6d43b2b433
2021-12-13 05:48:17 -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
7e9ad72baa Fix --no-bundled-plugins was not respected
Summary: Even with the `--no-bundled-plugins` flag, still a hundred plugins were loaded when running flipper-server

Reviewed By: timur-valiev, aigoncharov

Differential Revision: D32987158

fbshipit-source-id: 19e51e7e5f8ec9e664eb48cf2f2b8936f2f5ed73
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
0510786dec Fixed relilability issues in running health checks
Summary: Run doctor checks remained pending when the socket disonnected during a check. This

Reviewed By: aigoncharov

Differential Revision: D32984539

fbshipit-source-id: 277005e78803afaaa220cc5ca7fdc9cca6254453
2021-12-13 05:48:16 -08:00
Michel Weststrate
bb23b36051 Fixed flipper settings not being loaded / saved on fresh install
Summary:
I was running flipper-server on a fresh machine without Flipper installed and discovered that reading / writing settings failed since `~/.flipper` wasn't existing, due to using `access` instead of `pathExists`.

Added a warning about needing to restart the server after making changes, since that is tricky to do from the UI.

Fixed an issue in the settings screen, which would fs.stat as part of rendering, causing the Settings UI not to load.

Reviewed By: timur-valiev, aigoncharov

Differential Revision: D32984538

fbshipit-source-id: 2b2011ad9d84c72ac824d92a8c96f636237b8771
2021-12-10 17:59:33 -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
adb2573a1f Forbid imports from nested directories of flipper-common, flipper-plugin, flipper-ui-core
Summary:
Forbid imports from nested directories of flipper-common, flipper-plugin, flipper-ui-core

In the stack of D32926830 I occasionally imported from flipper-plugin/src/... which is not allowed. This should fix any auto-import related issues once and for all.

Reviewed By: timur-valiev

Differential Revision: D32987054

fbshipit-source-id: f19f6278219961ad283cacfec094a6c703ca93f8
2021-12-10 06:36:12 -08:00
Andrey Goncharov
9436c32ce9 Add unit tests for 'download-file' command
Reviewed By: mweststrate

Differential Revision: D32926830

fbshipit-source-id: fbd4dcb910ffdcdc365f5f0b4c401423f0256824
2021-12-10 06:36:12 -08:00
Andrey Goncharov
6aa0cef927 Use download file API in MobileBuildsPlugin
Summary:
Facenook:
Use downloadFile API in Mobile Builds plugin

Reviewed By: mweststrate

Differential Revision: D32922041

fbshipit-source-id: d554ed9287af3bda4329e87732ab4de67136c0d2
2021-12-10 06:36:12 -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
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
Andrey Goncharov
359e403639 Disable idb stdout buffering for logs
Summary:
Changelog: Disable idb stdout buffering for logs. Show logs on iOS devices without buffering.

Currently, idb buffers log output if it's redirected to a non-TTY. It is the default behavior for Python (read more about it [here](https://eklitzke.org/stdout-buffering)).
It leads to users seeing logs only in large chunks because the size of the buffer is substantial.
Setting PYTHONUNBUFFERED to a non-empty string disables Python output buffering.

Reviewed By: lblasa

Differential Revision: D32984711

fbshipit-source-id: 3e0a889b6b60b6d266f4a0c1894db937868c7433
2021-12-09 09:48:11 -08:00
Lorenzo Blasa
59641d7987 Do not reject promise for sendExpectResponse invokations
Summary:
On Flipper Desktop, rawCall uses sendExpectResponse from the client connection.
RSocket only rejects the promise if there's an error in the transport layer and thus is unable to send data over the wire.

WebSocket sends without errors as errors will always be reported via a different callback api.

Having said that, WebSocket client connections were rejecting the promise for a valid client response that contained an error instead of success, which in this specific case is expected.

The solution is to always resolve the promise with the response and let the Client interpret the response accordingly.

Changelog: Fixes an issue whereas client errors were erroneously disconnecting a client from the Desktop side

Reviewed By: aigoncharov

Differential Revision: D32983969

fbshipit-source-id: 4215d9234235a9e2035b1d743c317ebdf2f656a2
2021-12-09 06:10:32 -08:00
Michel Weststrate
92a743cc59 Processed some earlier review comments
Summary: Per title, processed some pending review comments made earlier in this stack

Reviewed By: aigoncharov

Differential Revision: D32916920

fbshipit-source-id: 01db85883596b5c85b77efc9cddadeac23cc4ef5
2021-12-08 04:30:57 -08:00
Michel Weststrate
3c6668a8b9 Make sure devices and clients are registered on session startup
Summary: This diff makes sure that when the client starts, it fetches all known devices and clients first, as it might have missed the 'connect' events for those. For Electron this wasn't needed, since the server starts with the UI, but this makes sure that a browser reload or a second connection sees the same devices & apps

Reviewed By: aigoncharov

Differential Revision: D32881589

fbshipit-source-id: 7b1cb3d296044f83dedcf3f3d8d02864690b6666
2021-12-08 04:30:57 -08:00
Michel Weststrate
943d535e86 Move sending intern requests from client to server
Summary: This diff moves send intern request from the browser to the server. The reason to make this change is that making such requests from a browser environment causes CORS restrictions to kick in.

Reviewed By: nikoant

Differential Revision: D32835449

fbshipit-source-id: e8e92e51ca963aa50b3c859bb61c2381171e85ae
2021-12-08 04:30:57 -08:00
Michel Weststrate
ad4a55f263 move node types, stub node modules
Summary: This diff stubs all node modules when running in the browser, so that, albeit with a lot of errors and without plugins, the UI loads in a browser. To be continued in the rest of this diff

Reviewed By: antonk52

Differential Revision: D32665705

fbshipit-source-id: 4632e241f59c5b9712a41d01a26878afb01f69b5
2021-12-08 04:30:57 -08:00
Michel Weststrate
129cbd6f7b Move changelog loading to server
Summary: per title

Reviewed By: aigoncharov

Differential Revision: D32723706

fbshipit-source-id: ce5108da9f5da6fdfa7d1a66a31a4f8f430eb78d
2021-12-08 04:30:56 -08:00
Michel Weststrate
eab4f0d3d3 Bits & pieces
Summary: Added a command to let a file be opened by the OS, and some other small bits and pieces to make Flipper browser compatible.

Reviewed By: lblasa

Differential Revision: D32721748

fbshipit-source-id: a4ad1c2f662f4651ddf6c20c57e5af1e123914a8
2021-12-08 04:30:56 -08:00
Michel Weststrate
2480ed30c5 Move flipper-doctor check running to flipper-server-core
Summary: Per title. Two new server API's: get-healthchecks, and run-healtcheck. Types have all been moved to flipper-common, so that they can be used by doctor, server-core and ui-core packages. Since it were quite some, moved them into a FlipperDoctor namespace.

Reviewed By: nikoant

Differential Revision: D32720510

fbshipit-source-id: 37aa35cde6ebd58479cf0dffec5b7b2da6d22198
2021-12-08 04:30:56 -08:00
Michel Weststrate
2a4fe77404 Extract environment config initialisation to server-core
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
2021-12-08 04:30:56 -08:00
Michel Weststrate
de59bbedd2 Make plugin loading async
Summary: This diff makes plugin loading async, which we'd need in a browser env (either because we'd use `import()` or we need to fetch the source and than eval it), and deals with all the fallout of that

Reviewed By: timur-valiev

Differential Revision: D32669995

fbshipit-source-id: 73babf38a6757c451b8200c3b320409f127b8b5b
2021-12-08 04:30:56 -08:00
Michel Weststrate
64747dc417 move plugin management from ui-core to server-core
Summary:
Follow up of D32665064, this diff moves all plugin management logic from flipper-ui to flipper-server. Things like downloading, installing, querying new plugins.

Loading plugins is handled separately in the next diff.

Reviewed By: nikoant

Differential Revision: D32666537

fbshipit-source-id: 9786b82987f00180bb26200e38735b334dc4d5c3
2021-12-08 04:30:56 -08:00
Michel Weststrate
e7f841b6d2 Move flipper plugin from flipper-lib types to flipper-common
Summary: Moved all types related to plugin descriptions from plugin-lib (which handles downloads and such) to flipper-common. The goal of that is to remove all plugin-lib usage from ui-core to server-core, so that the UI itself doesn't do any file operations anymore related to plugins. That will be done in next diffs, this just moves types but no code.

Reviewed By: nikoant, aigoncharov

Differential Revision: D32665064

fbshipit-source-id: 86d908e7264569b0229b09290a891171876c8e00
2021-12-08 04:30:55 -08:00
Michel Weststrate
9c913151bc Fix issue server-core not cleaning up devices properly
Summary:
Notice during debugging that devices keep unregistering. Doesn't lead to any practical issues, but still incorrect.

Also noticed that the server didn't restart when changing flipper-server-core, or recompile its deps, so fixed that as well.

Reviewed By: passy

Differential Revision: D32644276

fbshipit-source-id: 5384a30c9d293acda04b6e6f940268ddcd65a870
2021-12-08 04:30:55 -08:00
Michel Weststrate
5d45bd741b Initialise flipper-ui-browser with socket connection
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
2021-12-08 04:30:55 -08:00
Michel Weststrate
e742322eb1 Move keychain storage to server, some constants cleanup
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
2021-12-08 04:30:54 -08:00
Michel Weststrate
bca169df73 Move settings, launcherSettings, GKs to app / flipper-server-core
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
2021-12-08 04:30:54 -08:00
Michel Weststrate
eed19b3a3d Move FlipperServer initialisation out of flipper-core
Summary: This diff makes sure flipper-ui-core no longer depends on flipper-server-core. Currently server config is still transferred from UI to server, which doesn't really make sense in future scenarios where server might start before client, but will address that separately

Reviewed By: timur-valiev, aigoncharov

Differential Revision: D32462835

fbshipit-source-id: 498a944256ba1aabbf963b896953e64d11e27214
2021-12-08 04:30:54 -08:00
Andrey Goncharov
9fc1d3cfb9 Ignore stale replies
Summary: Changelog: ignore stale replies

Reviewed By: lblasa

Differential Revision: D32829739

fbshipit-source-id: 267f43f8e8f3dea60ee86187f7a7709fea09e5af
2021-12-03 05:31:16 -08:00
Lorenzo Blasa
0d94120928 Remove Request Identifier from message
Summary:
{F684271717}
^
This is causing the error being reported quite a lot. The identifier doesn't provide much information to the person analysing the error. Only ever useful if debugging.

Reviewed By: antonk52, mweststrate

Differential Revision: D32828150

fbshipit-source-id: f29fbf6bfe389fec6ef888fc01be6c058193709d
2021-12-03 03:40:26 -08:00
Pascal Hartig
ea94c9d1a5 Demote exchange error
Summary: The errors files for this aren't actionable and cannot be deduplicated because of the information included. Better to treat this as a warning.

Reviewed By: nikoant

Differential Revision: D32758656

fbshipit-source-id: 5255d694b8783b7bb49f981933741063d012df98
2021-12-01 10:49:19 -08:00
Pascal Hartig
3e258c6969 Demote connection loop error
Summary: We can't action tasks based on this report, so better to raise it as a warning.

Reviewed By: nikoant

Differential Revision: D32758850

fbshipit-source-id: 2e8ff984f40d2d0431db192e8f2d983d52b77ccd
2021-12-01 10:46:41 -08:00