update deps

This commit is contained in:
Aine
2023-12-19 12:48:50 +02:00
parent fe17195bc1
commit c19c87393c
441 changed files with 11883 additions and 7230 deletions

View File

@@ -1,3 +1,13 @@
## v0.16.2 (2023-11-16)
* *(event)* Added `Redacts` field to `RedactionEventContent` for room v11+.
* *(event)* Added `ReverseTextToHTML` which reverses the changes made by
`TextToHTML` (i.e. unescapes HTML characters and replaces `<br/>` with `\n`).
* *(bridge)* Added global zerologger to ensure all logs go through the bridge
logger.
* *(bridge)* Changed encryption error messages to be sent in a thread if the
message that failed to decrypt was in a thread.
## v0.16.1 (2023-09-16)
* **Breaking change *(id)*** Updated user ID localpart encoding to not encode

View File

@@ -79,7 +79,7 @@ func (mach *OlmMachine) DecryptMegolmEvent(ctx context.Context, evt *event.Event
trustLevel = id.TrustStateUnknownDevice
} else if len(sess.ForwardingChains) == 0 || (len(sess.ForwardingChains) == 1 && sess.ForwardingChains[0] == sess.SenderKey.String()) {
if device == nil {
log.Debug().Err(err).
log.Debug().
Str("session_sender_key", sess.SenderKey.String()).
Msg("Couldn't resolve trust level of session: sent by unknown device")
trustLevel = id.TrustStateUnknownDevice

View File

@@ -48,12 +48,12 @@ const (
// RedactionEventContent represents the content of a m.room.redaction message event.
//
// The redacted event ID is still at the top level, but will move in a future room version.
// See https://github.com/matrix-org/matrix-doc/pull/2244 and https://github.com/matrix-org/matrix-doc/pull/2174
//
// https://spec.matrix.org/v1.2/client-server-api/#mroomredaction
// https://spec.matrix.org/v1.8/client-server-api/#mroomredaction
type RedactionEventContent struct {
Reason string `json:"reason,omitempty"`
// The event ID is here as of room v11. In old servers it may only be at the top level.
Redacts id.EventID `json:"redacts,omitempty"`
}
// ReactionEventContent represents the content of a m.reaction message event.
@@ -151,10 +151,18 @@ func (content *MessageEventContent) SetEdit(original id.EventID) {
}
}
// TextToHTML converts the given text to a HTML-safe representation by escaping HTML characters
// and replacing newlines with <br/> tags.
func TextToHTML(text string) string {
return strings.ReplaceAll(html.EscapeString(text), "\n", "<br/>")
}
// ReverseTextToHTML reverses the modifications made by TextToHTML, i.e. replaces <br/> tags with newlines
// and unescapes HTML escape codes. For actually parsing HTML, use the format package instead.
func ReverseTextToHTML(input string) string {
return html.UnescapeString(strings.ReplaceAll(input, "<br/>", "\n"))
}
func (content *MessageEventContent) EnsureHasHTML() {
if len(content.FormattedBody) == 0 || content.Format != FormatHTML {
content.FormattedBody = TextToHTML(content.Body)

View File

@@ -7,7 +7,7 @@ import (
"strings"
)
const Version = "v0.16.1"
const Version = "v0.16.2"
var GoModVersion = ""
var Commit = ""