This commit is contained in:
parent
1398c6040a
commit
0070a64d5f
@ -45,11 +45,15 @@ func CreateServerFromUrl(url string) *Server {
|
|||||||
// CreateServerFromUid creates a server from a uid string, ex : mylogin:mypassword@https://my.meowserver.example:8443/meow/
|
// CreateServerFromUid creates a server from a uid string, ex : mylogin:mypassword@https://my.meowserver.example:8443/meow/
|
||||||
func CreateServerFromUid(uid string) *Server {
|
func CreateServerFromUid(uid string) *Server {
|
||||||
var is Server
|
var is Server
|
||||||
uidTable := strings.Split(uid, "@")
|
uidTable := strings.Split(uid, "@") //! Weak test, use regexp
|
||||||
|
if len(uidTable) == 2 {
|
||||||
loginpw := strings.Split(uidTable[0], ":")
|
loginpw := strings.Split(uidTable[0], ":")
|
||||||
is.Url = uidTable[1]
|
is.Url = uidTable[1]
|
||||||
is.Login = loginpw[0]
|
is.Login = loginpw[0]
|
||||||
is.Password = loginpw[1]
|
is.Password = loginpw[1]
|
||||||
|
} else {
|
||||||
|
is.Url = uidTable[0]
|
||||||
|
}
|
||||||
return &is
|
return &is
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user