create server from uid added
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2024-03-26 14:12:32 +01:00
parent 6867086c4f
commit 53145f1c5e

View File

@ -2,6 +2,7 @@ package client
import ( import (
"fmt" "fmt"
"strings"
"time" "time"
"forge.redroom.link/yves/meowlib" "forge.redroom.link/yves/meowlib"
@ -41,6 +42,17 @@ func CreateServerFromUrl(url string) *Server {
return &is 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 // GetServerCard returns a server card from a server
func (ints *Server) GetServerCard() *meowlib.ServerCard { func (ints *Server) GetServerCard() *meowlib.ServerCard {
var sc meowlib.ServerCard var sc meowlib.ServerCard