The HTTP handlers in the components are split into reader and writer directories. This was a fairly arbitrary distinction, and turns out to not be so helpful. Most read APIs have a corresponding write API, and it is more natural for them to be in the same file rather than in different directories.
* Specify HTTP methods for the client API
* Specify HTTP methods for the federation API
* Specify HTTP methods for the media API
* Specify HTTP methods for the sync API
* Add prefixes to namespace the SQL tables.
This means that multiple components can share a single database schema
without colliding with each other.
Once this lands it will be possible to run a single monolithic dendrite
against a single postgresql schema.
Hopefully this will make trivial deployments and development easier.
* Comment
This makes it possible to setup all the component APIs on a single http
listener which is necessary if we want to combine all the components
into a single monolith.
* Move all the dendrite config in to a single place
* Add tests for config parsing
* replace syncserver config with common config
* Replace client API config with common config
* Replace federation API config with common config
* Replace media api config with common config
* Replace room server config with common config
* Remove unused readKey function
* Fix the integration tests
* Comment on hardcoding roomserver to HTTP
* Add a method for getting RoomServerURL
This moves the hardcoding of HTTPs into one place.
* cmd/mediaapi-integration-tests: Add foundation for testing
* common/test: Add some server init and client request utilities
* common/test/client: Handle timed out requests for tests that passed
* cmd/syncserver-integration-tests: Port to new common/test infra
* common/test/client: Remove stray debug print
* cmd/mediaapi-integration-tests: Simplify slice initialisation
* cmd/mediaapi-integration-tests: Simplify getMediaURL argument
* cmd/mediaapi-integration-tests: Make startMediaAPI return listen address
* common/test/client: Fix uninitialised LastRequestErr
* common/test/server: Remove redundant argument
* common/test/server: Add StartProxy to create a reverse proxy
* cmd/mediaapi-integration-tests: Add proxies in front of servers
This is needed so that origins can be correctly configured and used for
remote media.
* travis: Enable media API integration tests
* travis: Build the client-api-proxy for media tests
* common/test/client: Don't panic on EOF in CanonicalJSONInput
* cmd/mediaapi-integration-tests: Add upload/download/thumbnail tests
* mediaapi/thumbnailer: Store thumbnail according to requested size
* cmd/mediaapi-integration-tests: Add totem.jpg test file
* cmd/client-api-proxy: Optionally listen for HTTPS
* common/test/client: Do not verify TLS certs for testing
We will commonly use self-signed certs.
* cmd/mediaapi-integration-tests: Make HTTPS requests
* cmd/mediaapi-integration-tests: Log size and method for thumbnails
* mediaapi/thumbnailer: Factor out isThumbnailExists
Appease gocyclo^w^w simplify
* mediaapi/thumbnailer: Check if request is larger than original
* travis: Install openssl and generate server.{crt,key}
* cmd/mediaapi-integration-tests: Add valid dynamic thumbnail test
* cmd/mediaapi-integration-tests: Document state of tests
* cmd/mediaapi-integration-tests: Test remote thumbnail before download
This ordering also exercises the cold cache immediate generation of a
size configured for pregeneration.
* travis: Explain openssl key+cert generation
* common/test/server: Clarify postgresContainerName
* vendor: Add bimg image processing library
bimg is MIT licensed. It depends on the C library libvips which is LGPL
v2.1+ licensed. libvips must be installed separately.
* mediaapi: Add YAML config file support
* mediaapi: Add thumbnail support
* mediaapi: Add missing thumbnail files
* travis: Add ppa and install libvips-dev
* travis: Another ppa and install libvips-dev attempt
* travis: Add sudo: required for sudo apt* usage
* mediaapi/thumbnailer: Make comparison code more readable
* mediaapi: Simplify logging of thumbnail properties
* mediaapi/thumbnailer: Rename metrics to fitness
Metrics is used in the context of monitoring with Prometheus so renaming
to avoid confusion.
* mediaapi/thumbnailer: Use math.Inf() for max aspect and size
* mediaapi/thumbnailer: Limit number of parallel generators
Fall back to selecting from already-/pre-generated thumbnails or serving
the original.
* mediaapi/thumbnailer: Split bimg code into separate file
* vendor: Add github.com/nfnt/resize pure go image scaler
* mediaapi/thumbnailer: Add nfnt/resize thumbnailer
* travis: Don't install libvips-dev via ppa
* mediaapi: Add notes to README about resizers
* mediaapi: Elaborate on scaling libs in README
Avoid locking around db requests by only locking around active requests
and always creating an active request if there is none. A nice side
effect of this is that if many parallel requests for remote media come
in (a common case) then only one database query is made for the duration
of the query.
Content-Disposition is only used for communicating the filename. It does
not need to be stored in the database as we have upload_name anyway. It
does not need to be in types.MediaMetadata and does not need to be
logged.
Reorder functions to have public API functions in alphabetical order at
the top, internal package functions at the bottom in call order.
Use RawURLEncoding to avoid padding the hash with '='.
Use stronger types for paths in public API.
Simplify comments.