forked from Silverfish/proton-bridge
Other: require go 1.18 and update to golangci-lint to latest revision + fixes.
This commit is contained in:
@ -24,13 +24,16 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
// hostURL uniquely identifies the app's keychain items within the system keychain.
|
||||
func hostURL(keychainName string) string {
|
||||
// Skip when it was in-app update and not manual
|
||||
if path, err := os.Executable(); err == nil && strings.Contains(path, "ProtonMail Bridge") {
|
||||
return fmt.Sprintf("ProtonMail%vService", strings.Title(keychainName))
|
||||
return fmt.Sprintf("ProtonMail%vService", cases.Title(language.Und).String(keychainName))
|
||||
}
|
||||
return fmt.Sprintf("Proton Mail %v", strings.Title(keychainName))
|
||||
return fmt.Sprintf("Proton Mail %v", cases.Title(language.Und).String(keychainName))
|
||||
}
|
||||
|
||||
@ -19,7 +19,9 @@ package pmapi
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@ -47,7 +49,7 @@ type Config struct {
|
||||
func NewConfig(appVersionName, appVersion string) Config {
|
||||
return Config{
|
||||
HostURL: getRootURL(),
|
||||
AppVersion: getAPIOS() + strings.Title(appVersionName) + "_" + appVersion,
|
||||
AppVersion: getAPIOS() + cases.Title(language.Und).String(appVersionName) + "_" + appVersion,
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +63,7 @@ func (c *Config) getUserAgent() string {
|
||||
// getAPIOS returns actual operating system.
|
||||
func getAPIOS() string {
|
||||
switch os := runtime.GOOS; os {
|
||||
case "darwin": // nolint: goconst
|
||||
case "darwin": // nolint: const
|
||||
return "macOS"
|
||||
case "linux":
|
||||
return "Linux"
|
||||
|
||||
Reference in New Issue
Block a user