Commit Graph

29 Commits

Author SHA1 Message Date
Nick Mills-Barrett ca46d36998 media: default unknown media mime to application/octet-stream
Keeps the photo jpeg default but only for photos so we don't incorrectly
flag unknown extensions as jpegs.
2025-11-18 11:22:39 +00:00
Adam Van Ymeren 7a04f298d2 move gotd fork into repo. (#111)
- update to latest telegram layer
- remove some references to fields in tg.Entities that don't exist in
the schema
- originally added here:
https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e
  - referenced here
-
https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3
-
https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
2025-06-27 20:03:37 -07:00
Toni Spets 7e75c8ef83 media: make all media direct downloadable
The only exception is emojis.

Also changed direct download encoding field names to be more generic
when used in mixed manner depending on peer type.

Direct downloads are still somewhat inefficient as they require an API
round trip to succeed but we can cache things in the database if needed.
2025-05-07 06:43:51 +03:00
Toni Spets 483816cc2b media: Request 1MB chunks for direct media streaming
The default is 512kB and the RPC request overhead has more impact
on download speed than having half smaller chunks.

Next level speed improvement would be to use parallel downloads and
have an on-disk buffer to stream out the rebuilt file on-the-fly when
we consistent stream of data available.
2025-04-28 12:38:02 +03:00
Toni Spets 53e89441b7 media: fix lottie mime type for direct download 2025-04-25 07:38:06 +03:00
Tulir Asokan 48d91fdf76 media/sticker: fix lottie mime type
It's always gunzipped, so should never send the application/x-tgsticker mime.
Also, video/lottie+json was recently registered with IANA, so use that instead
of the old image/lottie+json: <https://www.iana.org/assignments/media-types/video/lottie+json>
2025-04-24 15:56:44 +03:00
Sumner Evans 1bc3a2538e treewide: add copyright/license notices
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2025-03-05 10:16:50 -07:00
Sumner Evans 6c7727d6b5 connector/media: fix comment
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2025-01-07 22:56:32 -07:00
Sumner Evans 655cd98f27 connector/tomatrix: fix video stickers
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2025-01-06 10:26:02 -07:00
Sumner Evans 1b4416f291 connector/media: fix transferring non-lottie stickers
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-11-06 07:02:08 -07:00
Sumner Evans 13f21a7c70 media: implement streaming for direct downloads
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-10-22 11:37:59 -06:00
Sumner Evans a573740b9a media/transfer: add function to directly download bytes
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-10-22 09:21:56 -06:00
Tulir Asokan 1c7e626c97 sticker: fix lottie conversion 2024-10-03 14:07:11 +03:00
Sumner Evans 9609f437d5 deps/mautrix: upgrade
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-10-01 10:50:25 -06:00
Sumner Evans e1a56778f5 media: default to JPEG MIME-type for direct-downloaded images
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-09-27 16:14:28 -06:00
Sumner Evans c6e96682b6 treewide: separate user and channel namespaces
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-09-25 07:16:05 -06:00
Sumner Evans 3b6af95976 connector: support messages sent by a channel
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
Co-authored-by: Tulir Asokan <tulir@maunium.net>
2024-09-03 13:34:13 -06:00
Tulir Asokan b25c09fc53 store: refactor access hash and session tables
* Move sessions to user_login metadata, as that data rarely changes after login.
* Merge user and channel access hashes. Those IDs don't conflict.
* Split usernames into a new table to allow better `ON CONFLICT` updates
  (when a username moves to another entity, we want the old row to be replaced).
  Usernames also don't need to be scoped to a login.
2024-08-22 17:54:10 +03:00
Tulir Asokan e611c87342 all: add some todos and fix small issues 2024-08-22 17:53:50 +03:00
Sumner Evans 7e2d9bbc4e avatar: fix downloading avatars
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-08-20 14:13:50 -06:00
Sumner Evans 83695b4336 directdownload: include receiver in media ID
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-08-07 11:18:59 -06:00
Sumner Evans 314b2da99f edits: bridge TG -> Matrix
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-07-19 14:33:52 -06:00
Sumner Evans 62d6145c14 stickers: support receiving and converting
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-07-10 10:45:56 -06:00
Sumner Evans 58cc638058 media: major refactor of downloading/direct URL
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-07-09 23:03:15 -06:00
Sumner Evans a63f264804 reactions: support custom emojis
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-07-09 14:04:25 -06:00
Sumner Evans 5d39fc8c5f pkg/download -> pkg/media
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-07-08 08:47:30 -06:00
Sumner Evans 16706d8338 media: support documents
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-06-20 18:42:09 -06:00
Sumner Evans 2df6f73098 disappearing images: implement
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-06-19 13:11:35 -06:00
Sumner Evans 7963e52405 direct media: implement direct download for photos
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
2024-06-19 12:47:41 -06:00