mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-19 18:13:41 -05:00
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/crypto"
|
||||
"maunium.net/go/mautrix/crypto/ssss"
|
||||
"maunium.net/go/mautrix/id"
|
||||
|
||||
"maunium.net/go/gomuks/config"
|
||||
"maunium.net/go/gomuks/initialize"
|
||||
|
@ -17,8 +16,7 @@ import (
|
|||
)
|
||||
|
||||
type Config struct {
|
||||
OutputDir, MxPassword, Homeserver, KeyPath, KeyPassword, RecoveryCode string
|
||||
MxID id.UserID
|
||||
OutputDir, Session, Code, KeyPath, KeyPassword, RecoveryCode string
|
||||
}
|
||||
|
||||
func Init(conf Config, updates chan fmt.Stringer) error {
|
||||
|
@ -43,13 +41,13 @@ func Init(conf Config, updates chan fmt.Stringer) error {
|
|||
updates <- initializedGomuks{}
|
||||
|
||||
// login section
|
||||
gmx.Config().HS = conf.Homeserver
|
||||
gmx.Config().HS = "https://matrix.beeper.com"
|
||||
if err := gmx.Matrix().InitClient(false); err != nil {
|
||||
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
|
||||
}
|
||||
updates <- loggedIn{account: conf.MxID}
|
||||
updates <- loggedIn{}
|
||||
|
||||
// key import
|
||||
data, err := os.ReadFile(conf.KeyPath)
|
||||
|
|
|
@ -14,10 +14,10 @@ func (msg initializedGomuks) String() string {
|
|||
return "Initialized gomuks…"
|
||||
}
|
||||
|
||||
type loggedIn struct{ account fmt.Stringer }
|
||||
type loggedIn struct{}
|
||||
|
||||
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 }
|
||||
|
|
Loading…
Add table
Reference in a new issue