mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-14 05:12:26 +03:00
Start implementing /join for room aliases for rooms the server is not in. (#115)
* 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
This commit is contained in:
parent
445dce14ae
commit
84ad4ff9f6
15 changed files with 528 additions and 66 deletions
|
@ -26,6 +26,7 @@ import (
|
|||
"github.com/matrix-org/dendrite/clientapi/routing"
|
||||
"github.com/matrix-org/dendrite/common"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
|
@ -81,6 +82,8 @@ func main() {
|
|||
log.Panicf("Failed to setup kafka producers(%s): %s", cfg.KafkaProducerURIs, err)
|
||||
}
|
||||
|
||||
federation := gomatrixserverlib.NewFederationClient(cfg.ServerName, cfg.KeyID, cfg.PrivateKey)
|
||||
|
||||
queryAPI := api.NewRoomserverQueryAPIHTTP(cfg.RoomserverURL, nil)
|
||||
accountDB, err := accounts.NewDatabase(accountDataSource, serverName)
|
||||
if err != nil {
|
||||
|
@ -91,6 +94,32 @@ func main() {
|
|||
log.Panicf("Failed to setup device database(%s): %s", accountDataSource, err.Error())
|
||||
}
|
||||
|
||||
routing.Setup(http.DefaultServeMux, http.DefaultClient, cfg, roomserverProducer, queryAPI, accountDB, deviceDB)
|
||||
keyRing := gomatrixserverlib.KeyRing{
|
||||
KeyFetchers: []gomatrixserverlib.KeyFetcher{
|
||||
// TODO: Use perspective key fetchers for production.
|
||||
&gomatrixserverlib.DirectKeyFetcher{federation.Client},
|
||||
},
|
||||
KeyDatabase: &dummyKeyDatabase{},
|
||||
}
|
||||
|
||||
routing.Setup(
|
||||
http.DefaultServeMux, http.DefaultClient, cfg, roomserverProducer,
|
||||
queryAPI, accountDB, deviceDB, federation, keyRing,
|
||||
)
|
||||
log.Fatal(http.ListenAndServe(bindAddr, nil))
|
||||
}
|
||||
|
||||
// TODO: Implement a proper key database.
|
||||
type dummyKeyDatabase struct{}
|
||||
|
||||
func (d *dummyKeyDatabase) FetchKeys(
|
||||
requests map[gomatrixserverlib.PublicKeyRequest]gomatrixserverlib.Timestamp,
|
||||
) (map[gomatrixserverlib.PublicKeyRequest]gomatrixserverlib.ServerKeys, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (d *dummyKeyDatabase) StoreKeys(
|
||||
map[gomatrixserverlib.PublicKeyRequest]gomatrixserverlib.ServerKeys,
|
||||
) error {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue