Skip to content

Commit

Permalink
cleaning up algia
Browse files Browse the repository at this point in the history
  • Loading branch information
mleku committed Jan 10, 2024
1 parent f6567a6 commit 628db31
Show file tree
Hide file tree
Showing 12 changed files with 621 additions and 586 deletions.
442 changes: 442 additions & 0 deletions cmd/algia/config.go

Large diffs are not rendered by default.

411 changes: 22 additions & 389 deletions cmd/algia/main.go

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions cmd/algia/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,19 @@ import (
"os"

"github.com/Hubmakerlabs/replicatr/pkg/context"

"github.com/Hubmakerlabs/replicatr/pkg/go-nostr/event"
"github.com/Hubmakerlabs/replicatr/pkg/go-nostr/filter"
"github.com/Hubmakerlabs/replicatr/pkg/go-nostr/keys"
"github.com/Hubmakerlabs/replicatr/pkg/go-nostr/nip19"
"github.com/Hubmakerlabs/replicatr/pkg/nostr-sdk"
"github.com/urfave/cli/v2"

"github.com/Hubmakerlabs/replicatr/pkg/go-nostr/nip19"
)

func doProfile(cCtx *cli.Context) (e error) {
user := cCtx.String("u")
j := cCtx.Bool("json")

cfg := cCtx.App.Metadata["config"].(*Config)
cfg := cCtx.App.Metadata["config"].(*C)
rl := cfg.FindRelay(context.Bg(), RelayPerms{Read: true})
if rl == nil {
return errors.New("cannot connect relays")
Expand All @@ -31,7 +29,7 @@ func doProfile(cCtx *cli.Context) (e error) {
var pub string
if user == "" {
if _, s, e := nip19.Decode(cfg.PrivateKey); e == nil {
if pub, e = keys.GetPublicKey(s.(string)); e != nil {
if pub, e = keys.GetPublicKey(s.(string)); log.Fail(e) {
return e
}
} else {
Expand Down Expand Up @@ -63,11 +61,11 @@ func doProfile(cCtx *cli.Context) (e error) {
}
var profile Profile
e = json.Unmarshal([]byte(evs[0].Content), &profile)
if e != nil {
if log.Fail(e) {
return e
}
npub, e := nip19.EncodePublicKey(pub)
if e != nil {
if log.Fail(e) {
return e
}
fmt.Printf("Pubkey: %v\n", npub)
Expand Down
Loading

0 comments on commit 628db31

Please sign in to comment.