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

bind to 0.0.0.0 instead of localhost #295

Merged
merged 2 commits into from
Dec 3, 2023
Merged

Conversation

lleadbet
Copy link
Contributor

@lleadbet lleadbet commented Dec 3, 2023

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Problem/Feature

The twitch token -u command was broken on WSL2 machines as it bound to localhost by default. Unfortunately this lead to the case where the webserver was local to the WSL2 image only, thus being inaccessible to the Windows host itself.

This now binds the webserver to 0.0.0.0 by default, and then allows this to be overridden by passing the --ip flag whilst not affecting the rediect URL as it was before using a new --redirect-host.

Description of Changes:

  • Adds new --redirect-host flag that allows for changing the redirect URL without affecting the webserver binding
  • Documented the changes

Checklist

  • My code follows the Contribution Guide
  • I have self-reviewed the changes being requested
  • I have made comments on pieces of code that may be difficult to understand for other editors
  • I have updated the documentation (if applicable)

@lleadbet lleadbet requested a review from Xemdo December 3, 2023 20:09
@@ -80,7 +82,7 @@ func loginCmdRun(cmd *cobra.Command, args []string) error {
p.URL = login.ValidateTokenURL
r, err := login.ValidateCredentials(p)
if err != nil {
return fmt.Errorf("Failed to validate: %v", err.Error())
return fmt.Errorf("failed to validate: %v", err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Xemdo Did you still want to keep this uppercase or lowercase?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lowercase is fine, since it matches Twitch's errors returned over HTTP. However since this is on console, it doesn't really matter too much as long as its readable.

@Xemdo Xemdo merged commit c35214b into main Dec 3, 2023
8 checks passed
@lleadbet lleadbet deleted the fix/login-server-binding branch December 3, 2023 22:15
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.

3 participants