From b11846dbb34e95bdebdfb4f928bdef23efd8dca2 Mon Sep 17 00:00:00 2001 From: shrimp <55786013+shrimpyuk@users.noreply.github.com> Date: Sat, 18 Jun 2022 01:52:35 +0100 Subject: [PATCH] Update API endpoint and version, set User-Agent Helps with: https://github.com/emersion/hydroxide/issues/179 --- cmd/hydroxide/main.go | 4 ++-- protonmail/protonmail.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/hydroxide/main.go b/cmd/hydroxide/main.go index 3f74404..9cd9030 100644 --- a/cmd/hydroxide/main.go +++ b/cmd/hydroxide/main.go @@ -32,7 +32,7 @@ import ( smtpbackend "github.com/emersion/hydroxide/smtp" ) -const defaultAPIEndpoint = "https://mail.protonmail.com/api" +const defaultAPIEndpoint = "https://mail.proton.me/api" var ( debug bool @@ -42,7 +42,7 @@ var ( func newClient() *protonmail.Client { return &protonmail.Client{ RootURL: apiEndpoint, - AppVersion: "web-mail@4.20.8", + AppVersion: "web-mail@5.0.2.3", Debug: debug, } } diff --git a/protonmail/protonmail.go b/protonmail/protonmail.go index 775bff9..8093fb3 100644 --- a/protonmail/protonmail.go +++ b/protonmail/protonmail.go @@ -119,6 +119,8 @@ func (c *Client) newJSONRequest(method, path string, body interface{}) (*http.Re } func (c *Client) do(req *http.Request) (*http.Response, error) { + req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0") + httpClient := c.HTTPClient if httpClient == nil { httpClient = http.DefaultClient