fix: Upgrade status-go to the most recent version of release branch which contains memory fix

Fix #4990
This commit is contained in:
Michal Iskierko
2024-05-13 12:21:03 +02:00
committed by Michał Iskierko
parent 03d490156a
commit 66cf3d21b9
230 changed files with 30930 additions and 14243 deletions

View File

@@ -0,0 +1,11 @@
package common
type CodeControlFlags struct {
// AutoRequestHistoricMessages indicates whether we should automatically request
// historic messages on getting online, connecting to store node, etc.
AutoRequestHistoricMessages bool
// CuratedCommunitiesUpdateLoopEnabled indicates whether we should disable the curated communities update loop.
// Usually should be disabled in tests.
CuratedCommunitiesUpdateLoopEnabled bool
}

View File

@@ -26,8 +26,4 @@ type FeatureFlags struct {
// Peersyncing indicates whether we should advertise and sync messages with other peers
Peersyncing bool
// AutoRequestHistoricMessages indicates whether we should automatically request
// historic messages on getting online, connecting to store node, etc.
AutoRequestHistoricMessages bool
}

View File

@@ -49,6 +49,7 @@ type QuotedMessage struct {
DeletedForMe bool `json:"deletedForMe,omitempty"`
DiscordMessage *protobuf.DiscordMessage `json:"discordMessage,omitempty"`
BridgeMessage *protobuf.BridgeMessage `json:"bridgeMessage,omitempty"`
}
type CommandState int

View File

@@ -15,8 +15,8 @@ type MakeMediaServerURLType func(msgID string, previewURL string, imageID MediaS
type MakeMediaServerURLMessageWrapperType func(previewURL string, imageID MediaServerImageID) string
type LinkPreviewThumbnail struct {
Width int `json:"width"`
Height int `json:"height"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
// Non-empty when the thumbnail is available via the media server, i.e. after
// the chat message is sent.
URL string `json:"url,omitempty"`
@@ -31,6 +31,7 @@ type LinkPreview struct {
Hostname string `json:"hostname"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Favicon LinkPreviewThumbnail `json:"favicon,omitempty"`
Thumbnail LinkPreviewThumbnail `json:"thumbnail,omitempty"`
}
@@ -288,12 +289,19 @@ func (m *Message) ConvertLinkPreviewsToProto() ([]*protobuf.UnfurledLink, error)
return nil, fmt.Errorf("invalid link preview, url='%s': %w", preview.URL, err)
}
var payload []byte
var thumbnailPayload []byte
var faviconPayload []byte
var err error
if preview.Thumbnail.DataURI != "" {
payload, err = images.GetPayloadFromURI(preview.Thumbnail.DataURI)
thumbnailPayload, err = images.GetPayloadFromURI(preview.Thumbnail.DataURI)
if err != nil {
return nil, fmt.Errorf("could not get data URI payload, url='%s': %w", preview.URL, err)
return nil, fmt.Errorf("could not get data URI payload for link preview thumbnail, url='%s': %w", preview.URL, err)
}
}
if preview.Favicon.DataURI != "" {
faviconPayload, err = images.GetPayloadFromURI(preview.Favicon.DataURI)
if err != nil {
return nil, fmt.Errorf("could not get data URI payload for link preview favicon, url='%s': %w", preview.URL, err)
}
}
@@ -304,7 +312,8 @@ func (m *Message) ConvertLinkPreviewsToProto() ([]*protobuf.UnfurledLink, error)
Description: preview.Description,
ThumbnailWidth: uint32(preview.Thumbnail.Width),
ThumbnailHeight: uint32(preview.Thumbnail.Height),
ThumbnailPayload: payload,
ThumbnailPayload: thumbnailPayload,
FaviconPayload: faviconPayload,
}
unfurledLinks = append(unfurledLinks, ul)
}
@@ -312,7 +321,8 @@ func (m *Message) ConvertLinkPreviewsToProto() ([]*protobuf.UnfurledLink, error)
return unfurledLinks, nil
}
func (m *Message) ConvertFromProtoToLinkPreviews(makeMediaServerURL func(msgID string, previewURL string) string) []LinkPreview {
func (m *Message) ConvertFromProtoToLinkPreviews(makeThumbnailMediaServerURL func(msgID string, previewURL string) string,
makeFaviconMediaServerURL func(msgID string, previewURL string) string) []LinkPreview {
var links []*protobuf.UnfurledLink
if links = m.GetUnfurledLinks(); links == nil {
@@ -340,13 +350,20 @@ func (m *Message) ConvertFromProtoToLinkPreviews(makeMediaServerURL func(msgID s
}
mediaURL := ""
if len(link.ThumbnailPayload) > 0 {
mediaURL = makeMediaServerURL(m.ID, link.Url)
mediaURL = makeThumbnailMediaServerURL(m.ID, link.Url)
}
if link.GetThumbnailPayload() != nil {
lp.Thumbnail.Width = int(link.ThumbnailWidth)
lp.Thumbnail.Height = int(link.ThumbnailHeight)
lp.Thumbnail.URL = mediaURL
}
faviconMediaURL := ""
if len(link.FaviconPayload) > 0 {
faviconMediaURL = makeFaviconMediaServerURL(m.ID, link.Url)
}
if link.GetFaviconPayload() != nil {
lp.Favicon.URL = faviconMediaURL
}
previews = append(previews, lp)
}

View File

@@ -82,7 +82,8 @@ type MessageSender struct {
ephemeralKeysMutex sync.Mutex
// messageEventsSubscriptions contains all the subscriptions for message events
messageEventsSubscriptions []chan<- *MessageEvent
messageEventsSubscriptions []chan<- *MessageEvent
messageEventsSubscriptionsMutex sync.Mutex
featureFlags FeatureFlags
@@ -114,6 +115,9 @@ func NewMessageSender(
}
func (s *MessageSender) Stop() {
s.messageEventsSubscriptionsMutex.Lock()
defer s.messageEventsSubscriptionsMutex.Unlock()
for _, c := range s.messageEventsSubscriptions {
close(c)
}
@@ -1184,6 +1188,10 @@ func (s *MessageSender) notifyOnSentMessage(sentMessage *SentMessage) {
Type: MessageSent,
SentMessage: sentMessage,
}
s.messageEventsSubscriptionsMutex.Lock()
defer s.messageEventsSubscriptionsMutex.Unlock()
// Publish on channels, drop if buffer is full
for _, c := range s.messageEventsSubscriptions {
select {
@@ -1202,6 +1210,9 @@ func (s *MessageSender) notifyOnScheduledMessage(recipient *ecdsa.PublicKey, mes
RawMessage: message,
}
s.messageEventsSubscriptionsMutex.Lock()
defer s.messageEventsSubscriptionsMutex.Unlock()
// Publish on channels, drop if buffer is full
for _, c := range s.messageEventsSubscriptions {
select {