1
0
Fork 0
forked from Mirrors/gomuks

Use new Beeper JWT login when headless

This commit is contained in:
FIGBERT 2023-08-24 10:47:14 -07:00
parent 7e25710506
commit ad1fd015cb
No known key found for this signature in database
GPG key ID: 67F1598D607A844B
2 changed files with 6 additions and 8 deletions

View file

@ -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)

View file

@ -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 }