mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2026-02-11 11:38:33 +00:00
GODT-1381: Use in-memory cache in case local cache is unavailable
- change: refactor GUI notification object - add: global bridge errors - add: when cache on disk cannot be initialized fallback to memory cache - add: show notification for CoD failure - change: do not allow login to IMAP and SMTP when CoD init failed
This commit is contained in:
@ -39,6 +39,7 @@ import (
|
||||
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
||||
"github.com/ProtonMail/proton-bridge/internal/events"
|
||||
"github.com/ProtonMail/proton-bridge/internal/users"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/listener"
|
||||
"github.com/emersion/go-imap"
|
||||
goIMAPBackend "github.com/emersion/go-imap/backend"
|
||||
@ -168,6 +169,10 @@ func (ib *imapBackend) Login(_ *imap.ConnInfo, username, password string) (goIMA
|
||||
// Called from go-imap in goroutines - we need to handle panics for each function.
|
||||
defer ib.panicHandler.HandlePanic()
|
||||
|
||||
if ib.bridge.HasError(bridge.ErrLocalCacheUnavailable) {
|
||||
return nil, users.ErrLoggedOutUser
|
||||
}
|
||||
|
||||
imapUser, err := ib.getUser(username)
|
||||
if err != nil {
|
||||
log.WithError(err).Warn("Cannot get user")
|
||||
|
||||
@ -30,6 +30,7 @@ type cacheProvider interface {
|
||||
|
||||
type bridger interface {
|
||||
GetUser(query string) (bridgeUser, error)
|
||||
HasError(err error) bool
|
||||
}
|
||||
|
||||
type bridgeUser interface {
|
||||
|
||||
Reference in New Issue
Block a user