change meowurl scheme to meow://http//url for safer uri parsing
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@ -61,23 +61,21 @@ func InvitationCheck(invitationdata []byte) *C.char {
|
||||
// invitationPassword: the password of the invitation
|
||||
func InvitationGetMessage(invitationUrl string, serverPublicKey string, invitationPassword string) ([]byte, string, error) {
|
||||
|
||||
meowurl := strings.Split(invitationUrl[7:], "?")
|
||||
meowurl := strings.Split(invitationUrl, "?")
|
||||
|
||||
serverurl := meowurl[0]
|
||||
shortcode := meowurl[1]
|
||||
srv := client.Server{}
|
||||
srv := client.CreateServerFromMeowUrl(meowurl[0])
|
||||
// check if already in msg servers
|
||||
dbsrv, err := client.GetConfig().GetIdentity().MessageServers.LoadServer(serverurl)
|
||||
dbsrv, err := client.GetConfig().GetIdentity().MessageServers.LoadServer(srv.Url)
|
||||
if err != nil {
|
||||
return nil, "InvitationGetMessage: LoadServer", err
|
||||
}
|
||||
if dbsrv == nil {
|
||||
// create a server object with url & pubkey
|
||||
srv.Url = serverurl
|
||||
srv.PublicKey = serverPublicKey
|
||||
srv.UserKp = meowlib.NewKeyPair()
|
||||
// save it
|
||||
err = client.GetConfig().GetIdentity().MessageServers.StoreServer(&srv)
|
||||
err = client.GetConfig().GetIdentity().MessageServers.StoreServer(srv)
|
||||
if err != nil {
|
||||
return nil, "InvitationGetMessage: StoreServer", err
|
||||
}
|
||||
@ -85,7 +83,7 @@ func InvitationGetMessage(invitationUrl string, serverPublicKey string, invitati
|
||||
if dbsrv.PublicKey != serverPublicKey {
|
||||
dbsrv.PublicKey = serverPublicKey
|
||||
}
|
||||
srv = *dbsrv
|
||||
srv = dbsrv
|
||||
}
|
||||
// buildserver message
|
||||
toSrvMsg, err := srv.BuildToServerMessageInvitationRequest(shortcode, invitationPassword)
|
||||
|
Reference in New Issue
Block a user