todbot / blink1-tool

Command-line tools and C library for blink(1) USB RGB LED
https://blink1.thingm.com/
Other
84 stars 15 forks source link

Rest API default URL contains double slashes #8

Closed chasepeeler closed 9 months ago

chasepeeler commented 6 years ago

The default URL is http://localhost:8934/. This causes the generated URL to have double slashes, which causes issues (at least on windows):

c:\blink>blink1control-tool --off -v set dev: to rgb:0x00,0x00,0x00 over 300 msec url: http://127.0.0.1:8934//blink1/fadeToRGB?rgb=%23000000&time=0.30&ledn=0&id=`

If I load that in my browser, it displays "Cannot GET //blink1/fadeToRGB"

You can work around it by specifying the URL, without a trailing slash

c:\blink>blink1control-tool -U "http://localhost:8934" --off -v set dev: to rgb:0x00,0x00,0x00 over 300 msec url: http://localhost:8934/blink1/fadeToRGB?rgb=%23000000&time=0.30&ledn=0&id=

The incorrect default URL also causes program to crash if you specify the --list command.

todbot commented 6 years ago

Hi, Thanks for the report. Verified and preliminary fix in the repo. I'll release updated binaries shortly.