aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/gobind/monolith.go11
-rw-r--r--cmd/dendrite-demo-yggdrasil/yggconn/node.go4
-rw-r--r--userapi/internal/api.go5
3 files changed, 20 insertions, 0 deletions
diff --git a/build/gobind/monolith.go b/build/gobind/monolith.go
index 750babad..62ca1744 100644
--- a/build/gobind/monolith.go
+++ b/build/gobind/monolith.go
@@ -11,6 +11,7 @@ import (
"github.com/matrix-org/dendrite/appservice"
"github.com/matrix-org/dendrite/cmd/dendrite-demo-yggdrasil/signing"
"github.com/matrix-org/dendrite/cmd/dendrite-demo-yggdrasil/yggconn"
+ "github.com/matrix-org/dendrite/currentstateserver"
"github.com/matrix-org/dendrite/eduserver"
"github.com/matrix-org/dendrite/eduserver/cache"
"github.com/matrix-org/dendrite/federationsender"
@@ -25,6 +26,7 @@ import (
)
type DendriteMonolith struct {
+ YggdrasilNode *yggconn.Node
StorageDirectory string
listener net.Listener
}
@@ -33,6 +35,10 @@ func (m *DendriteMonolith) BaseURL() string {
return fmt.Sprintf("http://%s", m.listener.Addr().String())
}
+func (m *DendriteMonolith) PeerCount() int {
+ return m.YggdrasilNode.PeerCount()
+}
+
func (m *DendriteMonolith) Start() {
logger := logrus.Logger{
Out: BindLogger{},
@@ -49,6 +55,7 @@ func (m *DendriteMonolith) Start() {
if err != nil {
panic(err)
}
+ m.YggdrasilNode = ygg
cfg := &config.Dendrite{}
cfg.SetDefaults()
@@ -69,6 +76,7 @@ func (m *DendriteMonolith) Start() {
cfg.Database.FederationSender = config.DataSource(fmt.Sprintf("file:%s/dendrite-federationsender.db", m.StorageDirectory))
cfg.Database.AppService = config.DataSource(fmt.Sprintf("file:%s/dendrite-appservice.db", m.StorageDirectory))
cfg.Database.PublicRoomsAPI = config.DataSource(fmt.Sprintf("file:%s/dendrite-publicroomsa.db", m.StorageDirectory))
+ cfg.Database.CurrentState = config.DataSource(fmt.Sprintf("file:%s/dendrite-currentstate.db", m.StorageDirectory))
cfg.Database.Naffka = config.DataSource(fmt.Sprintf("file:%s/dendrite-naffka.db", m.StorageDirectory))
if err = cfg.Derive(); err != nil {
panic(err)
@@ -108,6 +116,8 @@ func (m *DendriteMonolith) Start() {
logrus.WithError(err).Panicf("failed to connect to public rooms db")
}
+ stateAPI := currentstateserver.NewInternalAPI(base.Cfg, base.KafkaConsumer)
+
monolith := setup.Monolith{
Config: base.Cfg,
AccountDB: accountDB,
@@ -123,6 +133,7 @@ func (m *DendriteMonolith) Start() {
FederationSenderAPI: fsAPI,
RoomserverAPI: rsAPI,
UserAPI: userAPI,
+ StateAPI: stateAPI,
//ServerKeyAPI: serverKeyAPI,
PublicRoomsDB: publicRoomsDB,
diff --git a/cmd/dendrite-demo-yggdrasil/yggconn/node.go b/cmd/dendrite-demo-yggdrasil/yggconn/node.go
index c335f2ea..73e9cd5b 100644
--- a/cmd/dendrite-demo-yggdrasil/yggconn/node.go
+++ b/cmd/dendrite-demo-yggdrasil/yggconn/node.go
@@ -174,3 +174,7 @@ func (n *Node) SigningPrivateKey() ed25519.PrivateKey {
privBytes, _ := hex.DecodeString(n.config.SigningPrivateKey)
return ed25519.PrivateKey(privBytes)
}
+
+func (n *Node) PeerCount() int {
+ return len(n.core.GetSwitchPeers())
+}
diff --git a/userapi/internal/api.go b/userapi/internal/api.go
index b081eca4..1d10d1d8 100644
--- a/userapi/internal/api.go
+++ b/userapi/internal/api.go
@@ -85,6 +85,11 @@ func (a *UserInternalAPI) PerformAccountCreation(ctx context.Context, req *api.P
}
return nil
}
+
+ if err = a.AccountDB.SetDisplayName(ctx, req.Localpart, req.Localpart); err != nil {
+ return err
+ }
+
res.AccountCreated = true
res.Account = acc
return nil