Skip to content

Commit

Permalink
Change protocole handler for purchase redirect to nordvpn (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszWojciechO authored Jun 10, 2024
1 parent 99888a5 commit ea7a738
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
22 changes: 12 additions & 10 deletions cli/cli_click.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,21 @@ func (c *cmd) Click(ctx *cli.Context) (err error) {
return formatError(err)
}

if url.Scheme == "nordvpn-sl" && url.Host == "claim-online-purchase" {
resp, err := c.client.ClaimOnlinePurchase(context.Background(), &pb.Empty{})
if err != nil {
return formatError(err)
}
if url.Scheme == "nordvpn" {
if url.Host == "claim-online-purchase" {
resp, err := c.client.ClaimOnlinePurchase(context.Background(), &pb.Empty{})
if err != nil {
return formatError(err)
}

if !resp.Success {
return errors.New(ClaimOnlinePurchaseFailure)
}

if !resp.Success {
return errors.New(ClaimOnlinePurchaseFailure)
color.Green(ClaimOnlinePurchaseSuccess)
return nil
}

color.Green(ClaimOnlinePurchaseSuccess)
return nil
} else if url.Scheme == "nordvpn" {
// if arg is given
// run the same as: login --callback %arg
if err := c.oauth2(ctx); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions client/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const (
MsgTryAgain = "We're having trouble reaching our servers. Please try again later. If the issue persists, please contact our customer support."
UFWDisabledMessage = "The active UFW firewall on your system prevents us from setting up our firewall properly. We have disabled UFW for the duration of your VPN connection and enabled our firewall to ensure your online security. Your custom UFW rules are imported to our firewall ruleset."

SubscriptionURL = "https://my.nordaccount.com/plans/?product_group=nordvpn&login_target=nordvpn&utm_source=linux&utm_medium=app&utm_campaign=desktop-app&redirect_uri=nordvpn-sl://claim-online-purchase"
SubscriptionURLLogin = "https://my.nordaccount.com/plans/?product_group=nordvpn&login_target=nordvpn&utm_source=linux&utm_medium=app&utm_campaign=desktop-app&trusted_pass_token=%s&owner_id=%s&redirect_uri=nordvpn-sl://claim-online-purchase"
SubscriptionURL = "https://my.nordaccount.com/plans/?product_group=nordvpn&login_target=nordvpn&utm_source=linux&utm_medium=app&utm_campaign=desktop-app&redirect_uri=nordvpn://claim-online-purchase"
SubscriptionURLLogin = "https://my.nordaccount.com/plans/?product_group=nordvpn&login_target=nordvpn&utm_source=linux&utm_medium=app&utm_campaign=desktop-app&trusted_pass_token=%s&owner_id=%s&redirect_uri=nordvpn://claim-online-purchase"
SubscriptionDedicatedIPURL = "https://my.nordaccount.com/dashboard/nordvpn/dedicatedip/?product_group=nordvpn&utm_source=linux&utm_medium=in-app&utm_campaign=desktop-app"
SubscriptionDedicatedIPURLLogin = "https://my.nordaccount.com/dashboard/nordvpn/dedicatedip/?product_group=nordvpn&utm_source=linux&utm_medium=in-app&utm_campaign=desktop-app&trusted_pass_token=%s&owner_id=%s"
)
2 changes: 1 addition & 1 deletion contrib/desktop/nordvpn.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Type=Application
Name=NordVPN
Comment=The best online VPN service for speed and security.
Icon=nordvpn
MimeType=x-scheme-handler/nordvpn;x-scheme-handler/nordvpn-sl
MimeType=x-scheme-handler/nordvpn
Exec=nordvpn click %u
Terminal=true

0 comments on commit ea7a738

Please sign in to comment.