sabaatworld / HyperionScreenCap

Screen capture program for Hyperion ambilight. Updated to support DirectX 11, multiple displays and multiple Hyperion servers.
MIT License
120 stars 20 forks source link

API only accessable via localhost:port #28

Open sualfred opened 5 years ago

sualfred commented 5 years ago

I want to add Hyperion in some home automation integration to start/stop the capturing. This could easily be done via the HTTP commands, but I only can access them on the device which is running the screen capture application and by using "localhost".

works: localhost:port/API?command=STATE

doesn't work: 127.0.0.1:port/API?command=STATE 192.168.2.245:port/API?command=STATE

Could you please take a look into this? Thanks.

perebusquets commented 2 years ago

Hi, I'm having the same issue, the problem is probably that the hostname of the server is set as localhost. This means it only grabs responds if the incoming request URL is also localhost.

I believe the way to fix this would be to change it to 0.0.0.0 in the code, which means it the request URL doesn't matter (it accepts all of them) or allowing users to set their own hostname.

I don't have the tooling installed so I can't check if it works and submit a PR...

sabaatworld commented 2 years ago

I can make the change in early Jan since I'm currently travelling.

sabaatworld commented 2 years ago

I've released a new version today which should fix the issue. Let me know if it works for you.

perebusquets commented 2 years ago

Sorry I was busy and couldn't check it until now, it still doesn't work if the request comes from another device. I've checked that I can do a request on another HTTP server on the same machine, so I'm sure it isn't something network related