mirror of
https://github.com/matrix-org/dendrite
synced 2024-12-13 20:23:10 +01:00
Fix Yggdrasil gobind build, set display name at registration
This commit is contained in:
parent
42dd962425
commit
8e7947926c
3 changed files with 20 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue