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.
* Start implementing the join room API
* Hacks to get join room working
* Make the TLS fingerprint configurable
* Fix the client API proxy to handle '#' correctly
* Return a 200 OK response
* Write the join event along with current state to the room server
* Comment on the error handling
* Fix typos
* Fix tab
* Add TODO for moving authEventIDs to gomatrixserverlib
* Comment on why we ignore the key ID argument for local keys
* Avoid 'preceeded'
* Neaten the control flow
* Neaten the control flow even more
* Return pointers
* Rename err to lastErr for the loop
- Renamed `clientapi/auth/types` to `clientapi/auth/authtypes` for the same
horrible namespace clashing reasons as `storage`.
- Factored out `makeAPI` to `common`.
- Added in `makeAuthAPI`.
Previously, all database stuff was under the helpfully named
package 'storage'. However, this convention is used throughout all
of dendrite, which will clash the moment we want to add auth to all
the CS API endpoints. To prevent the package name clash, add
sub-directories which represent what is being stored so the final
usage ends up being:
```
func doThing(db *storage.SyncServerDatabase, authDB *accounts.Database)
{
// ...
}
```
* Start implementing the federation server keys API.
* Fix copyright
* Fix comments
* Comment on the key format
* Better explain what the ValidityPeriod is
* Return a 200 status code
* Rename "make" to "makeAPI" and factor out some more common code into it
Naming a function the same as a go builtin function seems like a bad
idea. Also move the call to `NewJSONRequestHander` inside the function
rather than calling it everywhere.
* Fix typo
- `s/Server/OutputRoomEvent/` in `consumers` to accurately reflect what is being consumed.
- `s/set/userIDSet/` in `notifier.go` for clarity.
- Removed lying comments.
The logic required to populate the right bits of `RoomData` tends towards
the complete `/sync` response struct, so just use the actual response struct
and save the hassle of mapping between the two. It may not make much difference
in its current form, but the next PR will make use of this.
This PR has no functional changes.
This is only 'mostly' correct currently, because what should be no-op dupe
joins will actually trigger the entire room state to be re-sent.
Bizarrely, it's significantly easier to just do that than work out if we should,
and there are no client-visible effects to doing so, so we just do it for now.
- Test data for the sync server is now in its own file.
- Rejig the sync server tests to support multiple /sync requests and corresponding
assertions.
- Fixed a minor bug which resulted in state events to appear twice in /sync
responses when syncing without a `since` parameter.
* Split out notifying /sync requests and calculating sync responses
The logic for notifying /sync requests is about to get really
complicated as we optimise when to wake up requests, so split
out that code into a separate struct to isolate it and make
it easier to unit test.
This has the following known shortcomings:
- It doesn't handle missing events not in the from/to range.
- It doesn't order events in the timeline correctly.
- It doesn't handle invited/left rooms at all.
- There is no intelligent wakeup logic: events for Bob will wake up Alice's stream.
Currently the HTTP handlers are attached to an API mux which is created inside
Setup(). In the future, we'll want to split this out so a single mux can have
both sync and clientapi handlers attached to it.
This distinguishes them from tools like 'kafka-producer'
which are not required to run a dendrite server.
The prefix also groups together the dendrite binaries nicely
on `ls` as well as making it nicer to tab-complete.
This involves:
- Parsing the HTTP request
- Requesting auth events from the roomserver via the Query API
- Building the event
- Doing auth checks on the event
- Sending it to the roomserver input log
Previously, the error responses:
- were not valid matrix errors (no `errcode`)
- returned the `err.Error()` message which may contain sensitive information.
- did not get logged (at all, let alone set the level correctly).
Now the error responses:
- return valid matrix errors (`M_UNKNOWN`)
- return a generic "Internal Server Error" string
- get logged at `ERROR` level.
* Return the requested portions of current state in the query API
* Use Unique from github.com/matrix-org/util
* rewrite bulkSelectFilteredStateBlockEntries to use append for clarity
* Add test for stateKeyTupleSorter
* Replace current with a new StateEntryList rather than individually setting the fields
* Add method for calculating the room state after a list of events
* Fill out AddsState and RemovesState fields in the output event
* comment on return value
* Fix whitespace
* Clarify the meaning of LastEventIDSent
* Be more explicit on what the snapshot is
* Fix comments
* Comment on why we want the state after the previous events
* Start implementing a query API for go using net/rpc
* Use a conventional JSON POST API rather than go net/rpc
net/rpc doesn't automatically handle reconnecting and we have better
logging and metrics infrastructure for monitoring HTTP apis.
* Implement the query API and add it to the integration tests
* Increase the timeout, travis seems to be a bit slow
* Clarify that state events are the things that are not returned if they are not requested
* Add utility function for converting arrays of numeric event IDs to pq Int64Arrays
* Warn people against requesting empty state keys by accident
* Add integration tests for roomserver to travis
* Try setting the dist trusty to see if that helps with postgres
* Pretty print the test input JSON
* Add comment as to why we are using trusty
* Marshal and Unmarshal methods for roomserver input api
* Comments for why we don't json.marshal the InputRoomEvent directly
* More comments
* s/m.room.create/the first event/
Terse function names are used to make usage not stutter. For example:
```go
err := error.Forbidden("you shall not pass")
```
At the moment they are all the same fundamental `MatrixError` type. This will
be bad if we ever want to `switch` based on the kind of error. I'm hoping we
won't ever need to introspect into errors like this: ideally these errors would
be created purely for immediately being returned in an HTTP response.
`MatrixError` implements the `error` interface.
* Move partition offsets sql to a separate file
* Move event types sql to a separate file
* Move event state key sql to a separate file
* Move room sql to a separate file
* Move events sql to a separate file
* Move event json sql to a separate file
* Move state snapshot sql to a separate file
* Move state block sql to a separate file
* A kafkaesque room event consumer for the roomserver.
Implement the main input loop for the roomserver.
It will receive events from a kafkaesque event source and track
where it is in the stream.
It currently does nothing with the events it consumes.