Store homeserver URL from .well-known responses

This commit is contained in:
Tulir Asokan 2021-09-19 21:34:47 -04:00
parent 2cff2cdc22
commit 9dcf3bdb12

View File

@ -163,6 +163,7 @@ func (c *Container) PasswordLogin(user, password string) error {
InitialDeviceDisplayName: "gomuks",
StoreCredentials: true,
StoreHomeserverURL: true,
})
if err != nil {
return err
@ -175,6 +176,9 @@ func (c *Container) finishLogin(resp *mautrix.RespLogin) {
c.config.UserID = resp.UserID
c.config.DeviceID = resp.DeviceID
c.config.AccessToken = resp.AccessToken
if resp.WellKnown != nil && len(resp.WellKnown.Homeserver.BaseURL) > 0 {
c.config.HS = resp.WellKnown.Homeserver.BaseURL
}
c.config.Save()
go c.Start()
@ -219,6 +223,7 @@ func (c *Container) SingleSignOn() error {
InitialDeviceDisplayName: "gomuks",
StoreCredentials: true,
StoreHomeserverURL: true,
})
if err != nil {
respondHTML(w, http.StatusForbidden, err.Error())