js icon indicating copy to clipboard operation
js copied to clipboard

[Bug]: URL Backing Ping is Removed (Hotspot Detect)

Open manufacturedba opened this issue 11 months ago • 1 comments

Hardware

Other

Connection Type

HTTP

Firmware Version

2.5.15.79da236

Description

Looking at the logic for starting a HTTP connection with a device

private async attemptConnection(
    params: Types.HttpConnectionParameters,
  ): Promise<Response> {
    const { address, tls = false } = params;
    this.portId = `${tls ? "https://" : "http://"}${address}`;

    // We create a dummy request here just to have a Response object to work with
    // The actual connection check is done via ping()
    const response = await fetch(`${this.portId}/hotspot-detect.html`, {
      signal: this.abortController.signal,
      mode: "no-cors",
    });

    if (!response.ok) {
      throw new Error(`HTTP ${response.status}: ${response.statusText}`);
    }

    return response;
  }

It appears to rely on hotspot-detect.html to infer a successful connection before polling; however, that router handler no longer exists in the latest firmware.

Given its response content is not used for reading from the radio API, can this be removed? Asking for context before I submit a PR

Relevant console output


manufacturedba avatar Feb 04 '25 06:02 manufacturedba

Just chiming in that after updating meshtastic/js to 5e5385cb2f7453ca95216347f2cc1fbed3cb6d6a for MeshSense, I have received reports of being unable to connect to meshtasticd with error:

Image

A packet capture showed the need for hotspot-detect.html

Image

After the reporter copied index.html to hotspot-detect.html, they were able to connect.

cd /usr/share/meshtasticd/web
cp index.html hotspot-detect.html

Soltares avatar Feb 19 '25 15:02 Soltares