Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
feb1fd2
Describe GroupMe images and hide media URLs GroupMe adds to text
iFixRobots Oct 26, 2026
8cad42b
Bridge GroupMe voice notes
iFixRobots Oct 26, 2026
59befd1
Send video dimensions when starting a GroupMe upload
iFixRobots Oct 26, 2026
b8850d0
Strip every trailing media URL and keep DM document notices
iFixRobots Oct 26, 2026
0358ebf
Merge branch 'iFixRobots/media-info' into iFixRobots/voice-notes
iFixRobots Oct 26, 2026
a95aedc
Keep sub-second voice notes' duration
iFixRobots Oct 26, 2026
6b94a37
Merge branch 'iFixRobots/voice-notes' into iFixRobots/video-dimensions
iFixRobots Oct 26, 2026
6f39803
Never match an empty media URL
iFixRobots Oct 26, 2026
50f47e7
Merge branch 'iFixRobots/media-info' into iFixRobots/voice-notes
iFixRobots Oct 26, 2026
db76c51
Merge branch 'iFixRobots/voice-notes' into iFixRobots/video-dimensions
iFixRobots Oct 26, 2026
f03799f
Merge remote-tracking branch 'origin/main' into iFixRobots/voice-notes
iFixRobots Oct 27, 2026
45d1a91
Merge branch 'iFixRobots/voice-notes' into iFixRobots/video-dimensions
iFixRobots Oct 27, 2026
322d2bf
Merge remote-tracking branch 'origin/main' into iFixRobots/voice-notes
iFixRobots Oct 27, 2026
b8f5e6a
Merge branch 'iFixRobots/voice-notes' into iFixRobots/video-dimensions
iFixRobots Oct 27, 2026
00d3ac6
Decode comma-separated voice peaks from live DMs
Fizzadar Oct 27, 2026
075d182
Group test imports for goimports
iFixRobots Oct 27, 2026
8066ec8
Merge branch 'iFixRobots/voice-notes' into iFixRobots/video-dimensions
iFixRobots Oct 27, 2026
0531b35
Merge remote-tracking branch 'origin/main' into iFixRobots/video-dime…
iFixRobots Oct 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pkg/connector/handlematrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,16 @@ func (gc *GMClient) uploadMatrixMedia(ctx context.Context, content *event.Messag
case event.MsgVideo, event.MsgAudio:
var extension string
mimeType, extension = mediaUploadType(content, mimeType)
var groupID, recipientID string
req := groupmeext.UploadRequest{SenderId: gc.Meta.GMID, Extension: extension}
if portalType == PortalTypeDM {
recipientID = string(gmid)
req.RecipientId = string(gmid)
} else {
groupID = string(gmid)
req.GroupId = string(gmid)
}
uploaded, err := groupmeext.UploadMedia(ctx, gc.Meta.Token, gc.Meta.GMID, groupID, recipientID, data, extension, mimeType)
if content.MsgType == event.MsgVideo && content.Info != nil {
req.Width, req.Height = content.Info.Width, content.Info.Height
}
uploaded, err := groupmeext.UploadMedia(ctx, gc.Meta.Token, req, data, mimeType)
if err != nil {
return nil, wrapGroupMeError(err, "failed to upload media").WithIsCertain(true)
}
Expand Down
19 changes: 8 additions & 11 deletions pkg/groupmeext/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,15 @@ func GetFileMetadata(ctx context.Context, groupID groupme.ID, fileID, token stri
}

// Upload sessions require a group ID or recipient ID, plus size and extension.
type createUploadRequest struct {
// GroupMe's clients also send the dimensions of videos.
type UploadRequest struct {
FileSize int64 `json:"FileSize"`
SenderId string `json:"SenderId"`
Extension string `json:"Extension"`
GroupId string `json:"groupId,omitempty"`
RecipientId string `json:"recipientId,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
}

// UploadURL is a temporary signed upload destination. The other URLs are
Expand All @@ -133,16 +136,10 @@ type UploadedMedia struct {
}

// UploadMedia uploads a video or voice note: it creates a session, then PUTs
// bytes to its signed URL without GroupMe credentials. Exactly one of groupID
// and recipientID must be set.
func UploadMedia(ctx context.Context, token, senderID, groupID, recipientID string, data []byte, extension, mimeType string) (*UploadedMedia, error) {
reqBody, err := json.Marshal(createUploadRequest{
FileSize: int64(len(data)),
SenderId: senderID,
Extension: extension,
GroupId: groupID,
RecipientId: recipientID,
})
// bytes to its signed URL without GroupMe credentials.
func UploadMedia(ctx context.Context, token string, req UploadRequest, data []byte, mimeType string) (*UploadedMedia, error) {
req.FileSize = int64(len(data))
reqBody, err := json.Marshal(req)
if err != nil {
return nil, fmt.Errorf("failed to build upload session request: %w", err)
}
Expand Down
Loading