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"
|
flagCLI = "cli"
|
||||||
flagCLIShort = "c"
|
flagCLIShort = "c"
|
||||||
|
|
||||||
flagNoWindow = "no-window"
|
|
||||||
flagNonInteractive = "non-interactive"
|
flagNonInteractive = "non-interactive"
|
||||||
|
|
||||||
flagLogIMAP = "log-imap"
|
flagLogIMAP = "log-imap"
|
||||||
flagLogSMTP = "log-smtp"
|
flagLogSMTP = "log-smtp"
|
||||||
|
|
||||||
|
// Hidden flags
|
||||||
|
flagLauncher = "launcher"
|
||||||
|
flagNoWindow = "no-window"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -74,9 +77,8 @@ func New() *cli.App {
|
|||||||
Usage: "Use command line interface",
|
Usage: "Use command line interface",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: flagNoWindow,
|
Name: flagNonInteractive,
|
||||||
Usage: "Don't show window after start",
|
Usage: "Run the app in non-interactive mode",
|
||||||
Hidden: true,
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: flagLogIMAP,
|
Name: flagLogIMAP,
|
||||||
@ -86,6 +88,18 @@ func New() *cli.App {
|
|||||||
Name: flagLogSMTP,
|
Name: flagLogSMTP,
|
||||||
Usage: "Enable logging of SMTP communications (may contain decrypted data!)",
|
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
|
app.Action = run
|
||||||
|
|||||||
@ -43,7 +43,7 @@ var (
|
|||||||
KeyChainName = "bridge"
|
KeyChainName = "bridge"
|
||||||
|
|
||||||
// Version of the build.
|
// 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 is the full rendered version of the app (to be used in request headers).
|
||||||
AppVersion = getAPIOS() + cases.Title(language.Und).String(ConfigName) + "_" + Version
|
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() {
|
go func() {
|
||||||
defer s.panicHandler.HandlePanic()
|
defer s.panicHandler.HandlePanic()
|
||||||
var password []byte
|
|
||||||
_, err := base64.StdEncoding.Decode(password, login.Password)
|
password, err := base64Decode(login.Password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log.WithError(err).Error("Cannot decode password")
|
s.log.WithError(err).Error("Cannot decode password")
|
||||||
_ = s.SendEvent(NewLoginError(LoginErrorType_USERNAME_PASSWORD_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
|
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