GODT-1260: Renaming

* Renaming GUI, CLI, no-impact config.
* License header and documentation rebranding.
* Rename app title and vendor. Impact: manual install
* Migrating mac keychain and launch on startup.
* Fix linter and linter renaming
This commit is contained in:
Jakub
2022-04-05 15:50:21 +02:00
parent e353dc554d
commit f3c69faf8b
542 changed files with 3220 additions and 2981 deletions

View File

@ -56,7 +56,6 @@ linters:
- godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false] - godox # Tool for detection of FIXME, TODO and other comment keywords [fast: true, auto-fix: false]
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true] - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true, auto-fix: true] - goimports # Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true, auto-fix: true]
- golint # Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes [fast: true, auto-fix: false]
- gosec # Inspects source code for security problems [fast: true, auto-fix: false] - gosec # Inspects source code for security problems [fast: true, auto-fix: false]
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true] - misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false] - nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]

View File

@ -2,8 +2,7 @@
By making a contribution to this project: By making a contribution to this project:
1. I assign any and all copyright related to the contribution to 1. I assign any and all copyright related to the contribution to Proton AG;
Proton Technologies AG;
2. I certify that the contribution was created in whole by me; 2. I certify that the contribution was created in whole by me;
3. I understand and agree that this project and the contribution are public 3. I understand and agree that this project and the contribution are public
and that a record of the contribution (including all personal information I and that a record of the contribution (including all personal information I

View File

@ -1,5 +1,5 @@
# Copying # Copying
Copyright (c) 2022 Proton Technologies AG Copyright (c) 2022 Proton AG
Proton Mail Bridge is free software: you can redistribute it and/or modify it Proton Mail Bridge is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free under the terms of the GNU General Public License as published by the Free

View File

@ -1,5 +1,5 @@
# Proton Mail Bridge and Import Export app # Proton Mail Bridge and Import Export app
Copyright (c) 2020 Proton Technologies AG Copyright (c) 2022 Proton AG
This repository holds the Proton Mail Bridge and the Proton Mail Import-Export applications. This repository holds the Proton Mail Bridge and the Proton Mail Import-Export applications.
For a detailed build information see [BUILDS](./BUILDS.md). For a detailed build information see [BUILDS](./BUILDS.md).

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -44,7 +44,7 @@ const (
exeName = "proton-bridge" exeName = "proton-bridge"
) )
func main() { // nolint[funlen] func main() { //nolint:funlen
reporter := sentry.NewReporter(appName, constants.Version, useragent.New()) reporter := sentry.NewReporter(appName, constants.Version, useragent.New())
crashHandler := crash.NewHandler(reporter.ReportException) crashHandler := crash.NewHandler(reporter.ReportException)
@ -98,7 +98,7 @@ func main() { // nolint[funlen]
logrus.WithError(err).Fatal("Failed to determine path to launcher") logrus.WithError(err).Fatal("Failed to determine path to launcher")
} }
cmd := exec.Command(exe, appendLauncherPath(launcher, os.Args[1:])...) // nolint[gosec] cmd := exec.Command(exe, appendLauncherPath(launcher, os.Args[1:])...) //nolint:gosec
cmd.Stdin = os.Stdin cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -34,7 +34,7 @@ import (
) )
var ( var (
log = logrus.WithField("pkg", "api") //nolint[gochecknoglobals] log = logrus.WithField("pkg", "api") //nolint:gochecknoglobals
) )
type apiServer struct { type apiServer struct {
@ -44,7 +44,7 @@ type apiServer struct {
} }
// NewAPIServer returns prepared API server struct. // NewAPIServer returns prepared API server struct.
func NewAPIServer(settings *settings.Settings, eventListener listener.Listener) *apiServer { //nolint[golint] func NewAPIServer(settings *settings.Settings, eventListener listener.Listener) *apiServer { //nolint:revive
return &apiServer{ return &apiServer{
host: bridge.Host, host: bridge.Host,
settings: settings, settings: settings,
@ -68,7 +68,7 @@ func (api *apiServer) ListenAndServe() {
api.eventListener.Emit(events.ErrorEvent, "API failed: "+err.Error()) api.eventListener.Emit(events.ErrorEvent, "API failed: "+err.Error())
log.Error("API failed: ", err) log.Error("API failed: ", err)
} }
defer server.Close() //nolint[errcheck] defer server.Close() //nolint:errcheck
} }
func (api *apiServer) getAddress() string { func (api *apiServer) getAddress() string {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -42,7 +42,7 @@ func CheckOtherInstanceAndFocus(port int) error {
if err != nil { if err != nil {
return err return err
} }
defer resp.Body.Close() //nolint[errcheck] defer resp.Body.Close() //nolint:errcheck
if resp.StatusCode != 200 { if resp.StatusCode != 200 {
log.Error("Focus error: ", resp.StatusCode) log.Error("Focus error: ", resp.StatusCode)

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -102,7 +102,7 @@ type Base struct {
teardown []func() error // actions to perform when app is exiting teardown []func() error // actions to perform when app is exiting
} }
func New( // nolint[funlen] func New( //nolint:funlen
appName, appName,
appUsage, appUsage,
configName, configName,
@ -159,6 +159,14 @@ func New( // nolint[funlen]
return nil, api.CheckOtherInstanceAndFocus(settingsObj.GetInt(settings.APIPortKey)) return nil, api.CheckOtherInstanceAndFocus(settingsObj.GetInt(settings.APIPortKey))
} }
if err := migrateMacKeychainBefore220(settingsObj, keychainName); err != nil {
logrus.WithError(err).Warn("Keychain migration failed")
}
if err := migrateStartup220(settingsObj); err != nil {
logrus.WithError(err).Warn("Failed to remove old startup paths")
}
cachePath, err := locations.ProvideCachePath() cachePath, err := locations.ProvideCachePath()
if err != nil { if err != nil {
return nil, err return nil, err
@ -324,7 +332,7 @@ func (b *Base) AddTeardownAction(fn func() error) {
b.teardown = append(b.teardown, fn) b.teardown = append(b.teardown, fn)
} }
func (b *Base) wrapMainLoop(appMainLoop func(*Base, *cli.Context) error) cli.ActionFunc { // nolint[funlen] func (b *Base) wrapMainLoop(appMainLoop func(*Base, *cli.Context) error) cli.ActionFunc { //nolint:funlen
return func(c *cli.Context) error { return func(c *cli.Context) error {
defer b.CrashHandler.HandlePanic() defer b.CrashHandler.HandlePanic()
defer func() { _ = b.Lock.Close() }() defer func() { _ = b.Lock.Close() }()

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -18,11 +18,16 @@
package base package base
import ( import (
"errors"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"github.com/Masterminds/semver/v3"
"github.com/ProtonMail/proton-bridge/internal/config/settings"
"github.com/ProtonMail/proton-bridge/internal/constants" "github.com/ProtonMail/proton-bridge/internal/constants"
"github.com/ProtonMail/proton-bridge/internal/locations" "github.com/ProtonMail/proton-bridge/internal/locations"
"github.com/ProtonMail/proton-bridge/pkg/keychain"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
@ -50,7 +55,7 @@ func migrateFiles(configName string) error {
if err := migrateCacheFromBoth15xAnd16x(locations, userCacheDir); err != nil { if err := migrateCacheFromBoth15xAnd16x(locations, userCacheDir); err != nil {
return err return err
} }
if err := migrateUpdatesFrom16x(configName, locations); err != nil { //nolint[revive] It is more clear to structure this way if err := migrateUpdatesFrom16x(configName, locations); err != nil { //nolint:revive It is more clear to structure this way
return err return err
} }
return nil return nil
@ -107,6 +112,122 @@ func migrateUpdatesFrom16x(configName string, locations *locations.Locations) er
return moveIfExists(oldUpdatesPath, newUpdatesPath) return moveIfExists(oldUpdatesPath, newUpdatesPath)
} }
// migrateMacKeychainBefore220 deals with write access restriction to mac
// keychain passwords which are caused by application renaming. The old
// passwords are copied under new name in order to have write access afer
// renaming.
func migrateMacKeychainBefore220(settingsObj *settings.Settings, keychainName string) error {
l := logrus.WithField("pkg", "app/base/migration")
if runtime.GOOS != "darwin" {
return nil
}
if shouldContinue, err := isBefore220(settingsObj); !shouldContinue || err != nil {
return err
}
l.Warn("Migrating mac keychain")
helperConstructor, ok := keychain.Helpers["macos-keychain"]
if !ok {
return errors.New("cannot find macos-keychain helper")
}
oldKC, err := helperConstructor("ProtonMailBridgeService")
if err != nil {
l.WithError(err).Error("Keychain constructor failed")
return err
}
idByURL, err := oldKC.List()
if err != nil {
l.WithError(err).Error("List old keychain failed")
return err
}
newKC, err := keychain.NewKeychain(settingsObj, keychainName)
if err != nil {
return err
}
for url, id := range idByURL {
li := l.WithField("id", id).WithField("url", url)
userID, secret, err := oldKC.Get(url)
if err != nil {
li.WithField("userID", userID).
WithField("err", err).
Error("Faild to get old item")
continue
}
if _, _, err := newKC.Get(userID); err == nil {
li.Warn("Skipping migration, item already exists.")
continue
}
if err := newKC.Put(userID, secret); err != nil {
li.WithError(err).Error("Failed to migrate user")
}
li.Info("Item migrated")
}
return nil
}
// migrateStartup220 removes old startup links. The creation of new links is
// handled by bridge initialisation.
func migrateStartup220(settingsObj *settings.Settings) error {
if shouldContinue, err := isBefore220(settingsObj); !shouldContinue || err != nil {
return err
}
logrus.WithField("pkg", "app/base/migration").Warn("Migrating autostartup links")
path, err := os.UserHomeDir()
if err != nil {
return err
}
switch runtime.GOOS {
case "windows":
path = filepath.Join(path, `AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ProtonMail Bridge.lnk`)
case "linux":
path = filepath.Join(path, `.config/autostart/ProtonMail Bridge.desktop`)
case "darwin":
path = filepath.Join(path, `Library/LaunchAgents/ProtonMail Bridge.plist`)
default:
return errors.New("unknown GOOS")
}
return os.Remove(path)
}
// isBefore220 decide if last used version was older than 2.2.0. If cannot decide it returns false with error.
func isBefore220(settingsObj *settings.Settings) (bool, error) {
lastUsedVersion := settingsObj.Get(settings.LastVersionKey)
// Skipping migration: it is first bridge start or cache was cleared.
if lastUsedVersion == "" {
return false, nil
}
v220 := semver.MustParse("2.2.0")
lastVer, err := semver.NewVersion(lastUsedVersion)
// Skipping migration: Should not happen but cannot decide what to do.
if err != nil {
return false, err
}
// Skipping migration: 2.2.0>= was already used hence old stuff was already migrated.
if !lastVer.LessThan(v220) {
return false, nil
}
return true, nil
}
func moveIfExists(source, destination string) error { func moveIfExists(source, destination string) error {
l := logrus.WithField("source", source).WithField("destination", destination) l := logrus.WithField("source", source).WithField("destination", destination)

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -43,7 +43,7 @@ func (b *Base) restartApp(crash bool) error {
WithField("args", args). WithField("args", args).
Warn("Restarting") Warn("Restarting")
return exec.Command(b.command, args...).Start() // nolint[gosec] return exec.Command(b.command, args...).Start() //nolint:gosec
} }
// incrementRestartFlag increments the value of the restart flag. // incrementRestartFlag increments the value of the restart flag.

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -69,7 +69,7 @@ func New(base *base.Base) *cli.App {
return app return app
} }
func mailLoop(b *base.Base, c *cli.Context) error { // nolint[funlen] func mailLoop(b *base.Base, c *cli.Context) error { //nolint:funlen
tlsConfig, err := loadTLSConfig(b) tlsConfig, err := loadTLSConfig(b)
if err != nil { if err != nil {
return err return err

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -40,7 +40,7 @@ import (
logrus "github.com/sirupsen/logrus" logrus "github.com/sirupsen/logrus"
) )
var log = logrus.WithField("pkg", "bridge") //nolint[gochecknoglobals] var log = logrus.WithField("pkg", "bridge") //nolint:gochecknoglobals
var ErrLocalCacheUnavailable = errors.New("local cache is unavailable") var ErrLocalCacheUnavailable = errors.New("local cache is unavailable")

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -153,7 +153,7 @@ func zipFiles(filenames []string) (io.Reader, error) {
buf := NewLimitedBuffer(MaxAttachmentSize) buf := NewLimitedBuffer(MaxAttachmentSize)
w := zip.NewWriter(buf) w := zip.NewWriter(buf)
defer w.Close() //nolint[errcheck] defer w.Close() //nolint:errcheck
for _, file := range filenames { for _, file := range filenames {
err := addFileToZip(file, w) err := addFileToZip(file, w)
@ -174,7 +174,7 @@ func addFileToZip(filename string, writer *zip.Writer) error {
if err != nil { if err != nil {
return err return err
} }
defer fileReader.Close() //nolint[errcheck] defer fileReader.Close() //nolint:errcheck,gosec
fileInfo, err := fileReader.Stat() fileInfo, err := fileReader.Stat()
if err != nil { if err != nil {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -61,7 +61,7 @@ func (p *keyValueStore) load() error {
if err != nil { if err != nil {
return err return err
} }
defer f.Close() //nolint[errcheck] defer f.Close() //nolint:errcheck,gosec
return json.NewDecoder(f).Decode(&p.cache) return json.NewDecoder(f).Decode(&p.cache)
} }

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -89,7 +89,7 @@ func (s *Settings) setDefaultValues() {
s.setDefault(ReportOutgoingNoEncKey, "false") s.setDefault(ReportOutgoingNoEncKey, "false")
s.setDefault(LastVersionKey, "") s.setDefault(LastVersionKey, "")
s.setDefault(UpdateChannelKey, "") s.setDefault(UpdateChannelKey, "")
s.setDefault(RolloutKey, fmt.Sprintf("%v", rand.Float64())) //nolint[gosec] G404 It is OK to use weak random number generator here s.setDefault(RolloutKey, fmt.Sprintf("%v", rand.Float64())) //nolint:gosec // G404 It is OK to use weak random number generator here
s.setDefault(PreferredKeychainKey, "") s.setDefault(PreferredKeychainKey, "")
s.setDefault(CacheEnabledKey, "true") s.setDefault(CacheEnabledKey, "true")
s.setDefault(CacheCompressionKey, "true") s.setDefault(CacheCompressionKey, "true")

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -20,7 +20,7 @@ package tls
import "os/exec" import "os/exec"
func addTrustedCert(certPath string) error { func addTrustedCert(certPath string) error {
return exec.Command( // nolint[gosec] return exec.Command( //nolint:gosec
"/usr/bin/security", "/usr/bin/security",
"execute-with-privileges", "execute-with-privileges",
"/usr/bin/security", "/usr/bin/security",
@ -34,7 +34,7 @@ func addTrustedCert(certPath string) error {
} }
func removeTrustedCert(certPath string) error { func removeTrustedCert(certPath string) error {
return exec.Command( // nolint[gosec] return exec.Command( //nolint:gosec
"/usr/bin/security", "/usr/bin/security",
"execute-with-privileges", "execute-with-privileges",
"/usr/bin/security", "/usr/bin/security",

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -55,7 +55,7 @@ func NewTLSTemplate() (*x509.Certificate, error) {
SerialNumber: serialNumber, SerialNumber: serialNumber,
Subject: pkix.Name{ Subject: pkix.Name{
Country: []string{"CH"}, Country: []string{"CH"},
Organization: []string{"Proton Technologies AG"}, Organization: []string{"Proton AG"},
OrganizationalUnit: []string{"Proton Mail"}, OrganizationalUnit: []string{"Proton Mail"},
CommonName: "127.0.0.1", CommonName: "127.0.0.1",
}, },
@ -110,7 +110,7 @@ func (t *TLS) GenerateCerts(template *x509.Certificate) error {
if err != nil { if err != nil {
return err return err
} }
defer certOut.Close() // nolint[errcheck] defer certOut.Close() //nolint:errcheck,gosec
if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil { if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil {
return err return err
@ -120,7 +120,7 @@ func (t *TLS) GenerateCerts(template *x509.Certificate) error {
if err != nil { if err != nil {
return err return err
} }
defer keyOut.Close() // nolint[errcheck] defer keyOut.Close() //nolint:errcheck,gosec
return pem.Encode(keyOut, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)}) return pem.Encode(keyOut, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)})
} }
@ -144,7 +144,7 @@ func (t *TLS) GetConfig() (*tls.Config, error) {
caCertPool := x509.NewCertPool() caCertPool := x509.NewCertPool()
caCertPool.AddCert(c.Leaf) caCertPool.AddCert(c.Leaf)
// nolint[gosec]: We need to support older TLS versions for AppleMail and Outlook. //nolint:gosec // We need to support older TLS versions for AppleMail and Outlook
return &tls.Config{ return &tls.Config{
Certificates: []tls.Certificate{c}, Certificates: []tls.Certificate{c},
ServerName: "127.0.0.1", ServerName: "127.0.0.1",

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge.Bridge. // This file is part of Proton Mail Bridge.Bridge.
// //
@ -22,7 +22,7 @@ import "fmt"
const VendorName = "protonmail" const VendorName = "protonmail"
// nolint[gochecknoglobals] //nolint:gochecknoglobals
var ( var (
// Version of the build. // Version of the build.
Version = "" Version = ""

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -15,14 +15,15 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>. // along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
//go:build !build_qa
// +build !build_qa // +build !build_qa
package constants package constants
import "time" import "time"
// nolint[gochecknoglobals] //nolint:gochecknoglobals
var ( var (
// UpdateCheckInterval defines how often we check for new version // UpdateCheckInterval defines how often we check for new version.
UpdateCheckInterval = time.Hour //nolint[gochecknoglobals] UpdateCheckInterval = time.Hour //nolint:gochecknoglobals
) )

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -15,13 +15,14 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>. // along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
//go:build build_qa
// +build build_qa // +build build_qa
package constants package constants
import "time" import "time"
// nolint[gochecknoglobals] //nolint:gochecknoglobals
var ( var (
// UpdateCheckInterval defines how often we check for new version // UpdateCheckInterval defines how often we check for new version
UpdateCheckInterval = time.Duration(5 * time.Minute) UpdateCheckInterval = time.Duration(5 * time.Minute)

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -88,7 +88,7 @@ func (f *frontendCLI) showAccountAddressInfo(user types.User, address string) {
f.Println("") f.Println("")
} }
func (f *frontendCLI) loginAccount(c *ishell.Context) { // nolint[funlen] func (f *frontendCLI) loginAccount(c *ishell.Context) { //nolint:funlen
f.ShowPrompt(false) f.ShowPrompt(false)
defer f.ShowPrompt(true) defer f.ShowPrompt(true)

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -31,7 +31,7 @@ import (
) )
var ( var (
log = logrus.WithField("pkg", "frontend/cli") //nolint[gochecknoglobals] log = logrus.WithField("pkg", "frontend/cli") //nolint:gochecknoglobals
) )
type frontendCLI struct { type frontendCLI struct {
@ -47,7 +47,7 @@ type frontendCLI struct {
} }
// New returns a new CLI frontend configured with the given options. // New returns a new CLI frontend configured with the given options.
func New( //nolint[funlen] func New( //nolint:funlen
panicHandler types.PanicHandler, panicHandler types.PanicHandler,
locations *locations.Locations, locations *locations.Locations,
@ -56,7 +56,7 @@ func New( //nolint[funlen]
updater types.Updater, updater types.Updater,
bridge types.Bridger, bridge types.Bridger,
restarter types.Restarter, restarter types.Restarter,
) *frontendCLI { //nolint[golint] ) *frontendCLI { //nolint:revive
fe := &frontendCLI{ fe := &frontendCLI{
Shell: ishell.New(), Shell: ishell.New(),

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -29,7 +29,7 @@ import (
) )
var ( var (
currentPort = "" //nolint[gochecknoglobals] currentPort = "" //nolint:gochecknoglobals
) )
func (f *frontendCLI) restart(c *ishell.Context) { func (f *frontendCLI) restart(c *ishell.Context) {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -29,7 +29,7 @@ const (
) )
var ( var (
bold = color.New(color.Bold).SprintFunc() //nolint[gochecknoglobals] bold = color.New(color.Bold).SprintFunc() //nolint:gochecknoglobals
) )
func isNotEmpty(val string) bool { func isNotEmpty(val string) bool {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -34,7 +34,7 @@ type AutoConfig interface {
} }
var ( var (
available = map[string]AutoConfig{} //nolint[gochecknoglobals] available = map[string]AutoConfig{} //nolint:gochecknoglobals
ErrNotAvailable = errors.New("configuration not available") ErrNotAvailable = errors.New("configuration not available")
) )

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>. // along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
//go:build darwin
// +build darwin // +build darwin
package clientconfig package clientconfig
@ -38,7 +39,7 @@ const (
bigSurPreferncesPane = "/System/Library/PreferencePanes/Profiles.prefPane" bigSurPreferncesPane = "/System/Library/PreferencePanes/Profiles.prefPane"
) )
func init() { //nolint[gochecknoinit] func init() { //nolint:gochecknoinit
available[AppleMailClient] = &appleMail{} available[AppleMailClient] = &appleMail{}
} }
@ -55,10 +56,10 @@ func (c *appleMail) Configure(imapPort, smtpPort int, imapSSL, smtpSSL bool, use
} }
if useragent.IsBigSurOrNewer() { if useragent.IsBigSurOrNewer() {
return exec.Command("open", bigSurPreferncesPane, confPath).Run() //nolint[gosec] G204: open command is safe, mobileconfig is generated by us return exec.Command("open", bigSurPreferncesPane, confPath).Run() //nolint:gosec G204: open command is safe, mobileconfig is generated by us
} }
return exec.Command("open", confPath).Run() //nolint[gosec] G204: open command is safe, mobileconfig is generated by us return exec.Command("open", confPath).Run() //nolint:gosec G204: open command is safe, mobileconfig is generated by us
} }
func prepareMobileConfig(imapPort, smtpPort int, imapSSL, smtpSSL bool, user types.User, address string) *mobileconfig.Config { func prepareMobileConfig(imapPort, smtpPort int, imapSSL, smtpSSL bool, user types.User, address string) *mobileconfig.Config {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -34,6 +34,7 @@ QtObject {
} }
property var backend property var backend
property var title: "Proton Mail Bridge"
property Notifications _notifications: Notifications { property Notifications _notifications: Notifications {
id: notifications id: notifications
@ -47,6 +48,7 @@ QtObject {
id: mainWindow id: mainWindow
visible: false visible: false
title: root.title
backend: root.backend backend: root.backend
notifications: root._notifications notifications: root._notifications
@ -67,6 +69,7 @@ QtObject {
id: statusWindow id: statusWindow
visible: false visible: false
title: root.title
backend: root.backend backend: root.backend
notifications: root._notifications notifications: root._notifications

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //
@ -28,7 +28,6 @@ import "tests"
ApplicationWindow { ApplicationWindow {
id: root id: root
title: "ProtonMail Bridge"
width: 960 width: 960
height: 576 height: 576

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021 Proton Technologies AG # Copyright (c) 2021 Proton AG
# #
# This file is part of Proton Mail Bridge. # This file is part of Proton Mail Bridge.
# #

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

View File

@ -1,4 +1,4 @@
// Copyright (c) 2022 Proton Technologies AG // Copyright (c) 2022 Proton AG
// //
// This file is part of Proton Mail Bridge. // This file is part of Proton Mail Bridge.
// //

Some files were not shown because too many files have changed in this diff Show More