forked from Silverfish/proton-bridge
Other: Add launcher flag to ensure bridge starts
This commit is contained in:
@ -36,11 +36,14 @@ const (
|
||||
flagCLI = "cli"
|
||||
flagCLIShort = "c"
|
||||
|
||||
flagNoWindow = "no-window"
|
||||
flagNonInteractive = "non-interactive"
|
||||
|
||||
flagLogIMAP = "log-imap"
|
||||
flagLogSMTP = "log-smtp"
|
||||
|
||||
// Hidden flags
|
||||
flagLauncher = "launcher"
|
||||
flagNoWindow = "no-window"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -74,9 +77,8 @@ func New() *cli.App {
|
||||
Usage: "Use command line interface",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: flagNoWindow,
|
||||
Usage: "Don't show window after start",
|
||||
Hidden: true,
|
||||
Name: flagNonInteractive,
|
||||
Usage: "Run the app in non-interactive mode",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: flagLogIMAP,
|
||||
@ -86,6 +88,18 @@ func New() *cli.App {
|
||||
Name: flagLogSMTP,
|
||||
Usage: "Enable logging of SMTP communications (may contain decrypted data!)",
|
||||
},
|
||||
|
||||
// Hidden flags
|
||||
&cli.BoolFlag{
|
||||
Name: flagNoWindow,
|
||||
Usage: "Don't show window after start",
|
||||
Hidden: true,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: flagLauncher,
|
||||
Usage: "The launcher used to start the app",
|
||||
Hidden: true,
|
||||
},
|
||||
}
|
||||
|
||||
app.Action = run
|
||||
|
||||
@ -43,7 +43,7 @@ var (
|
||||
KeyChainName = "bridge"
|
||||
|
||||
// Version of the build.
|
||||
Version = "2.4.0+git"
|
||||
Version = "2.4.1+git"
|
||||
|
||||
// AppVersion is the full rendered version of the app (to be used in request headers).
|
||||
AppVersion = getAPIOS() + cases.Title(language.Und).String(ConfigName) + "_" + Version
|
||||
|
||||
@ -356,8 +356,8 @@ func (s *Service) Login(ctx context.Context, login *LoginRequest) (*emptypb.Empt
|
||||
|
||||
go func() {
|
||||
defer s.panicHandler.HandlePanic()
|
||||
var password []byte
|
||||
_, err := base64.StdEncoding.Decode(password, login.Password)
|
||||
|
||||
password, err := base64Decode(login.Password)
|
||||
if err != nil {
|
||||
s.log.WithError(err).Error("Cannot decode password")
|
||||
_ = s.SendEvent(NewLoginError(LoginErrorType_USERNAME_PASSWORD_ERROR, "Cannot decode password"))
|
||||
@ -593,3 +593,14 @@ func (s *Service) CurrentKeychain(ctx context.Context, _ *emptypb.Empty) (*wrapp
|
||||
|
||||
return wrapperspb.String(helper), nil
|
||||
}
|
||||
|
||||
func base64Decode(in []byte) ([]byte, error) {
|
||||
out := make([]byte, base64.StdEncoding.DecodedLen(len(in)))
|
||||
|
||||
n, err := base64.StdEncoding.Decode(out, in)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return out[:n], nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user