cs01 / termpair

View and control terminals from your browser with end-to-end encryption 🔒
MIT License
1.61k stars 72 forks source link

Running termpair serve defaults to port 80 but termpair share uses port 8000? #38

Closed 1Mark closed 3 years ago

1Mark commented 3 years ago

Seems that somehow termpair share defaults to port 80 somehow

Window 1

$ pipx run termpair serve

INFO: Started server process [218] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://localhost:8000 (Press CTRL+C to quit)

Window 2

$ pipx run termpair share -b

Traceback (most recent call last): File "/home/mark/.local/pipx/.cache/b0d871b0f692059/bin/termpair", line 8, in sys.exit(main()) File "/home/mark/.local/pipx/.cache/b0d871b0f692059/lib/python3.8/site-packages/termpair/main.py", line 109, in main asyncio.get_event_loop().run_until_complete( File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "/home/mark/.local/pipx/.cache/b0d871b0f692059/lib/python3.8/site-packages/termpair/share.py", line 231, in broadcast_terminal async with websockets.connect(ws_endpoint, ssl=ssl_context) as ws: File "/home/mark/.local/pipx/.cache/b0d871b0f692059/lib/python3.8/site-packages/websockets/client.py", line 517, in aenter return await self File "/home/mark/.local/pipx/.cache/b0d871b0f692059/lib/python3.8/site-packages/websockets/client.py", line 535, in __await_impl__ transport, protocol = await self._create_connection() File "/usr/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection raise exceptions[0] File "/usr/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection sock = await self._connect_sock( File "/usr/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock await self.sock_connect(sock, address) File "/usr/lib/python3.8/asyncio/selector_events.py", line 494, in sock_connect return await fut File "/usr/lib/python3.8/asyncio/selector_events.py", line 526, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 80)

use -p 8000 for both commands fixes the issue, but it makes me wonder if this is a bug or -p should be mandatory?

same issue after running pipx install termpair (so it's not to do with using pipx run)

$ pipx runpip termpair freeze

aiofiles==0.5.0 cffi==1.14.3 click==7.1.2 cryptography==3.1.1 fastapi==0.61.1 h11==0.11.0 pkg-resources==0.0.0 pycparser==2.20 pydantic==1.6.1 six==1.15.0 starlette==0.13.6 termpair==0.1.0.2 uvicorn==0.12.1 websockets==8.1

cs01 commented 3 years ago

Thanks for the report. I agree making the default ports match would make it more usable. I'll add in the future, unless someone beats me to it with a pull request.