diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d6d43f..ad9e553 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # unreleased +* Bumped minimum Go version to 1.17. +* Switched from `/r0` to `/v3` paths everywhere. + * The new `v3` paths are implemented since Synapse 1.48, Dendrite 0.6.5, + and Conduit 0.4.0. Servers older than these are no longer supported. * Added config flags for backspace behavior. * Added `/rainbownotice` command to send a rainbow as a `m.notice` message. * Added support for editing messages in an external editor. diff --git a/go.mod b/go.mod index 3b2972f..6002cc3 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 gopkg.in/vansante/go-ffprobe.v2 v2.0.3 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b - maunium.net/go/mautrix v0.10.13-0.20220415172627-597a9560f721 + maunium.net/go/mautrix v0.10.13-0.20220417095934-0eee489b6417 mvdan.cc/xurls/v2 v2.4.0 ) diff --git a/go.sum b/go.sum index bd560fd..394ace7 100644 --- a/go.sum +++ b/go.sum @@ -110,7 +110,7 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= maunium.net/go/maulogger/v2 v2.3.2 h1:1XmIYmMd3PoQfp9J+PaHhpt80zpfmMqaShzUTC7FwY0= maunium.net/go/maulogger/v2 v2.3.2/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A= -maunium.net/go/mautrix v0.10.13-0.20220415172627-597a9560f721 h1:QuCkJp2siYbXtZPStpYqPZ9Cz6yFCEVOGkBkmUchg7M= -maunium.net/go/mautrix v0.10.13-0.20220415172627-597a9560f721/go.mod h1:zOor2zO/F10T/GbU67vWr0vnhLso88rlRr1HIrb1XWU= +maunium.net/go/mautrix v0.10.13-0.20220417095934-0eee489b6417 h1:dEJ9MKQvd4v2Rk2W6EUiO1T6PrSWPsB/JQOHQn4H6X0= +maunium.net/go/mautrix v0.10.13-0.20220417095934-0eee489b6417/go.mod h1:zOor2zO/F10T/GbU67vWr0vnhLso88rlRr1HIrb1XWU= mvdan.cc/xurls/v2 v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc= mvdan.cc/xurls/v2 v2.4.0/go.mod h1:+GEjq9uNjqs8LQfM9nVnM8rff0OQ5Iash5rzX+N1CSg= diff --git a/matrix/matrix.go b/matrix/matrix.go index a7b012c..1db1587 100644 --- a/matrix/matrix.go +++ b/matrix/matrix.go @@ -202,7 +202,7 @@ func respondHTML(w http.ResponseWriter, status int, message string) { } func (c *Container) SingleSignOn() error { - loginURL := c.client.BuildURLWithQuery(mautrix.URLPath{"login", "sso", "redirect"}, map[string]string{ + loginURL := c.client.BuildURLWithQuery(mautrix.ClientURLPath{"v3", "login", "sso", "redirect"}, map[string]string{ "redirectUrl": "http://localhost:29325", }) err := open.Open(loginURL) @@ -460,7 +460,7 @@ func (c *Container) HandlePreferences(source mautrix.EventSource, evt *event.Eve debug.Print("Failed to parse updated preferences:", err) return } - debug.Print("Updated preferences:", orig, "->", c.config.Preferences) + debug.Printf("Updated preferences: %#v -> %#v", orig, c.config.Preferences) if c.config.AuthCache.InitialSyncDone { c.ui.HandleNewPreferences() } @@ -472,9 +472,8 @@ func (c *Container) Preferences() *config.UserPreferences { func (c *Container) SendPreferencesToMatrix() { defer debug.Recover() - debug.Print("Sending updated preferences:", c.config.Preferences) - u := c.client.BuildURL("user", string(c.config.UserID), "account_data", AccountDataGomuksPreferences.Type) - _, err := c.client.MakeRequest("PUT", u, &c.config.Preferences, nil) + debug.Printf("Sending updated preferences: %#v", c.config.Preferences) + err := c.client.SetAccountData(AccountDataGomuksPreferences.Type, &c.config.Preferences) if err != nil { debug.Print("Failed to update preferences:", err) } diff --git a/matrix/uia-fallback.go b/matrix/uia-fallback.go index 6b2e42a..f958ba1 100644 --- a/matrix/uia-fallback.go +++ b/matrix/uia-fallback.go @@ -97,7 +97,7 @@ func (c *Container) UIAFallback(loginType mautrix.AuthType, sessionID string) er }) go server.ListenAndServe() defer server.Close() - authURL := c.client.BuildURLWithQuery(mautrix.URLPath{"auth", loginType, "fallback", "web"}, map[string]string{ + authURL := c.client.BuildURLWithQuery(mautrix.ClientURLPath{"v3", "auth", loginType, "fallback", "web"}, map[string]string{ "session": sessionID, }) link := url.URL{