forked from Mirrors/gomuks
Configure MxID and homeserver in headless startup
This commit is contained in:
parent
5db39fd50a
commit
c628bfb97c
1 changed files with 10 additions and 5 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
"maunium.net/go/mautrix"
|
"maunium.net/go/mautrix"
|
||||||
"maunium.net/go/mautrix/crypto"
|
"maunium.net/go/mautrix/crypto"
|
||||||
"maunium.net/go/mautrix/crypto/ssss"
|
"maunium.net/go/mautrix/crypto/ssss"
|
||||||
|
"maunium.net/go/mautrix/id"
|
||||||
|
|
||||||
"maunium.net/go/gomuks/initialize"
|
"maunium.net/go/gomuks/initialize"
|
||||||
"maunium.net/go/gomuks/matrix"
|
"maunium.net/go/gomuks/matrix"
|
||||||
|
@ -16,10 +17,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type HeadlessConfig struct {
|
type HeadlessConfig struct {
|
||||||
OutputDir,
|
OutputDir, MxPassword, KeyPath, KeyPassword, RecoveryPhrase string
|
||||||
MxID, MxPassword,
|
MxID id.UserID
|
||||||
KeyPath, KeyPassword,
|
|
||||||
RecoveryPhrase string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func HeadlessInit(conf HeadlessConfig) error {
|
func HeadlessInit(conf HeadlessConfig) error {
|
||||||
|
@ -39,9 +38,15 @@ func HeadlessInit(conf HeadlessConfig) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// login section
|
// login section
|
||||||
|
_, hs, err := conf.MxID.Parse()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
gmx.Config().HS = hs
|
||||||
if err := gmx.Matrix().InitClient(false); err != nil {
|
if err := gmx.Matrix().InitClient(false); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if err = gmx.Matrix().Login(conf.MxID, conf.MxPassword); err != nil {
|
} else if err = gmx.Matrix().Login(conf.MxID.String(), conf.MxPassword); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue