Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[menu-bar] Add local HTTP server to circumvent deep-link limitations #52

Merged
merged 2 commits into from
Sep 4, 2023

Conversation

gabrieldonadel
Copy link
Member

@gabrieldonadel gabrieldonadel commented Sep 1, 2023

Why

Closes ENG-9945

This will allow us to remove the need for an "Enable Orbit" option inside User Settings, given that we can just fetch the local server from the website and verify if Orbit is running. As long as Orbit is open, the "Open with Orbit" button will be displayed.

One other advantage of having a local HTTP server is the ability to check the version that is installed in the user's computer and potentially show different options, this could be necessary in the future when we add new features to Orbit.

How

This PR adds Swifter as a CocoaPods dependency, providing us a tiny and versatile HTTP server engine.

The set of possible ports used for this are 35783, 47909, 44171, and 50799, and were chosen randomly. All ports are unassigned and are not used by any largely known applications.

This first version of the HTTP server has two endpoints, /orbit/status and orbit/open and both require Origin and Refer headers from expo domains, this is to prevent other potentially malicious websites from fetching the local server

Test Plan

/orbit/status
image

/orbit/open

Screen.Recording.2023-09-01.at.17.02.14.mov

@linear
Copy link

linear bot commented Sep 1, 2023

ENG-9945 Implement local server for deep linking

We should implement a local http server that runs as a subprocess of Orbit to allow us to detect from the website that Orbit is available and running the user machine. We should use a similar approach to the Linear and Slack use.

E.g.

GET http://127.0.0.1:44450/orbit/status

Response 200

{
"name": "orbit",
"version": "1.0.0" 
}

And

POST http://127.0.0.1:44450/orbit/open

body:

{
"url": "xxxxx"  
}

@gabrieldonadel gabrieldonadel marked this pull request as ready for review September 2, 2023 20:55
@gabrieldonadel gabrieldonadel merged commit e9583e0 into main Sep 4, 2023
1 check passed
@gabrieldonadel gabrieldonadel deleted the @gabrieldonadel/add-local-server branch September 4, 2023 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant