mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 12:46:46 +00:00
refactor: prefer anonymous clients
This commit is contained in:
@ -340,13 +340,8 @@ func getAPIUser(client pmapi.Client, auth *pmapi.Auth, mbPassword string) (user
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = client.Unlock(hashedPassword); err != nil {
|
|
||||||
log.WithError(err).Error("Could not decrypt keyring")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if user, err = client.UpdateUser(); err != nil {
|
if user, err = client.UpdateUser(); err != nil {
|
||||||
log.WithError(err).Error("Could not update API user")
|
log.WithError(err).Error("Could not load API user")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +434,7 @@ func (b *Bridge) DeleteUser(userID string, clearStore bool) error {
|
|||||||
|
|
||||||
// ReportBug reports a new bug from the user.
|
// ReportBug reports a new bug from the user.
|
||||||
func (b *Bridge) ReportBug(osType, osVersion, description, accountName, address, emailClient string) error {
|
func (b *Bridge) ReportBug(osType, osVersion, description, accountName, address, emailClient string) error {
|
||||||
c := b.clientManager.GetClient("bug_reporter")
|
c := b.clientManager.GetAnonymousClient()
|
||||||
defer c.Logout()
|
defer c.Logout()
|
||||||
|
|
||||||
title := "[Bridge] Bug"
|
title := "[Bridge] Bug"
|
||||||
@ -463,7 +458,7 @@ func (b *Bridge) ReportBug(osType, osVersion, description, accountName, address,
|
|||||||
|
|
||||||
// SendMetric sends a metric. We don't want to return any errors, only log them.
|
// SendMetric sends a metric. We don't want to return any errors, only log them.
|
||||||
func (b *Bridge) SendMetric(m metrics.Metric) {
|
func (b *Bridge) SendMetric(m metrics.Metric) {
|
||||||
c := b.clientManager.GetClient("metric_reporter")
|
c := b.clientManager.GetAnonymousClient()
|
||||||
defer c.Logout()
|
defer c.Logout()
|
||||||
|
|
||||||
cat, act, lab := m.Get()
|
cat, act, lab := m.Get()
|
||||||
|
|||||||
@ -65,7 +65,7 @@ func GetLogEntry(packageName string) *logrus.Entry {
|
|||||||
func HandlePanic(cfg *Config, output string) {
|
func HandlePanic(cfg *Config, output string) {
|
||||||
if !cfg.IsDevMode() {
|
if !cfg.IsDevMode() {
|
||||||
// TODO: Is it okay to just create a throwaway client like this?
|
// TODO: Is it okay to just create a throwaway client like this?
|
||||||
c := pmapi.NewClientManager(cfg.GetAPIConfig()).GetClient("no-user-id")
|
c := pmapi.NewClientManager(cfg.GetAPIConfig()).GetAnonymousClient()
|
||||||
defer c.Logout()
|
defer c.Logout()
|
||||||
|
|
||||||
if err := c.ReportSentryCrash(fmt.Errorf(output)); err != nil {
|
if err := c.ReportSentryCrash(fmt.Errorf(output)); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user