cooklang / cookcli

Command line program which provides a suite of tools to create shopping lists and maintain recipes.
https://cooklang.org
MIT License
773 stars 34 forks source link

Unable to access cook server via LAN #82

Open 2096779623 opened 11 months ago

2096779623 commented 11 months ago

image It doesn't have the output like the help page. image

Access on another Android device:

~ $ curl -vvl http://192.168.1.10:9080/
*   Trying 192.168.1.10:9080...
* connect to 192.168.1.10 port 9080 failed: Connection refused
* Failed to connect to 192.168.1.10 port 9080 after 6 ms: Couldn't connect to server
* Closing connection
curl: (7) Failed to connect to 192.168.1.10 port 9080 after 6 ms: Couldn't connect to server
~ $ nmap -P0 -sV -p9080 192.168.1.10
Starting Nmap 7.94 ( https://nmap.org/ ) at 2023-11-25 12:20 CST
Nmap scan report for 192.168.1.10
Host is up (0.0048s latency).

PORT     STATE  SERVICE VERSION
9080/tcp closed glrpc

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 0.80 seconds
~ $

Chrome prompts ERR_CONNECTION_REFUSED .

dubadub commented 11 months ago

@2096779623 could you please check if it helps to start the server with --host option? Like cook server --host. Thanks!

2096779623 commented 11 months ago

Works, but it looks a bit weird and the recipes don't display properly after adding the --host parameter. Screenshot_20231125-182813_Pixel Screenshot_20231125-182809_Pixel

dubadub commented 11 months ago

Thanks for checking. Yeah, that doesn't look great... It suspiciously look like a CORS issue. I'll have a look.

igalic commented 7 months ago

please note that cook server's argument parsing is quite broken:

$ cook server 
 INFO Listening on 127.0.0.1:9080
^C INFO Stopping server
 INFO Server stopped
$ cook server .
 INFO Listening on 127.0.0.1:9080
^C INFO Stopping server
 INFO Server stopped
$ cook server --host 192.168.122.10
 INFO Listening on 0.0.0.0:9080
^C INFO Stopping server
 INFO Server stopped
$ cook server --host 127.0.0.1 
 INFO Listening on 0.0.0.0:9080
^C INFO Stopping server
 INFO Server stopped
$ cook server --host 127.0.0.1 .
error: unexpected argument '.' found

Usage: cook server [OPTIONS] [BASE_PATH]

For more information, try '--help'.
$ 

to summarize:

This confusion is probably best demonstrated when we GNU style, reverse options and arguments:

$ cook server . --host 0.0.0.0
error: unexpected argument '0.0.0.0' found

Usage: cook server [OPTIONS] [BASE_PATH]

For more information, try '--help'.
$