aboutsummaryrefslogtreecommitdiff
path: root/clientapi
AgeCommit message (Collapse)Author
2020-07-03Implement local redaction (#1182)Kegsay
* Create redaction events and apply checks (but do not send them) * Send redactions to the roomserver * Linting * Slightly better wording
2020-07-03Yggdrasil demo initial public room directory (#1181)Neil Alexander
* Don't return null to public directory request * Initial support for finding public rooms in Yggdrasil demo (incomplete) * Increase QUIC idle time to 15 minutes
2020-07-03Implement ExtraPublicRoomsProvider for p2p demos (#1180)Kegsay
* Change API and rename to ExtraPublicRoomsProvider * Make dendritejs work again * Maybe make libp2p demo work again * Linting
2020-07-02Remove publicroomsapi (#1176)Kegsay
* Remove all of publicroomsapi * Remove references to publicroomsapi * Remove doc references to publicroomsapi
2020-07-02Replace publicroomsapi with a combination of ↵Kegsay
clientapi/roomserver/currentstateserver (#1174) * Use content_value instead of membership * Fix build * Replace publicroomsapi with a combination of clientapi/roomserver/currentstateserver - All public rooms paths are now handled by clientapi - Requests to (un)publish rooms are sent to the roomserver via `PerformPublish` which are stored in a new `published_table.go` - Requests for public rooms are handled in clientapi by: * Fetch all room IDs which are published using `QueryPublishedRooms` on the roomserver. * Apply pagination parameters to the slice. * Do a `QueryBulkStateContent` request to the currentstateserver to pull out required state event *content* (not entire events). * Aggregate and return the chunk. Mostly but not fully implemented (DB queries on currentstateserver are missing) * Fix pq query * Make postgres work * Make sqlite work * Fix tests * Unbreak pagination tests * Linting
2020-06-30Remove membership table from account DB (#1172)Kegsay
* Remove membership table from account DB And make code which needs that data use the currentstate server * Unbreak tests; use a membership enum for space
2020-06-26Implement /sync `limited` and read timeline limit from stored filters (#1168)Kegsay
* Move filter table to syncapi where it is used * Implement /sync `limited` and read timeline limit from stored filters We now fully handle `room.timeline.limit` filters (in-line + stored) and return the right value for `limited` syncs. * Update whitelist * Default to the default timeline limit if it's unset, also strip the extra event correctly * Update whitelist
2020-06-26Honour event size limits and return 413 (#1167)Kegsay
2020-06-25Return remote errors from FS.PerformJoin (#1164)Kegsay
* Return remote errors from FS.PerformJoin Follows the same pattern as PerformJoin on roomserver (no error return). Also return the right format for incompatible room version errors. Makes a bunch of tests pass! * Handle network errors better when returning remote HTTP errors * Linting * Fix tests * Update whitelist, pass network errors through in API=1 mode
2020-06-24Refactor SendMembership - make ban test pass (#1160)Kegsay
* Refactor SendMembership - make ban test pass * Only check invite auth events for local invites
2020-06-24Add PerformInvite and refactor how errors get handled (#1158)Kegsay
* Add PerformInvite and refactor how errors get handled - Rename `JoinError` to `PerformError` - Remove `error` from the API function signature entirely. This forces errors to be bundled into `PerformError` which makes it easier for callers to detect and handle errors. On network errors, HTTP clients will make a `PerformError`. * Unbreak everything; thanks Go! * Send back JSONResponse according to the PerformError * Update federation invite code too
2020-06-24Pass join errors through internal API boundaries (#1157)Kegsay
* Pass join errors through internal API boundaries Required for certain invite sytests. We will need to think of a better way of handling this going forwards. * Include m.room.avatar in stripped state; handle trailing slashes when GETing state events * Update whitelist * Update whitelist
2020-06-19Bind build support, further Yggdrasil demo updates (#1152)Neil Alexander
* Add gobind builds for Yggdrasil demo * Massage client API a bit * Fix build * Fix gobind build * Fix gobind client API setup * Tweaks * Tweaks * Update sytest-whitelist, add comment * Default to sending push rules on initial sync
2020-06-18Refactor account data (#1150)Neil Alexander
* Refactor account data * Tweak database fetching * Tweaks * Restore syncProducer notification * Various tweaks, update tag behaviour * Fix initial sync
2020-06-17Hacks for supporting Riot iOS (#1148)Neil Alexander
* Join room body is optional * Support deprecated login by user/password * Implement dummy key upload endpoint * Make a very determinate end to /messages if we hit the create event in back-pagination * Linting
2020-06-17Make account data sytests pass (#1147)Kegsay
2020-06-17Return the correct /joined_members response and allow ?format=event (#1146)Kegsay
2020-06-17Move account/device DBs to userapi (#1141)Kegsay
2020-06-17Make userapi control account creation entirely (#1139)Kegsay
This makes a chokepoint with which we can finally fix 'database is locked' errors on sqlite during account creation
2020-06-16BREAKING: Make eduserver/appservice use userapi (#1138)Kegsay
* BREAKING: Make eduserver/appservice use userapi This is a breaking change because this PR restructures how the AS API tracks its position in Kafka streams. Previously, it used the account DB to store partition offsets. However, this is also being used by `clientapi` for the same purpose, which is bad (each component needs to store offsets independently or else you might lose messages across restarts). This PR changes this behaviour to now store partition offsets in the `appservice` database. This means that: - Upon restart, the `appservice` component will attempt to replay all room events from the beginning of time. - An additional table will be created in the appservice database, which in and of itself is backwards compatible. * Return ErrorConflict
2020-06-16Make userapi responsible for checking access tokens (#1133)Kegsay
* Make userapi responsible for checking access tokens There's still plenty of dependencies on account/device DBs, but this is a start. This is a breaking change as it adds a required config value `listen.user_api`. * Cleanup * Review comments and test fix
2020-06-15Current wiring (#1125)Kegsay
* Current wiring * Add ServerKeyAPI lines
2020-06-12Rehuffle where things are in the internal package (#1122)Kegsay
renamed: internal/eventcontent.go -> internal/eventutil/eventcontent.go renamed: internal/events.go -> internal/eventutil/events.go renamed: internal/types.go -> internal/eventutil/types.go renamed: internal/http/http.go -> internal/httputil/http.go renamed: internal/httpapi.go -> internal/httputil/httpapi.go renamed: internal/httpapi_test.go -> internal/httputil/httpapi_test.go renamed: internal/httpapis/paths.go -> internal/httputil/paths.go renamed: internal/routing.go -> internal/httputil/routing.go renamed: internal/basecomponent/base.go -> internal/setup/base.go renamed: internal/basecomponent/flags.go -> internal/setup/flags.go renamed: internal/partition_offset_table.go -> internal/sqlutil/partition_offset_table.go renamed: internal/postgres.go -> internal/sqlutil/postgres.go renamed: internal/postgres_wasm.go -> internal/sqlutil/postgres_wasm.go renamed: internal/sql.go -> internal/sqlutil/sql.go
2020-06-12Add trace logging to RoomserverInternalAPI (#1120)Kegsay
This is a wrapper around whatever impl we have which then logs the function name/request/response/error. Also tweak when we log on kafka streams: only log on the producer side not the consumer side: we've never had issues with comms and having 1 message rather than N would be nice.
2020-06-11Roomserver API changes (#1118)Kegsay
* s/QueryBackfill/PerformBackfill/g * OutputEvent now includes AddStateEvents which contain the full event of extra state events * Only include adds not the current event * Get adding state right
2020-06-10Remove clientapi producers which aren't actually producers (#1111)Kegsay
* Remove clientapi producers which aren't actually producers They are actually just convenience wrappers around the internal APIs for roomserver/eduserver. Move their logic to their respective `api` packages and call them directly. * Remove TODO * unbreak ygg
2020-06-10Remove unused UserUpdates producer (#1109)Kegsay
2020-06-09Factor out how monolith routes get added (#1107)Kegsay
Previously we had 3 monoliths: - dendrite-monolith-server - dendrite-demo-libp2p - dendritejs which all had their own of setting up public routes. Factor this out into a new `setup.Monolith` struct which gets all dependencies set as fields. This is different to `basecomponent.Base` which doesn't provide any way to set configured deps (e.g public rooms db) Part of a larger process to clean up how we initialise Dendrite.
2020-06-08Split out SetupFooComponent (#1106)Kegsay
* Split out adding HTTP routes from making internal APIs for clarity * Split out more components * Split out more things * Finish converting * internal mux for internal routes
2020-06-04s/Base64String/Base64Bytes/g (#1093)Kegsay
* s/Base64String/Base64Bytes/g Requires https://github.com/matrix-org/gomatrixserverlib/pull/203 to land first * update gmsl
2020-06-04Add ParseFileURI and use it when dealing with file URIs (#1088)Kegsay
* Add ParseFileURI and use it when dealing with file URIs Fixes #1059 * Missing file * Linting
2020-06-04Enable room version 6 (#1087)Neil Alexander
* Return bad request on CS API /send if bad JSON * Return some more M_BAD_JSON in the right places * nolint because damnit gocyclo all I added was a type check for an error * Update gomatrixserverlib * Update gomatrixserverlib * Update sytest-whitelist * Update gomatrixserverlib * Update sytest-whitelist * NotJSON -> BadJSON
2020-06-02Return correct error to LookupRoomAliasNeil Alexander
2020-06-01Unbreak dendritejsKegan Dougal
2020-06-01Fix pg user already exists (#1076)S7evinK
* Return newly created error if user already exists (#1002) Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Rename variable * Remove check for account and use returned error * Return ErrUserExists Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * State that CreateAccount will return err ErrUserExists if the user exists Signed-off-by: Till Faelligen <tfaelligen@gmail.com> * Also check sqlite for constraint error * Revert "Also check sqlite for constraint error" This reverts commit 7d310514 * Check for sqlite3 constraint error * Add documentation to CreateAccount * Move ErrUserExists to accounts package * Revert "Move ErrUserExists to accounts package" Import Cycle.. This reverts commit be3d4cda Co-authored-by: Kegsay <kegan@matrix.org>
2020-06-01Send-to-device support (#1072)Neil Alexander
* Groundwork for send-to-device messaging * Update sample config * Add unstable routing for now * Send to device consumer in sync API * Start the send-to-device consumer * fix indentation in dendrite-config.yaml * Create send-to-device database tables, other tweaks * Add some logic for send-to-device messages, add them into sync stream * Handle incoming send-to-device messages, count them with EDU stream pos * Undo changes to test * pq.Array * Fix sync * Logging * Fix a couple of transaction things, fix client API * Add send-to-device test, hopefully fix bugs * Comments * Refactor a bit * Fix schema * Fix queries * Debug logging * Fix storing and retrieving of send-to-device messages * Try to avoid database locks * Update sync position * Use latest sync position * Jiggle about sync a bit * Fix tests * Break out the retrieval from the update/delete behaviour * Comments * nolint on getResponseWithPDUsForCompleteSync * Try to line up sync tokens again * Implement wildcard * Add all send-to-device tests to whitelist, what could possibly go wrong? * Only care about wildcard when targeted locally * Deduplicate transactions * Handle tokens properly, return immediately if waiting send-to-device messages * Fix sync * Update sytest-whitelist * Fix copyright notice (need to do more of this) * Comments, copyrights * Return errors from Do, fix dendritejs * Review comments * Comments * Constructor for TransactionWriter * defletions * Update gomatrixserverlib, sytest-blacklist
2020-05-26Miscellaneous fixes (#1060)Neil Alexander
* Add missing routing for PerformDirectoryLookupRequest * Tweak output * Fix some bugs in devices * Don't default to federated room joins in response to invite * Update sytest-whitelist * Update comments * Return correct room ID from PerformJoin * Fix appservice and EDU server API setup, update sytest-whitelist * Update sytest-whitelist
2020-05-22dendritejs tweaks for persisting sqlite DBs (#1058)Kegsay
* Use uri.path so we don't have file: in the filename * New go-sqlite-js version
2020-05-22Separate muxes for public and internal APIs (#1056)Neil Alexander
* Separate muxes for public and internal APIs * Update client-api-proxy and federation-api-proxy so they don't add /api to the path * Tidy up * Consistent HTTP setup * Set up prefixes properly
2020-05-21Fix #897 and shuffle directory around (#1054)Kegsay
* Fix #897 and shuffle directory around * Update find-lint * goimports Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2020-05-15Set canonical alias on room creation (#1042)Kegsay
2020-05-13Get profile content for join request again (#1027)Neil Alexander
2020-05-07Direct messages (#1012)Neil Alexander
* Initial DM support, include invite event in stripped state for regular invites * Update go.mod, go.sum, test list
2020-05-06only send new events to RS; add tests for /state_ids and /event (#1011)Kegsay
* only send new events to RS; add tests for /state_ids and /event * Review comments: send in auth event order * Ignore order of state events for this test as RespState.Events is non-deterministic
2020-05-05Prefer /state_ids when missing state across federation (#1008)Kegsay
* Prefer /state_ids when missing state across federation * Linting * Better logging
2020-05-04Roomserver perform leave (#1004)Neil Alexander
* First pass at PerformLeave * Fix SQLite bulkSelectEventStateKey * Update gomatrixserverlib * Fix bugs * Tidy a bit * Satisfy King Linter * Review comments * Review comments * Fix constants in SQLite event state keys table
2020-05-04Roomserver perform join (#1001)Neil Alexander
* Add PerformJoin template * Try roomserver perform join * Send correct server name to FS API * Pass through content, try to handle multiple server names * Fix local server checks * Don't refer to non-existent error * Add directory lookups of aliases * Remove unneeded parameters * Don't repeat join events into the roomserver * Unmarshal the content, that would help * Check if the user is already in the room in the fedeationapi too * Return incompatible room version error * Use Membership, don't try more servers than needed * Review comments, make FS API take list of servernames, dedupe them, break out of loop properly on success * Tweaks
2020-05-01Limit database connections (#980, #564) (#998)Neil Alexander
* Limit database connections (#564) - Add new options to the config file database: max_open_conns: 100 max_idle_conns: 2 conn_max_lifetime: -1 - Implement connection parameter setup on the *DB (database/sql) in internal/sqlutil/trace.go:Open() - Propagate the values in the form of DbProperties interface via all the Open() and NewDatabase() functions Signed-off-by: Tomas Jirka <tomas.jirka@email.cz> * Fix wasm builds * Remove file accidentally added from working tree Co-authored-by: Tomas Jirka <tomas.jirka@email.cz>
2020-05-01Consolidation of roomserver APIs (#994)Neil Alexander
* Consolidation of roomserver APIs * Comment out alias tests for now, they are broken * Wire AS API into roomserver again * Roomserver didn't take asAPI param before so return to that * Prevent roomserver asking AS API for alias info * Rename some files * Remove alias_test, incoherent tests and unwanted appservice integration * Remove FS API inject on syncapi component
2020-04-29Join room support in federation sender (#989)Neil Alexander
* Implement PerformJoinRequest * Rename perform functions * Check send join response * Temporary wiring to test federation sender room joins * Actually pass through the config * Make sure membership content shows join