Update API endpoint and version, set User-Agent

Helps with:
https://github.com/emersion/hydroxide/issues/179
This commit is contained in:
shrimp 2022-06-18 01:52:35 +01:00 committed by Simon Ser
parent 9f72034eb3
commit b11846dbb3
2 changed files with 4 additions and 2 deletions

View File

@ -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,
}
}

View File

@ -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