update deps; experiment: log security
This commit is contained in:
7
vendor/maunium.net/go/mautrix/event/events.go
generated
vendored
7
vendor/maunium.net/go/mautrix/event/events.go
generated
vendored
@@ -124,9 +124,10 @@ func (evt *Event) GetStateKey() string {
|
||||
}
|
||||
|
||||
type StrippedState struct {
|
||||
Content Content `json:"content"`
|
||||
Type Type `json:"type"`
|
||||
StateKey string `json:"state_key"`
|
||||
Content Content `json:"content"`
|
||||
Type Type `json:"type"`
|
||||
StateKey string `json:"state_key"`
|
||||
Sender id.UserID `json:"sender"`
|
||||
}
|
||||
|
||||
type Unsigned struct {
|
||||
|
||||
6
vendor/maunium.net/go/mautrix/event/message.go
generated
vendored
6
vendor/maunium.net/go/mautrix/event/message.go
generated
vendored
@@ -138,9 +138,13 @@ func (content *MessageEventContent) SetEdit(original id.EventID) {
|
||||
}
|
||||
}
|
||||
|
||||
func TextToHTML(text string) string {
|
||||
return strings.ReplaceAll(html.EscapeString(text), "\n", "<br/>")
|
||||
}
|
||||
|
||||
func (content *MessageEventContent) EnsureHasHTML() {
|
||||
if len(content.FormattedBody) == 0 || content.Format != FormatHTML {
|
||||
content.FormattedBody = strings.ReplaceAll(html.EscapeString(content.Body), "\n", "<br/>")
|
||||
content.FormattedBody = TextToHTML(content.Body)
|
||||
content.Format = FormatHTML
|
||||
}
|
||||
}
|
||||
|
||||
7
vendor/maunium.net/go/mautrix/event/relations.go
generated
vendored
7
vendor/maunium.net/go/mautrix/event/relations.go
generated
vendored
@@ -70,6 +70,13 @@ func (rel *RelatesTo) GetReplyTo() id.EventID {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (rel *RelatesTo) GetNonFallbackReplyTo() id.EventID {
|
||||
if rel != nil && rel.InReplyTo != nil && !rel.IsFallingBack {
|
||||
return rel.InReplyTo.EventID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (rel *RelatesTo) GetAnnotationID() id.EventID {
|
||||
if rel != nil && rel.Type == RelAnnotation {
|
||||
return rel.EventID
|
||||
|
||||
8
vendor/maunium.net/go/mautrix/event/reply.go
generated
vendored
8
vendor/maunium.net/go/mautrix/event/reply.go
generated
vendored
@@ -35,7 +35,7 @@ func TrimReplyFallbackText(text string) string {
|
||||
}
|
||||
|
||||
func (content *MessageEventContent) RemoveReplyFallback() {
|
||||
if len(content.GetReplyTo()) > 0 && !content.replyFallbackRemoved {
|
||||
if len(content.RelatesTo.GetReplyTo()) > 0 && !content.replyFallbackRemoved {
|
||||
if content.Format == FormatHTML {
|
||||
content.FormattedBody = TrimReplyFallbackHTML(content.FormattedBody)
|
||||
}
|
||||
@@ -44,11 +44,9 @@ func (content *MessageEventContent) RemoveReplyFallback() {
|
||||
}
|
||||
}
|
||||
|
||||
// Deprecated: RelatesTo methods are nil-safe, so RelatesTo.GetReplyTo can be used directly
|
||||
func (content *MessageEventContent) GetReplyTo() id.EventID {
|
||||
if content.RelatesTo != nil {
|
||||
return content.RelatesTo.GetReplyTo()
|
||||
}
|
||||
return ""
|
||||
return content.RelatesTo.GetReplyTo()
|
||||
}
|
||||
|
||||
const ReplyFormat = `<mx-reply><blockquote><a href="https://matrix.to/#/%s/%s">In reply to</a> <a href="https://matrix.to/#/%s">%s</a><br>%s</blockquote></mx-reply>`
|
||||
|
||||
Reference in New Issue
Block a user