Update API endpoint and version, set User-Agent
Helps with: https://github.com/emersion/hydroxide/issues/179
This commit is contained in:
parent
9f72034eb3
commit
b11846dbb3
|
@ -32,7 +32,7 @@ import (
|
||||||
smtpbackend "github.com/emersion/hydroxide/smtp"
|
smtpbackend "github.com/emersion/hydroxide/smtp"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultAPIEndpoint = "https://mail.protonmail.com/api"
|
const defaultAPIEndpoint = "https://mail.proton.me/api"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
debug bool
|
debug bool
|
||||||
|
@ -42,7 +42,7 @@ var (
|
||||||
func newClient() *protonmail.Client {
|
func newClient() *protonmail.Client {
|
||||||
return &protonmail.Client{
|
return &protonmail.Client{
|
||||||
RootURL: apiEndpoint,
|
RootURL: apiEndpoint,
|
||||||
AppVersion: "web-mail@4.20.8",
|
AppVersion: "web-mail@5.0.2.3",
|
||||||
Debug: debug,
|
Debug: debug,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
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
|
httpClient := c.HTTPClient
|
||||||
if httpClient == nil {
|
if httpClient == nil {
|
||||||
httpClient = http.DefaultClient
|
httpClient = http.DefaultClient
|
||||||
|
|
Loading…
Reference in New Issue