mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-18 08:06:59 +00:00
Add OS to app version
This commit is contained in:
committed by
Michal Horejsek
parent
f888176485
commit
9d50a8cef2
@ -21,6 +21,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/ProtonMail/go-appdir"
|
"github.com/ProtonMail/go-appdir"
|
||||||
"github.com/hashicorp/go-multierror"
|
"github.com/hashicorp/go-multierror"
|
||||||
@ -247,3 +248,17 @@ func (c *Config) GetDefaultIMAPPort() int {
|
|||||||
func (c *Config) GetDefaultSMTPPort() int {
|
func (c *Config) GetDefaultSMTPPort() int {
|
||||||
return 1025
|
return 1025
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getAPIOS returns actual operating system.
|
||||||
|
func (c *Config) getAPIOS() string {
|
||||||
|
switch os := runtime.GOOS; os {
|
||||||
|
case "darwin": // nolint: goconst
|
||||||
|
return "macOS"
|
||||||
|
case "linux":
|
||||||
|
return "Linux"
|
||||||
|
case "windows":
|
||||||
|
return "Windows"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Linux"
|
||||||
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ import (
|
|||||||
|
|
||||||
func (c *Config) GetAPIConfig() *pmapi.ClientConfig {
|
func (c *Config) GetAPIConfig() *pmapi.ClientConfig {
|
||||||
return &pmapi.ClientConfig{
|
return &pmapi.ClientConfig{
|
||||||
AppVersion: strings.Title(c.appName) + "_" + c.version,
|
AppVersion: c.getAPIOS() + strings.Title(c.appName) + "_" + c.version,
|
||||||
ClientID: c.appName,
|
ClientID: c.appName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ import (
|
|||||||
|
|
||||||
func (c *Config) GetAPIConfig() *pmapi.ClientConfig {
|
func (c *Config) GetAPIConfig() *pmapi.ClientConfig {
|
||||||
return &pmapi.ClientConfig{
|
return &pmapi.ClientConfig{
|
||||||
AppVersion: strings.Title(c.appName) + "_" + c.version,
|
AppVersion: c.getAPIOS() + strings.Title(c.appName) + "_" + c.version,
|
||||||
ClientID: c.appName,
|
ClientID: c.appName,
|
||||||
Timeout: 25 * time.Minute, // Overall request timeout (~25MB / 25 mins => ~16kB/s, should be reasonable).
|
Timeout: 25 * time.Minute, // Overall request timeout (~25MB / 25 mins => ~16kB/s, should be reasonable).
|
||||||
FirstReadTimeout: 30 * time.Second, // 30s to match 30s response header timeout.
|
FirstReadTimeout: 30 * time.Second, // 30s to match 30s response header timeout.
|
||||||
|
|||||||
Reference in New Issue
Block a user