diff --git a/client/helpers/invitationCheckHelper.go b/client/helpers/invitationCheckHelper.go index 5184d79..a853e44 100644 --- a/client/helpers/invitationCheckHelper.go +++ b/client/helpers/invitationCheckHelper.go @@ -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) diff --git a/client/server.go b/client/server.go index 1db3b39..c2c6e19 100644 --- a/client/server.go +++ b/client/server.go @@ -59,7 +59,7 @@ func CreateServerFromUid(uid string) *Server { // CreateServerFromMeowUrl creates a server from a meow url, ex : meow://mylogin:mypassword@https://my.meowserver.example:8443/meow/ func CreateServerFromMeowUrl(meowurl string) *Server { - uid := meowurl[7:] + uid := strings.Replace(meowurl[7:], "//", "://", 1) return CreateServerFromUid(uid) } diff --git a/go.mod b/go.mod index b32dd21..93ba362 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.32.0 github.com/stretchr/testify v1.7.0 - golang.org/x/crypto v0.21.0 // indirect + golang.org/x/crypto v0.22.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/protobuf v1.33.0 ) diff --git a/go.sum b/go.sum index e3e51fa..fe2537c 100644 --- a/go.sum +++ b/go.sum @@ -146,6 +146,8 @@ golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -205,6 +207,8 @@ golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -214,6 +218,7 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=