From 53145f1c5ec7acfe2488d5e204a7e437f703a4be Mon Sep 17 00:00:00 2001 From: ycc Date: Tue, 26 Mar 2024 14:12:32 +0100 Subject: [PATCH] create server from uid added --- client/server.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/server.go b/client/server.go index bee5d5d..8aa46dc 100644 --- a/client/server.go +++ b/client/server.go @@ -2,6 +2,7 @@ package client import ( "fmt" + "strings" "time" "forge.redroom.link/yves/meowlib" @@ -41,6 +42,17 @@ func CreateServerFromUrl(url string) *Server { return &is } +// CreateServerFromUid creates a server from a uid string, ex : mylogin:mypassword@https://my.meowserver.example:8443/meow/ +func CreateServerFromUid(uid string) *Server { + var is Server + uidTable := strings.Split(uid, "@") + loginpw := strings.Split(uidTable[0], ":") + is.Url = uidTable[1] + is.Login = loginpw[0] + is.Password = loginpw[1] + return &is +} + // GetServerCard returns a server card from a server func (ints *Server) GetServerCard() *meowlib.ServerCard { var sc meowlib.ServerCard