* Revert "implement AS timestamp massaging (#542)"
This reverts commit a56752f3f6.
* Update APIs to support ts
* refactor MakeJoin, make code consistent
* Keep one parameter per line
* update gomatrixserverlib
* Make removeUser public
* Implement api.TypingServerInputAPI
* Integrate the typing server component, create kafka topic
* Add typing server cmd for multiprocess dendrite
* Add typing cache
Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>
* Add tests for typingCache
* Make test stricter
* Handle cases where expireTime is updated
* Make the slice comparisons sturdy
* Use timers to call removeUser after timeout
* Add test for TypingCache.removeUser
Signed-Off-By: Matthias Kesler <krombel@krombel.de>
* Write deterministic test
* Refactor string slice helper to common/test
Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>
* Do not modify the given slice
* Add Unsorted in the function name
* Allow appservices to register without a logintype
Signed-off-by: Andrew Morgan <andrewm@matrix.org>
* Reduce cyclomatic complexity on Register function
* Fix some grammar
* Add AS support to MakeAuthAPI
Make clientapi utilize the same
Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>
* Add user parameter support to MakeAuthAPI
* Make VerifyAccessToken private, let VerifyUserFromRequest return the
device if present
* Make a dummy device for AS users
* Refactor arguments into auth.Data
* Update routing of all components
* Update code comment
* Use const AppServiceDeviceID
* Handle cases when AS is not masquerading
* Check UserID instead of username from AS's. Tests.
* add tests to validateApplicationService
* Use some literals, organize URLs & checks
* Fix error messages and incorrect test
* Prevent sql scanning into nil value in accounts_table
Signed-off-by: Andrew Morgan <andrewm@matrix.org>
* Remove uneccessary logging, null checking
* Don't forget to set the localpart
* Simplify error checking
* Store And Send Application Service Events
* Modify INSTALL.md and dendrite-config.yaml for the new appservice database
* Correct all instances of casing on 'application service' to align with
spec
* Store incoming events that an app service is interested in in the
database to be later read by transaction workers.
* Retrieve these events from transaction workers, one per AS.
* Minimal transaction ID data is stored as well to recover after
server failure.
* Send events to AS and exponentially backoff on failure.
Signed-off-by: Andrew Morgan <andrewm@matrix.org>
* Finish my own sentences.
* Fix up database interaction
* Change to event-based AS sending
* Reduce cyclomatic complexity
* Appease the errcheck gods
* Delete by int ID instead of string.
This was causing some events to not be deleted, as < an eventID doesn't
really make much sense.
* Check if there are more events to send before sleeping
* Send same transaction if last send attempt failed
* Don't backoff on non-200s, tight send loop, 1 event query
* Remove tight send loop. Fix events not being deleted
* Additionally order by event id, track main.go
* Return the last txnID, which our events are using
* Remove old main.go file
* Prevent duplicate events from being sent...
* Strip event content if it doesn't contain anything
Signed-off-by: Andrew Morgan <andrewm@matrix.org>
* Update gomatrixserverlib and use Unsigned AS event prop
* Fixes
* Fix sync server comment
* Remove unnecessary printlns
* Use logrus Fields
* Worker state methods
* Remove sillyness
* Fix up event filtering
* Handle transaction event limit in loop
* Switch to using a sequence for transaction IDs
* Don't verify self-signed AS certificates
* Fix logging
* Use gmsl.Event instead of AS-only event in transactions
Also clear up the logic on lookupStateEvents a little bit.
* Change invalid_txn_id to global (for efficiency)
* Use a bool for EventsReady instead of an int
* Return 404 when profile is not found
* Handler sql.ErrNoRows and avoid returning nil
update federation GetProfile as well
Signed-off-by: Anant Prakash <anantprakashjsr@gmail.com>
* Prevent alias registration in AS exclusive namespace
* Fix M_Exclusive errors so they return status 400 instead of 403.
Signed-off-by: Andrew Morgan <andrewm@matrix.org>
* Directly access namespace map instead of searching for key
* Prevent sql scanning into nil value in accounts_table
Signed-off-by: Andrew Morgan <andrewm@matrix.org>
* Remove uneccessary logging, null checking
* Don't forget to set the localpart
* Simplify error checking
* Add group_id, rate_limit and protocol AS config options
* We currently just record and error check these options. There are not
currently implemented.
Signed-off-by: Andrew Morgan <andrewm@matrix.org>
* Clean things up and fix yaml declaration
* Warn loudly when app service requests unimplemented options
* Fix comments
* Remove high cyclomatic complexity of appservice checkErrors
* Set default rate limited to true