Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix URL parsing and config #2

Merged
merged 6 commits into from
Sep 14, 2023
Merged

Fix URL parsing and config #2

merged 6 commits into from
Sep 14, 2023

Conversation

poolski
Copy link
Owner

@poolski poolski commented Sep 14, 2023

⚠️ Fix bug with websocket URL

The code wasn't:

  • Reading the base URL from the config file
  • Detecting whether we're using HTTP/HTTPS
  • Converting it into a usable ws:// URL for the dialer.

💪🏻 Improve user config input

Rather than using fmt.Scanln we can use a lightweight prompt library to hide things like the API key.

I also noticed that the code doesn't validate the URL that the user inputs so if they write some gibberish, it might not even work as a URL.

🔧 Added an insecure flag (-i | --insecure) to the app so that it can be run against Home Assistant instances which use a self-signed certificate

poolski and others added 6 commits September 14, 2023 10:03
It turns out that I'd accidentally hard-coded my own Home Assistant URL
into the dialer (no you can't access it, go away).

The actual bug, however, was that the code wasn't
- Reading the base URL from the config file
- Detecting whether we're using HTTP/HTTPS
- Converting it into a usable `ws://` URL for the dialer.

That's fixed now.
Rather than using `fmt.Scanln` we can use a lightweight prompt library
to hide things like the API key.

I also noticed that the code doesn't validate the URL that the user
inputs so if they write some gibberish, it might not even work as a URL.
@poolski poolski merged commit ba26080 into main Sep 14, 2023
1 check passed
@poolski poolski deleted the fix-urls branch September 14, 2023 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant