fluidd icon indicating copy to clipboard operation
fluidd copied to clipboard

Endpoints port removed from URLs in config.json

Open liborburda opened this issue 1 year ago • 2 comments

Fluidd Version

v1.20.1-2bb2209

Browser

Firefox

Device

Desktop PC

Operating System

Windows

What happened

First of, thank you all for the excellent work! I really love Fluidd.

I have multiple (two) Moonraker instances running on the same RPi. I would like to specify them in endpoints array in config.json, so they are pre-configured across all devices.

What did you expect to happen

Both instances are pre-configured in Fluidd.

How to reproduce

  • Add two Moonraker URLs to endpoints array in config.json (same URL, different ports):
... Omitted...
  "endpoints": [
    "http://my.domain.local:7125",
    "http://my.domain.local:7126"
  ],
... Omitted...
  • Reload Fluidd
  • Only one instance is visible in Fluidd

Additional information

I believe this bug is caused by sanitizeEndpoint function, which does not include the port in return: https://github.com/fluidd-core/fluidd/blob/develop/src/util/sanitize-endpoint.ts#L10 . When port is missing/removed, both URLs look the same. That's why I can see only one printer in Fluidd.

liborburda avatar Sep 30 '22 23:09 liborburda

The sanitizeEndpoint is working correctly, as url.host includes the port number (hostname however does not, but that is not the case here).

We run a check on each of the endpoints to ensure they are working correctly and if not, we hide it from the list.

I would recommend you manually open each of the endpoint addresses in the browser and confirm that they are responding as expected.

pedrolamas avatar Oct 02 '22 14:10 pedrolamas

The endpoints key in the config file is only used as a list of possible backends, and the first one reachable is chosen as the entry point. This just handles automatic printer selection on first load of fluidd (e.g. when fluidd is hosted on a central server instead of on a printer's RPi), it doesn't (currently) add all reachable printers.

matmen avatar Oct 04 '22 17:10 matmen

@matmen Oh why not, I thought this was the solution to https://github.com/fluidd-core/fluidd/issues/464

napter avatar Oct 21 '22 15:10 napter

@matmen Oh why not, I thought this was the solution to #464

That actually, might not be a bad idea at all... 🤔

pedrolamas avatar Oct 24 '22 16:10 pedrolamas

This is working as intended, but we might look into making this more generic so users can add multiple printers via this interface on a later release!

pedrolamas avatar Oct 24 '22 17:10 pedrolamas