Skip to content

Commit

Permalink
Yeah I was
Browse files Browse the repository at this point in the history
  • Loading branch information
FIGBERT committed Aug 28, 2023
1 parent 08c7433 commit 75c3ed1
Showing 1 changed file with 49 additions and 48 deletions.
97 changes: 49 additions & 48 deletions headless/headless.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package headless

import (
"context"
//"context"
"errors"
"fmt"
"os"
Expand Down Expand Up @@ -67,53 +67,54 @@ func Init(conf Config, updates chan fmt.Stringer) error {
//updates <- configuredDisplayMode{}

// sync
updates <- beginningSync{}
resp, err := gmx.Matrix().Client().FullSyncRequest(mautrix.ReqSync{
Timeout: 30000,
Since: "",
FilterID: "",
FullState: true,
SetPresence: gmx.Matrix().Client().SyncPresence,
Context: context.Background(),
StreamResponse: true,
})
if err != nil {
return err
}
updates <- fetchedSyncData{}

gmx.Matrix().(*matrix.Container).InitSyncer()
updates <- processingSync{}
err = gmx.Matrix().(*matrix.Container).ProcessSyncResponse(resp, "")
if err != nil {
return err
}
updates <- syncFinished{}

// verify (fetch)
key, err := getSSSS(mach, conf.RecoveryCode)
if err != nil {
return err
}

err = mach.FetchCrossSigningKeysFromSSSS(key)
if err != nil {
return fmt.Errorf("Error fetching cross-signing keys: %v", err)
}
updates <- fetchedVerificationKeys{}

// verify (sign)
if mach.CrossSigningKeys == nil {
return fmt.Errorf("Cross-signing keys not cached")
}

err = mach.SignOwnDevice(mach.OwnIdentity())
if err != nil {
return fmt.Errorf("Failed to self-sign: %v", err)
}
updates <- successfullyVerified{}

return err
//updates <- beginningSync{}
//resp, err := gmx.Matrix().Client().FullSyncRequest(mautrix.ReqSync{
// Timeout: 30000,
// Since: "",
// FilterID: "",
// FullState: true,
// SetPresence: gmx.Matrix().Client().SyncPresence,
// Context: context.Background(),
// StreamResponse: true,
//})
//if err != nil {
// return err
//}
//updates <- fetchedSyncData{}

//gmx.Matrix().(*matrix.Container).InitSyncer()
//updates <- processingSync{}
//err = gmx.Matrix().(*matrix.Container).ProcessSyncResponse(resp, "")
//if err != nil {
// return err
//}
//updates <- syncFinished{}

//// verify (fetch)
//key, err := getSSSS(mach, conf.RecoveryCode)
//if err != nil {
// return err
//}

//err = mach.FetchCrossSigningKeysFromSSSS(key)
//if err != nil {
// return fmt.Errorf("Error fetching cross-signing keys: %v", err)
//}
//updates <- fetchedVerificationKeys{}

//// verify (sign)
//if mach.CrossSigningKeys == nil {
// return fmt.Errorf("Cross-signing keys not cached")
//}

//err = mach.SignOwnDevice(mach.OwnIdentity())
//if err != nil {
// return fmt.Errorf("Failed to self-sign: %v", err)
//}
//updates <- successfullyVerified{}

//return err
return nil
}

func initDirs() (string, string, string, string, error) {
Expand Down

0 comments on commit 75c3ed1

Please sign in to comment.