diff --git a/cmd/textsecure/.config/config.yml b/cmd/textsecure/.config/config.yml index 4f10b46..65307c3 100644 --- a/cmd/textsecure/.config/config.yml +++ b/cmd/textsecure/.config/config.yml @@ -2,7 +2,7 @@ tel: "+1771111001" #Server URL -server: https://textsecure-service.whispersystems.org:443 +server: https://chat.signal.org:443 #Server's TLS root certificate path when using a non-default server #See https://github.com/janimo/textsecure-docker#using-https diff --git a/config.go b/config.go index 4b7cbae..5bbd209 100644 --- a/config.go +++ b/config.go @@ -90,7 +90,7 @@ func loadConfig() (*config.Config, error) { } if cfg.Server == "" { - cfg.Server = "https://textsecure-service.whispersystems.org:443" + cfg.Server = "https://chat.signal.org:443" } if cfg.VerificationType == "" { diff --git a/crayfish/messages.go b/crayfish/messages.go index f5fa085..4b64dca 100644 --- a/crayfish/messages.go +++ b/crayfish/messages.go @@ -12,6 +12,7 @@ type CrayfishWebSocketRequest_VERIFY_REGISTER_MESSAGE struct { Number string `json:"number"` Password string `json:"password"` SignalingKey [52]byte `json:"signaling_key"` + Name string `json:"name"` } type CrayfishWebSocketRequestMessageTyp_SEALED_SESSION_DECRYPT_Message struct { diff --git a/crayfish/register.go b/crayfish/register.go index b4b9279..ae8fddc 100644 --- a/crayfish/register.go +++ b/crayfish/register.go @@ -53,6 +53,7 @@ func (c *CrayfishInstance) CrayfishRegisterWithCode(registrationInfo *registrati Code: codeInt, SignalingKey: signalingKey, Password: registrationInfo.Password, + Name: registrationInfo.Name, } requestVerifyType := CrayfishWebSocketRequestMessageTyp_VERIFY_REGISTRATION verificationRequest := &CrayfishWebSocketRequestMessage{ diff --git a/profiles/profile.go b/profiles/profile.go index 4cae783..092628b 100644 --- a/profiles/profile.go +++ b/profiles/profile.go @@ -203,8 +203,11 @@ func GetProfileAndCredential(UUID string, profileKey []byte) (*Profile, error) { if len(profileKey) == 0 { return nil, errors.New("profileKey is empty") } + if (len(UUID) == 0) || (UUID == "00000000-0000-0000-0000-000000000000") { + return nil, errors.New("UUID is empty") + } - log.Infoln("[textsecure] GetProfileAndCredential for " + UUID) + log.Infoln("[textsecure] GetProfileAndCredential for" + UUID) uuid, err := uuidUtil.FromString(UUID) if err != nil { log.Debugln("[textsecure] GetProfileAndCredential", err) diff --git a/registration/registration.go b/registration/registration.go index 9dc5f39..906c202 100644 --- a/registration/registration.go +++ b/registration/registration.go @@ -23,6 +23,7 @@ type RegistrationInfo struct { RegistrationID uint32 SignalingKey []byte CaptchaToken string + Name string } var Registration RegistrationInfo diff --git a/textsecure.go b/textsecure.go index ad61726..0dc7701 100644 --- a/textsecure.go +++ b/textsecure.go @@ -236,7 +236,7 @@ var ( // and environment variables func setupLogging() { loglevel := config.ConfigFile.LogLevel - if loglevel == "" { + if loglevel == "" || os.Getenv("TEXTSECURE_LOGLEVEL") != "" { loglevel = os.Getenv("TEXTSECURE_LOGLEVEL") } fmt.Printf("INFO[0000] [textsecure] Setting log level to %s\n", loglevel) @@ -250,7 +250,7 @@ func setupLogging() { case "ERROR": log.SetLevel(log.ErrorLevel) default: - log.SetLevel(log.ErrorLevel) + log.SetLevel(log.InfoLevel) } log.SetFormatter(&log.TextFormatter{ @@ -408,6 +408,8 @@ func registerDevice() error { client.GetConfig() phoneNumber := client.GetPhoneNumber() captcha := client.GetCaptchaToken() + name := client.GetUsername() + registration.Registration.Name = name err = RegisterWithCrayfish(®istration.Registration, phoneNumber, captcha) if err != nil { log.Errorln("[textsecure] Crayfish registration failed", err) @@ -421,6 +423,7 @@ func registerDevice() error { } config.ConfigFile.Tel = crayfishRegistration.Tel config.ConfigFile.UUID = crayfishRegistration.UUID + config.ConfigFile.Name = name config.ConfigFile.AccountCapabilities = config.AccountCapabilities{ // Uuid: false, Gv2: true, @@ -432,6 +435,9 @@ func registerDevice() error { } err = saveConfig(config.ConfigFile) + if err != nil { + return err + } log.Debugln("[textsecure] Crayfish registration done") transport.SetupTransporter(config.ConfigFile.Server, config.ConfigFile.UUID, registration.Registration.Password, config.ConfigFile.UserAgent, config.ConfigFile.ProxyServer)