Update mautrix-go to switch to /v3 paths

This commit is contained in:
Tulir Asokan 2022-04-17 13:16:47 +03:00
parent ebd0e2dabb
commit b755302b93
5 changed files with 12 additions and 9 deletions

View File

@ -1,5 +1,9 @@
# unreleased # 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 config flags for backspace behavior.
* Added `/rainbownotice` command to send a rainbow as a `m.notice` message. * Added `/rainbownotice` command to send a rainbow as a `m.notice` message.
* Added support for editing messages in an external editor. * Added support for editing messages in an external editor.

2
go.mod
View File

@ -24,7 +24,7 @@ require (
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2
gopkg.in/vansante/go-ffprobe.v2 v2.0.3 gopkg.in/vansante/go-ffprobe.v2 v2.0.3
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b 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 mvdan.cc/xurls/v2 v2.4.0
) )

4
go.sum
View File

@ -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= 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 h1:1XmIYmMd3PoQfp9J+PaHhpt80zpfmMqaShzUTC7FwY0=
maunium.net/go/maulogger/v2 v2.3.2/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A= 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.20220417095934-0eee489b6417 h1:dEJ9MKQvd4v2Rk2W6EUiO1T6PrSWPsB/JQOHQn4H6X0=
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/go.mod h1:zOor2zO/F10T/GbU67vWr0vnhLso88rlRr1HIrb1XWU=
mvdan.cc/xurls/v2 v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc= mvdan.cc/xurls/v2 v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
mvdan.cc/xurls/v2 v2.4.0/go.mod h1:+GEjq9uNjqs8LQfM9nVnM8rff0OQ5Iash5rzX+N1CSg= mvdan.cc/xurls/v2 v2.4.0/go.mod h1:+GEjq9uNjqs8LQfM9nVnM8rff0OQ5Iash5rzX+N1CSg=

View File

@ -202,7 +202,7 @@ func respondHTML(w http.ResponseWriter, status int, message string) {
} }
func (c *Container) SingleSignOn() error { 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", "redirectUrl": "http://localhost:29325",
}) })
err := open.Open(loginURL) 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) debug.Print("Failed to parse updated preferences:", err)
return return
} }
debug.Print("Updated preferences:", orig, "->", c.config.Preferences) debug.Printf("Updated preferences: %#v -> %#v", orig, c.config.Preferences)
if c.config.AuthCache.InitialSyncDone { if c.config.AuthCache.InitialSyncDone {
c.ui.HandleNewPreferences() c.ui.HandleNewPreferences()
} }
@ -472,9 +472,8 @@ func (c *Container) Preferences() *config.UserPreferences {
func (c *Container) SendPreferencesToMatrix() { func (c *Container) SendPreferencesToMatrix() {
defer debug.Recover() defer debug.Recover()
debug.Print("Sending updated preferences:", c.config.Preferences) debug.Printf("Sending updated preferences: %#v", c.config.Preferences)
u := c.client.BuildURL("user", string(c.config.UserID), "account_data", AccountDataGomuksPreferences.Type) err := c.client.SetAccountData(AccountDataGomuksPreferences.Type, &c.config.Preferences)
_, err := c.client.MakeRequest("PUT", u, &c.config.Preferences, nil)
if err != nil { if err != nil {
debug.Print("Failed to update preferences:", err) debug.Print("Failed to update preferences:", err)
} }

View File

@ -97,7 +97,7 @@ func (c *Container) UIAFallback(loginType mautrix.AuthType, sessionID string) er
}) })
go server.ListenAndServe() go server.ListenAndServe()
defer server.Close() 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, "session": sessionID,
}) })
link := url.URL{ link := url.URL{