firebase / firebase-tools-ui

A local-first UI for Firebase Emulator Suite.
https://firebase.googleblog.com/2020/05/local-firebase-emulator-ui.html
Apache License 2.0
262 stars 60 forks source link

Use address instead of host when determining the URL to use. #893

Closed aaron-coalesce closed 6 months ago

aaron-coalesce commented 1 year ago

Querying the hub for the emulator config by requesting127.0.0.1:4400/emulators gives the following:

{
  "hub": {
    "listen": [
      {
        "address": "0.0.0.0",
        "family": "IPv4",
        "port": 4400
      }
    ],
    "name": "hub",
    "host": "127.0.0.1",
    "port": 4400
  },
  "ui": {
    "listen": [
      {
        "address": "0.0.0.0",
        "family": "IPv4",
        "port": 4000
      }
    ],
    "name": "ui",
    "host": "127.0.0.1",
    "port": 4000,
    "pid": 66
  }
}

The listen.address is 0.0.0.0, so I would expect the UI logic to default to window.location.hostname but instead the links I see in the UI are 127.0.0.1. This appears to be because the code is looking at listen.host instead of listen.address. Changing references to listen.host to listen.address fixed the issue, and the UI links used the window's location instead of 127.0.0.1.

google-cla[bot] commented 1 year ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

aaron-coalesce commented 6 months ago

Looks like this got incorporated without me signing the agreement, so just closing the PR.