aboutsummaryrefslogtreecommitdiff
path: root/mediaapi
AgeCommit message (Collapse)Author
2023-07-28Send a more generic error message to clients if the file can't be found (#3161)Till
Fixes #3160
2023-07-19Use pointer when passing the connection manager around (#3152)Till
As otherwise existing connections aren't reused.
2023-06-15Fix unsafe hotserving behaviour for multimedia uploads. (#3113)Josh Qou
Return multimedia with a disposition type of attachment instead of inline. NVT#1548992 Signed-off-by: Josh Qou [jqou@icloud.com](mailto:jqou@icloud.com) Co-authored-by: Jon <haddock.05.roast@icloud.com>
2023-05-17Move MakeJoin logic to GMSL (#3081)devonh
2023-05-09Move json errors over to gmsl (#3080)devonh
2023-04-19refactor: update GMSL (#3058)kegsay
Sister PR to https://github.com/matrix-org/gomatrixserverlib/pull/364 Read this commit by commit to avoid going insane.
2023-04-06refactor: use latest GMSL which splits fed client from matrix room logic (#3051)kegsay
Part of a series of refactors on GMSL.
2023-03-22Remove `BaseDendrite` (#3023)Till
Removes `BaseDendrite` to, hopefully, make testing and composing of components easier in the future.
2023-03-20Make "m.upload.size" optionalTill Faelligen
2023-03-17Preparations for removing `BaseDendrite` (#3016)Till
Preparations to actually remove/replace `BaseDendrite`. Quite a few changes: - SyncAPI accepts an `fulltext.Indexer` interface (fulltext is removed from `BaseDendrite`) - Caches are removed from `BaseDendrite` - Introduces a `Router` struct (likely to change) - also fixes #2903 - Introduces a `sqlutil.ConnectionManager`, which should remove `base.DatabaseConnection` later on - probably more
2023-01-23Initial Store & Forward Implementation (#2917)devonh
This adds store & forward relays into dendrite for p2p. A few things have changed: - new relay api serves new http endpoints for s&f federation - updated outbound federation queueing which will attempt to forward using s&f if appropriate - database entries to track s&f relays for other nodes
2022-08-05Do not use `ioutil` as it is deprecated (#2625)Neil Alexander
2022-08-03Add Cache-Control header to media endpoints (#2612)Till
* Add Cache-Control header * Raise rate_limiting threshold to 20
2022-06-07Rate limiting changes (#2519)Neil Alexander
* Rate limiting changes This makes the following changes: * For logged in users, the rate limiting now applies to the device session rather than the remote IP address; * For non-logged in users, the rate limiting continues to apply to remote address as it does today; * It is now possible to add user IDs to the `exempt_user_ids` option under `rate_limiting` to exclude bots from rate limiting; * Admin and appservice users are now exempt from rate limiting by default. * Fix build with media API
2022-05-09🏗️ mediaapi/thumbnailer: fix build with bimg (#2440)database64128
Co-authored-by: kegsay <kegan@matrix.org>
2022-05-05Define component interfaces based on consumers (1/2) (#2423)kegsay
* Specify interfaces used by appservice, do half of clientapi * convert more deps of clientapi to finer-grained interfaces * Convert mediaapi and rest of clientapi * Somehow this got missed
2022-05-03Tidy up `AddPublicRoutes` (#2412)Neil Alexander
* Simplify federation API `AddPublicRoutes` * Simplify client API `AddPublicRoutes` * Simplify media API `AddPublicRoutes` * Simplify sync API `AddPublicRoutes` * Simplify `AddAllPublicRoutes`
2022-05-03Global database connection pool (for monolith mode) (#2411)Neil Alexander
* Allow monolith components to share a single database pool * Don't yell about missing connection strings * Rename field * Setup tweaks * Fix panic * Improve configuration checks * Update config * Fix lint errors * Update comments
2022-05-02Return `null` if MaxFileSizeBytes is 0 (#2409)Till
* Return "null" if MaxFileSizeBytes is 0 * Add comment and nil check (better save than sorry) * Simplify config
2022-04-29Fix `TestThumbnailsStorage` failing when media results come back in ↵Brian Meek
non-deterministic order; silence expected error when tests are run multiple times against the same postgres database (cherry-picked from #2395) Signed-off-by: Brian Meek <brian@hntlabs.com>
2022-04-14Refactor media storage layer, add tests (#2352)Till
* Refactor mediaapi storage layer * Verify filetype before trying to create thumbnails * Add media api storage tests * Fix returned values
2022-04-04Fix unlimitedSize uploads (#2317)S7evinK
2022-03-18Fix panic that can occur from nil pointer exception in media API ↵Neil Alexander
`fetchRemoteFile`
2022-03-16Return error from remote download requests (#2266)S7evinK
* Return error from remote download requests * Remove redundant err check, return better message if file does not exist
2022-03-04Un-ratelimit calls to /thumbnail (#2251)S7evinK
2022-03-02Media endpoints on `/v3` (#2242)Neil Alexander
* Media endpoints on `/v3` * Keep `/v1` too?
2022-01-31Tweak some logging (#2130)Neil Alexander
* Modify some log levels * Update gomatrixserverlib to matrix-org/gomatrixserverlib@336334f * Update gomatrixserverlib to matrix-org/gomatrixserverlib@cde7ac8 * Demote warning about key change producer * Add more useful roomserver logging * Further tweaking
2021-11-24Ratelimit requests to /media/r0/download|upload (#2020)S7evinK
* Add /media/r0/config handler Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Add rate limiting to media api * Rename variable * Add passing tests * Don't send multiple headers Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2021-11-02Run gofmt on dendrite - apply go 1.17 preferred build tags (#2021)PiotrKozimor
2021-11-020️⃣ Media API: Fix maxFileSizeBytes=0 handling (#1993)database64128
2021-11-02Support WebP based thumbnails (#2033)hacktivista
Co-authored-by: Felix Freeman <libsys@hacktivista.org>
2021-09-08- Removed double imports (#1989)Ryan W
- Lower cased error messages Signed-off-by: Ryan Whittington <twentybitdev@gmail.com> Co-authored-by: kegsay <kegan@matrix.org>
2021-07-20Only include go-sqlite3 on the relevant binaries (#1900)Neil Alexander
* Only include go-sqlite3 on the relevant binaries * The driver name is always sqlite3 now * Update to matrix-org/go-sqlite3-js@e537baa
2021-07-19Set MaxFileSizeBytes <= 0 to unlimited (#1876)S7evinK
* Revert "Set MaxFileSizeBytes <= 0 to "unlimited" (#1875)" This reverts commit 9ed044042156a9bdfafb4ae9830b3ed41225444e. * Actually allow unlimited upload Signed-off-by: Till Faelligen <tfaelligen@gmail.com> Co-authored-by: kegsay <kegan@matrix.org>
2021-06-22✂️ Media API: Handle unlimited file size (#1881)database64128
2021-06-14Set MaxFileSizeBytes <= 0 to "unlimited" (#1875)S7evinK
* Set MaxFileSizeBytes < 0 to "unlimited" Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * int64 overflows later in mediaapi/routing/upload.go[doUpload] * Prevent int overflow when uploading
2021-06-07Use LimitReader to prevent DoS risk (#1843)S7evinK
* Use LimitReader to prevent DoS risk Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Check if bytesWritten is equal to the maxFileSize Add tests Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Use oldschool defer to cleanup after the tests * Let LimitReader read MaxFileSizeBytes + 1 Co-authored-by: Kegsay <kegan@matrix.org>
2021-04-19Remove the 'Content-Type' request header requirement (#1834)Fero
2021-04-14Remove the Content-Length requirement on upload request (#1831)Fero
* Remove the Content-Length requirement * Make sure that the file size does not exceed max content size * Address review comment - universally check if temp file size exceeds max file size
2021-02-17Retrieve remote file size without the Content-Size header (#1537)darkgallium
* Get downloaded file size regardless of the Content-Size header Signed-off-by: Florian Le Minoux <darkgallium+git@deuxfleurs.fr> * fixing lint issues * Don't exhaust memory for large files, don't limit more than necessary * Don't use errors.Wrap in download.go Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2020-12-02Top-level setup package (#1605)Neil Alexander
* Move config, setup, mscs into "setup" top-level folder * oops, forgot the EDU server * Add setup * goimports
2020-08-28Fix #1361 (#1362)Neil Alexander
2020-08-26Port of #945 (#1343)Kegsay
- Make sure we always cleanup the temp directory on error. - Complain about it having an error prone API shape.
2020-08-25Randomly generated media IDs (#1336)Neil Alexander
* Filenames based on hashes but media IDs randomly generated and per-upload metadata * Lint * Comment generateMediaID
2020-08-21Component-wide TransactionWriters (#1290)Neil Alexander
* Offset updates take place using TransactionWriter * Refactor TransactionWriter in current state server * Refactor TransactionWriter in federation sender * Refactor TransactionWriter in key server * Refactor TransactionWriter in media API * Refactor TransactionWriter in server key API * Refactor TransactionWriter in sync API * Refactor TransactionWriter in user API * Fix deadlocking Sync API tests * Un-deadlock device database * Fix appservice API * Rename TransactionWriters to Writers * Move writers up a layer in sync API * Document sqlutil.Writer interface * Add note to Writer documentation
2020-08-19Transaction writer changes, move roomserver writers (#1285)Neil Alexander
* Updated TransactionWriters, moved locks in roomserver, various other tweaks * Fix redaction deadlocks * Fix lint issue * Rename SQLiteTransactionWriter to ExclusiveTransactionWriter * Fix us not sending transactions through in latest events updater
2020-08-13API setup refactoring (#1266)Neil Alexander
* Start HTTP endpoint refactoring * Update SetupAndServeHTTP * Fix builds * Don't set up external listener if no address configured * TLS HTTP setup * Break apart client/federation/key/media muxes * Tweaks * Fix P2P demos * Fix media API routing * Review comments @Kegsay * Update sample config * Fix gobind build * Fix External -> Public in federation API test
2020-08-10Configuration format v1 (#1230)Neil Alexander
* Initial pass at refactoring config (not finished) * Don't forget current state and EDU servers * More shifting around * Update server key API tests * Fix roomserver test * Fix more tests * Further tweaks * Fix current state server test (sort of) * Maybe fix appservices * Fix client API test * Include database connection string in database options * Fix sync API build * Update config test * Fix unit tests * Fix federation sender build * Fix gobind build * Set Listen address for all services in HTTP monolith mode * Validate config, reinstate appservice derived in directory, tweaks * Tweak federation API test * Set MaxOpenConnections/MaxIdleConnections to previous values * Update generate-config
2020-07-21Use TransactionWriter in other component SQLite (#1209)Neil Alexander
* Use TransactionWriter on other component SQLites * Fix sync API tests * Fix panic in media API * Fix a couple of transactions * Fix wrong query, add some logging output * Add debug logging into StoreEvent * Adjust InsertRoomNID * Update logging
2020-07-08Yet another v1 vs r0 media endpoint (#1190)Neil Alexander