add name to server when creating from uid or url
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2024-06-05 21:07:00 +02:00
parent af55df1ff5
commit 606c42cd5e

View File

@ -39,6 +39,7 @@ type Server struct {
// CreateServerFromUrl creates a server from a basic url, ex : https://my.meowserver.example:8443/meow/ // CreateServerFromUrl creates a server from a basic url, ex : https://my.meowserver.example:8443/meow/
func CreateServerFromUrl(url string) *Server { func CreateServerFromUrl(url string) *Server {
var is Server var is Server
is.Name = url
is.Url = url is.Url = url
return &is return &is
} }
@ -47,6 +48,7 @@ func CreateServerFromUrl(url string) *Server {
func CreateServerFromUid(uid string) *Server { func CreateServerFromUid(uid string) *Server {
var is Server var is Server
uidTable := strings.Split(uid, "@") //! Weak test, use regexp uidTable := strings.Split(uid, "@") //! Weak test, use regexp
is.Name = uid
if len(uidTable) == 2 { if len(uidTable) == 2 {
loginpw := strings.Split(uidTable[0], ":") loginpw := strings.Split(uidTable[0], ":")
is.Url = uidTable[1] is.Url = uidTable[1]