forked from Mirrors/gomuks
Use new Beeper JWT login when headless
This commit is contained in:
parent
7e25710506
commit
ad1fd015cb
2 changed files with 6 additions and 8 deletions
|
@ -8,7 +8,6 @@ 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/config"
|
"maunium.net/go/gomuks/config"
|
||||||
"maunium.net/go/gomuks/initialize"
|
"maunium.net/go/gomuks/initialize"
|
||||||
|
@ -17,8 +16,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
OutputDir, MxPassword, Homeserver, KeyPath, KeyPassword, RecoveryCode string
|
OutputDir, Session, Code, KeyPath, KeyPassword, RecoveryCode string
|
||||||
MxID id.UserID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Init(conf Config, updates chan fmt.Stringer) error {
|
func Init(conf Config, updates chan fmt.Stringer) error {
|
||||||
|
@ -43,13 +41,13 @@ func Init(conf Config, updates chan fmt.Stringer) error {
|
||||||
updates <- initializedGomuks{}
|
updates <- initializedGomuks{}
|
||||||
|
|
||||||
// login section
|
// login section
|
||||||
gmx.Config().HS = conf.Homeserver
|
gmx.Config().HS = "https://matrix.beeper.com"
|
||||||
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.String(), conf.MxPassword); err != nil {
|
} else if err = gmx.Matrix().BeeperLogin(conf.Session, conf.Code); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
updates <- loggedIn{account: conf.MxID}
|
updates <- loggedIn{}
|
||||||
|
|
||||||
// key import
|
// key import
|
||||||
data, err := os.ReadFile(conf.KeyPath)
|
data, err := os.ReadFile(conf.KeyPath)
|
||||||
|
|
|
@ -14,10 +14,10 @@ func (msg initializedGomuks) String() string {
|
||||||
return "Initialized gomuks…"
|
return "Initialized gomuks…"
|
||||||
}
|
}
|
||||||
|
|
||||||
type loggedIn struct{ account fmt.Stringer }
|
type loggedIn struct{}
|
||||||
|
|
||||||
func (msg loggedIn) String() string {
|
func (msg loggedIn) String() string {
|
||||||
return fmt.Sprintf("Logged in to %s…", msg.account)
|
return fmt.Sprintf("Logged in…")
|
||||||
}
|
}
|
||||||
|
|
||||||
type importedKeys struct{ imported, total int }
|
type importedKeys struct{ imported, total int }
|
||||||
|
|
Loading…
Add table
Reference in a new issue