Fix several bugs found by mckinley@twtxt.net #169

Closed
opened 3 weeks ago by prologic · 12 comments
prologic commented 3 weeks ago
Owner
See https://twtxt.net/conv/5535xyq
Poster
Owner

First off we should remove this warning:

[mckinley@t430 ~]$ rm -rf ~/.config/salty/
[mckinley@t430 ~]$ salty-chat register mckinley@mills.io
WARN[0001] error looking up user endpoint                error="error looking up user mckinley@mills.io: non-2xx response received: 404 Not Found"
Success! 🥳
First off we should remove this warning: ``` [mckinley@t430 ~]$ rm -rf ~/.config/salty/ [mckinley@t430 ~]$ salty-chat register mckinley@mills.io WARN[0001] error looking up user endpoint error="error looking up user mckinley@mills.io: non-2xx response received: 404 Not Found" Success! 🥳 ```
Poster
Owner

And there are at least two bugs here:

[mckinley@t430 ~]$ salty-chat make-user mckinley@mckinley.cc
Create this file and place it on your web server
so that it is accessible at a top-level domain or sub-domain at the URL:

https://mckinley.cc/.well-known/salty/cb89306651329866dccaeca35b54355b284c2be2bbed9b9d473f1d73ba747dcd.json

mkdir -p .well-known/salty
cat > .well-known/salty/cb89306651329866dccaeca35b54355b284c2be2bbed9b9d473f1d73ba747dcd.json << EOF
{
  "endpoint": "/01G268YYHWGNYT9M1M9760KP83",
  "key": "kex1akl7mmsj7yre564wkcez3pq0jyzzj66cdppgkzzl3ezz69r733lqhhpam9"
}
EOF

To verify you have done this correctly:

$ salty-chat lookup mckinley@mckinley.cc
[mckinley@t430 ~]$ salty-chat lookup mckinley@mckinley.cc
{"Addr":"mckinley@mckinley.cc","User":"mckinley","Domain":"mckinley.cc","Key":"kex1akl7mmsj7yre564wkcez3pq0jyzzj66cdppgkzzl3ezz69r733lqhhpam9","Endpoint":"/01G268YYHWGNYT9M1M9760KP83","Avatar":""}
[mckinley@t430 ~]$ salty-chat send prologic@mills.io "Is this thing working?"
error parsing addr: expected nick@domain found ""
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xad5bad]

goroutine 1 [running]:
go.mills.io/saltyim.(*Addr).Endpoint(...)
/home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/lookup.go:152
go.mills.io/saltyim.NewClient(0x0, {0xc00020fc80, 0x1, 0x4804af?})
/home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/client.go:143 +0x3ad
main.send(0xdebc80?, {0xc00012c480, 0x29}, {0x7ffc69a2bc03?, 0xc00020fd78?}, {0xc0001452f0, 0x1, 0x1})
/home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/send.go:70 +0x165
main.glob..func9(0x13791e0?, {0xc0001452e0, 0x2, 0x2})
/home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/send.go:55 +0x1e5
github.com/spf13/cobra.(*Command).execute(0x13791e0, {0xc0001452a0, 0x2, 0x2})
/home/mckinley/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x1378f60)
/home/mckinley/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
/home/mckinley/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
main.Execute()
/home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/root.go:51 +0x25
main.main()
/home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/main.go:4 +0x17
  • Fix the crash
  • Fix some of the help text (it's wrong)
  • Fix the bad endpoing logic (This is what -u/--endpoint was for, but we removed it!)
And there are at least two bugs here: ``` [mckinley@t430 ~]$ salty-chat make-user mckinley@mckinley.cc Create this file and place it on your web server so that it is accessible at a top-level domain or sub-domain at the URL: https://mckinley.cc/.well-known/salty/cb89306651329866dccaeca35b54355b284c2be2bbed9b9d473f1d73ba747dcd.json mkdir -p .well-known/salty cat > .well-known/salty/cb89306651329866dccaeca35b54355b284c2be2bbed9b9d473f1d73ba747dcd.json << EOF { "endpoint": "/01G268YYHWGNYT9M1M9760KP83", "key": "kex1akl7mmsj7yre564wkcez3pq0jyzzj66cdppgkzzl3ezz69r733lqhhpam9" } EOF To verify you have done this correctly: $ salty-chat lookup mckinley@mckinley.cc [mckinley@t430 ~]$ salty-chat lookup mckinley@mckinley.cc {"Addr":"mckinley@mckinley.cc","User":"mckinley","Domain":"mckinley.cc","Key":"kex1akl7mmsj7yre564wkcez3pq0jyzzj66cdppgkzzl3ezz69r733lqhhpam9","Endpoint":"/01G268YYHWGNYT9M1M9760KP83","Avatar":""} [mckinley@t430 ~]$ salty-chat send prologic@mills.io "Is this thing working?" error parsing addr: expected nick@domain found "" panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xad5bad] goroutine 1 [running]: go.mills.io/saltyim.(*Addr).Endpoint(...) /home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/lookup.go:152 go.mills.io/saltyim.NewClient(0x0, {0xc00020fc80, 0x1, 0x4804af?}) /home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/client.go:143 +0x3ad main.send(0xdebc80?, {0xc00012c480, 0x29}, {0x7ffc69a2bc03?, 0xc00020fd78?}, {0xc0001452f0, 0x1, 0x1}) /home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/send.go:70 +0x165 main.glob..func9(0x13791e0?, {0xc0001452e0, 0x2, 0x2}) /home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/send.go:55 +0x1e5 github.com/spf13/cobra.(*Command).execute(0x13791e0, {0xc0001452a0, 0x2, 0x2}) /home/mckinley/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663 github.com/spf13/cobra.(*Command).ExecuteC(0x1378f60) /home/mckinley/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4 github.com/spf13/cobra.(*Command).Execute(...) /home/mckinley/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902 main.Execute() /home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/root.go:51 +0x25 main.main() /home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/main.go:4 +0x17 ``` - [ ] Fix the crash - [ ] Fix some of the help text (it's wrong) - [ ] Fix the bad endpoing logic (This is what -u/--endpoint was for, but we removed it!)

Those logs you copied in here were from before I registered with a proper broker. I'll copy the most recent log now.

[mckinley@t430 ~]$ dig srv _salty._tcp.mckinley.cc +short
0 0 443 salty.mills.io.
[mckinley@t430 ~]$ dig srv _avatars._tcp.mckinley.cc +short
0 0 443 salty.mills.io.
[mckinley@t430 ~]$ rm -rf ~/.config/salty/
[mckinley@t430 ~]$ salty-chat register mckinley@mckinley.cc salty.mills.io
WARN[0002] error looking up user endpoint                error="error looking up user mckinley@mckinley.cc: non-2xx response received: 404 Not Found"
Success! 🥳
[mckinley@t430 ~]$ salty-chat lookup mckinley@mckinley.cc
{"Addr":"mckinley@mckinley.cc","User":"mckinley","Domain":"mckinley.cc","Key":"kex1npfcevm7f5u9uhtswa804ph9lp2t6h9ettl3us4jmzk500ylja5snm55en","Endpoint":"https://salty.mills.io/inbox/01G26EQ0WPA6CDCFAVQ5HEJBH3","Avatar":"https://salty.mills.io/avatar/cb89306651329866dccaeca35b54355b284c2be2bbed9b9d473f1d73ba747dcd"}
[mckinley@t430 ~]$ salty-chat send prologic@mills.io "Hello"
error parsing addr: expected nick@domain found ""
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xad5bad]

goroutine 1 [running]:
go.mills.io/saltyim.(*Addr).Endpoint(...)
/home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/lookup.go:152
go.mills.io/saltyim.NewClient(0x0, {0xc000157c80, 0x1, 0x4804af?})
/home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/client.go:143 +0x3ad
main.send(0xdebc80?, {0xc00013c810, 0x29}, {0x7ffed2fe0c6c?, 0xc000157d78?}, {0xc000134c90, 0x1, 0x1})
/home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/send.go:70 +0x165
main.glob..func9(0x13791e0?, {0xc000134c80, 0x2, 0x2})
/home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/send.go:55 +0x1e5
github.com/spf13/cobra.(*Command).execute(0x13791e0, {0xc000134c40, 0x2, 0x2})
/home/mckinley/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x1378f60)
/home/mckinley/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
/home/mckinley/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
main.Execute()
/home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/root.go:51 +0x25
main.main()
/home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/main.go:4 +0x17
Those logs you copied in here were from before I registered with a proper broker. I'll copy the most recent log now. ``` [mckinley@t430 ~]$ dig srv _salty._tcp.mckinley.cc +short 0 0 443 salty.mills.io. [mckinley@t430 ~]$ dig srv _avatars._tcp.mckinley.cc +short 0 0 443 salty.mills.io. [mckinley@t430 ~]$ rm -rf ~/.config/salty/ [mckinley@t430 ~]$ salty-chat register mckinley@mckinley.cc salty.mills.io WARN[0002] error looking up user endpoint error="error looking up user mckinley@mckinley.cc: non-2xx response received: 404 Not Found" Success! 🥳 [mckinley@t430 ~]$ salty-chat lookup mckinley@mckinley.cc {"Addr":"mckinley@mckinley.cc","User":"mckinley","Domain":"mckinley.cc","Key":"kex1npfcevm7f5u9uhtswa804ph9lp2t6h9ettl3us4jmzk500ylja5snm55en","Endpoint":"https://salty.mills.io/inbox/01G26EQ0WPA6CDCFAVQ5HEJBH3","Avatar":"https://salty.mills.io/avatar/cb89306651329866dccaeca35b54355b284c2be2bbed9b9d473f1d73ba747dcd"} [mckinley@t430 ~]$ salty-chat send prologic@mills.io "Hello" error parsing addr: expected nick@domain found "" panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xad5bad] goroutine 1 [running]: go.mills.io/saltyim.(*Addr).Endpoint(...) /home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/lookup.go:152 go.mills.io/saltyim.NewClient(0x0, {0xc000157c80, 0x1, 0x4804af?}) /home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/client.go:143 +0x3ad main.send(0xdebc80?, {0xc00013c810, 0x29}, {0x7ffed2fe0c6c?, 0xc000157d78?}, {0xc000134c90, 0x1, 0x1}) /home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/send.go:70 +0x165 main.glob..func9(0x13791e0?, {0xc000134c80, 0x2, 0x2}) /home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/send.go:55 +0x1e5 github.com/spf13/cobra.(*Command).execute(0x13791e0, {0xc000134c40, 0x2, 0x2}) /home/mckinley/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663 github.com/spf13/cobra.(*Command).ExecuteC(0x1378f60) /home/mckinley/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4 github.com/spf13/cobra.(*Command).Execute(...) /home/mckinley/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902 main.Execute() /home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/root.go:51 +0x25 main.main() /home/mckinley/go/pkg/mod/go.mills.io/saltyim@v0.0.0-20220502022627-09826d2caac7/cmd/salty-chat/main.go:4 +0x17 ```
Poster
Owner

@mckinley Could you please try (while I try to fix this bug) the following:

$ cat ~/.config/salty/config.yml
---
identity: ~/.config/salty/prologic.key
user: prologic@mills.io

That is, create a config file and see if the crash goes away?

@mckinley Could you please try (while I try to fix this bug) the following: ```#!console $ cat ~/.config/salty/config.yml --- identity: ~/.config/salty/prologic.key user: prologic@mills.io ``` That is, create a config file and see if the crash goes away?

I created the config file, and there was no crash when I tried to send you a message. @prologic, can you confirm that you received it?

[mckinley@t430 ~]$ cat ~/.config/salty/config.yml
---
identity: ~/.config/salty/mckinley.key
user: mckinley@mckinley.cc

[mckinley@t430 ~]$ ls -l ~/.config/salty/
total 8
-rw-r--r-- 1 mckinley mckinley  71 May  5 10:10 config.yml
-rw------- 1 mckinley mckinley 232 May  3 19:34 mckinley.key
-rw-r--r-- 1 mckinley mckinley   0 May  3 20:40 state.json
[mckinley@t430 ~]$ salty-chat send prologic@mills.io "Is this thing working?"
[mckinley@t430 ~]$ echo Success?
Success?
I created the config file, and there was no crash when I tried to send you a message. @prologic, can you confirm that you received it? ``` [mckinley@t430 ~]$ cat ~/.config/salty/config.yml --- identity: ~/.config/salty/mckinley.key user: mckinley@mckinley.cc [mckinley@t430 ~]$ ls -l ~/.config/salty/ total 8 -rw-r--r-- 1 mckinley mckinley 71 May 5 10:10 config.yml -rw------- 1 mckinley mckinley 232 May 3 19:34 mckinley.key -rw-r--r-- 1 mckinley mckinley 0 May 3 20:40 state.json [mckinley@t430 ~]$ salty-chat send prologic@mills.io "Is this thing working?" [mckinley@t430 ~]$ echo Success? Success? ```

I ran touch ~/.config/salty/state.json because I was running into warnings while experimenting. Now that things are properly configured, it was preventing me from running salty-chat chat and salty-chat read.

[mckinley@t430 ~]$ salty-chat read
error initializing client: error configuring client: error loading state: error reading state: unexpected end of JSON input
[mckinley@t430 ~]$ salty-chat chat prologic@mills.io
error initializing client: error configuring client: error loading state: error reading state: unexpected end of JSON input

With that file deleted, salty-chat chat shows the somewhat confusing warning that state.json doesn't exist and hangs. Is it waiting for something on stdin? salty-chat read works as expected, I think.

[mckinley@t430 ~]$ rm ~/.config/salty/state.json 
[mckinley@t430 ~]$ salty-chat chat prologic@mills.io
WARN[0000] error opening state file /home/mckinley/.config/salty/state.json, creating an empty state  error="open /home/mckinley/.config/salty/state.json: no such file or directory"
^C
[mckinley@t430 ~]$ salty-chat read
WARN[0000] error opening state file /home/mckinley/.config/salty/state.json, creating an empty state  error="open /home/mckinley/.config/salty/state.json: no such file or directory"
2022-05-03 22:30:02	prologic@mills.io
>  Nice to see you on Slaty IM :D
I ran `touch ~/.config/salty/state.json` because I was running into warnings while experimenting. Now that things are properly configured, it was preventing me from running `salty-chat chat` and `salty-chat read`. ``` [mckinley@t430 ~]$ salty-chat read error initializing client: error configuring client: error loading state: error reading state: unexpected end of JSON input [mckinley@t430 ~]$ salty-chat chat prologic@mills.io error initializing client: error configuring client: error loading state: error reading state: unexpected end of JSON input ``` With that file deleted, `salty-chat chat` shows the somewhat confusing warning that state.json doesn't exist and hangs. Is it waiting for something on stdin? `salty-chat read` works as expected, I *think*. ``` [mckinley@t430 ~]$ rm ~/.config/salty/state.json [mckinley@t430 ~]$ salty-chat chat prologic@mills.io WARN[0000] error opening state file /home/mckinley/.config/salty/state.json, creating an empty state error="open /home/mckinley/.config/salty/state.json: no such file or directory" ^C [mckinley@t430 ~]$ salty-chat read WARN[0000] error opening state file /home/mckinley/.config/salty/state.json, creating an empty state error="open /home/mckinley/.config/salty/state.json: no such file or directory" 2022-05-03 22:30:02 prologic@mills.io > Nice to see you on Slaty IM :D
Poster
Owner

Hmmm the last example you gave I think is logging inteferring with the ncurses UI? Hmm I've seen this before, I guess I shoudlh't log this anyway, it's pointless. I'll fix that too!

Hmmm the last example you gave _I think_ is logging inteferring with the ncurses UI? Hmm I've seen this before, I guess I shoudlh't log this anyway, it's pointless. I'll fix that too!

At some point in my testing, it seemed to create a state.json and now I can use salty-chat chat properly. It loads up a TUI like I've seen in screenshots.

At some point in my testing, it seemed to create a `state.json` and now I can use `salty-chat chat` properly. It loads up a TUI like I've seen in screenshots.
[mckinley@t430]$ cat ~/.config/salty/state.json 
{"Indicies":{"01G26EQ0WPA6CDCFAVQ5HEJBH3":5}}
``` [mckinley@t430]$ cat ~/.config/salty/state.json {"Indicies":{"01G26EQ0WPA6CDCFAVQ5HEJBH3":5}} ```

I had to run salty-chat read multiple times to see all of your messages. Is this normal?

[mckinley@t430]$ salty-chat read
2022-05-05 17:17:15	prologic@mills.io
>  Soryr mate :D

[mckinley@t430]$ salty-chat read
2022-05-05 17:17:28	prologic@mills.io
>  It's in the middle of my work day and I'm prtending to do "real work" and all
>  that

[mckinley@t430]$ salty-chat read
2022-05-05 17:17:44	prologic@mills.io
>  So yes I can confirm :)

[mckinley@t430]$ salty-chat read
I had to run salty-chat read multiple times to see all of your messages. Is this normal? ``` [mckinley@t430]$ salty-chat read 2022-05-05 17:17:15 prologic@mills.io > Soryr mate :D [mckinley@t430]$ salty-chat read 2022-05-05 17:17:28 prologic@mills.io > It's in the middle of my work day and I'm prtending to do "real work" and all > that [mckinley@t430]$ salty-chat read 2022-05-05 17:17:44 prologic@mills.io > So yes I can confirm :) [mckinley@t430]$ salty-chat read ```
Poster
Owner

Thankfully I'm able to reproduce all of these bugs in this ussue quite easily:

/Users/prologic/Projects/saltyim/saltyim # ./salty-chat make-user testing123@shortcircuit.net.au
Create this file and place it on your web server
so that it is accessible at a top-level domain or sub-domain at the URL:

https://shortcircuit.net.au/.well-known/salty/a19608e9312f77465200a0f34479fca1acf23d85610b37d2b94740f4b740b1bf.json

mkdir -p .well-known/salty
cat > .well-known/salty/a19608e9312f77465200a0f34479fca1acf23d85610b37d2b94740f4b740b1bf.json << EOF
{
  "endpoint": "/01G2CBA0NZN6FAJKF9J6AWDNXR",
  "key": "kex1p67pymnupu82efldpfds3ppjctje38nmc2q48q3jmptsc5drlzeqj9qrlh"
}
EOF

To verify you have done this correctly:

$ salty-chat lookup testing123@shortcircuit.net.au
/Users/prologic/Projects/saltyim/saltyim # ./salty-chat write prologic@mills.io test
error parsing addr: expected nick@domain found ""
WARN[0000] error looking up user endpoint                error="error looking up user testing123@shortcircuit.net.au: non-2xx response received: 404 Not Found"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xad258d]

goroutine 1 [running]:
go.mills.io/saltyim.(*Addr).Endpoint(...)
	/Users/prologic/Projects/saltyim/saltyim/lookup.go:152
go.mills.io/saltyim.NewClient(0x0, {0xc0003e3c80, 0x1, 0x47e6cf?})
	/Users/prologic/Projects/saltyim/saltyim/client.go:143 +0x3ad
main.send(0xde65c0?, {0xc0000be5d0, 0x18}, {0x7ffcde18def6?, 0xc0003e3d78?}, {0xc000369cf0, 0x1, 0x1})
	/Users/prologic/Projects/saltyim/saltyim/cmd/salty-chat/send.go:70 +0x165
main.glob..func9(0x136df80?, {0xc000369ce0, 0x2, 0x2})
	/Users/prologic/Projects/saltyim/saltyim/cmd/salty-chat/send.go:55 +0x1e5
github.com/spf13/cobra.(*Command).execute(0x136df80, {0xc000369ca0, 0x2, 0x2})
	/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0x136dd00)
	/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902
main.Execute()
	/Users/prologic/Projects/saltyim/saltyim/cmd/salty-chat/root.go:51 +0x25
main.main()
	/Users/prologic/Projects/saltyim/saltyim/cmd/salty-chat/main.go:4 +0x17
/Users/prologic/Projects/saltyim/saltyim #

Planning on fixing the first issue by printing an error if you didn't specify a base url for your broker's endpoint (whether it be saltyd or msgbus or something else)

This is either passed by -e/--endpoint or a 2nd argument.

Thankfully I'm able to reproduce all of these bugs in this ussue quite easily: ``` /Users/prologic/Projects/saltyim/saltyim # ./salty-chat make-user testing123@shortcircuit.net.au Create this file and place it on your web server so that it is accessible at a top-level domain or sub-domain at the URL: https://shortcircuit.net.au/.well-known/salty/a19608e9312f77465200a0f34479fca1acf23d85610b37d2b94740f4b740b1bf.json mkdir -p .well-known/salty cat > .well-known/salty/a19608e9312f77465200a0f34479fca1acf23d85610b37d2b94740f4b740b1bf.json << EOF { "endpoint": "/01G2CBA0NZN6FAJKF9J6AWDNXR", "key": "kex1p67pymnupu82efldpfds3ppjctje38nmc2q48q3jmptsc5drlzeqj9qrlh" } EOF To verify you have done this correctly: $ salty-chat lookup testing123@shortcircuit.net.au /Users/prologic/Projects/saltyim/saltyim # ./salty-chat write prologic@mills.io test error parsing addr: expected nick@domain found "" WARN[0000] error looking up user endpoint error="error looking up user testing123@shortcircuit.net.au: non-2xx response received: 404 Not Found" panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xad258d] goroutine 1 [running]: go.mills.io/saltyim.(*Addr).Endpoint(...) /Users/prologic/Projects/saltyim/saltyim/lookup.go:152 go.mills.io/saltyim.NewClient(0x0, {0xc0003e3c80, 0x1, 0x47e6cf?}) /Users/prologic/Projects/saltyim/saltyim/client.go:143 +0x3ad main.send(0xde65c0?, {0xc0000be5d0, 0x18}, {0x7ffcde18def6?, 0xc0003e3d78?}, {0xc000369cf0, 0x1, 0x1}) /Users/prologic/Projects/saltyim/saltyim/cmd/salty-chat/send.go:70 +0x165 main.glob..func9(0x136df80?, {0xc000369ce0, 0x2, 0x2}) /Users/prologic/Projects/saltyim/saltyim/cmd/salty-chat/send.go:55 +0x1e5 github.com/spf13/cobra.(*Command).execute(0x136df80, {0xc000369ca0, 0x2, 0x2}) /go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:860 +0x663 github.com/spf13/cobra.(*Command).ExecuteC(0x136dd00) /go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x3b4 github.com/spf13/cobra.(*Command).Execute(...) /go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:902 main.Execute() /Users/prologic/Projects/saltyim/saltyim/cmd/salty-chat/root.go:51 +0x25 main.main() /Users/prologic/Projects/saltyim/saltyim/cmd/salty-chat/main.go:4 +0x17 /Users/prologic/Projects/saltyim/saltyim # ``` Planning on fixing the first issue by printing an error if you didn't specify a base url for your broker's endpoint (whether it be saltyd or msgbus or something else) This is either passed by `-e/--endpoint` or a 2nd argument.
Poster
Owner

Something like this:

/Users/prologic/Projects/saltyim/saltyim # ./salty-chat make-user testing123@shortcircuit.net.au
error: invalid endpoint "" try passing -e/--endpoint or a 2nd argument
/Users/prologic/Projects/saltyim/saltyim #

We okay with this?

make-user is the old manual way of creating a Salty Addr and setting up a valid Well-Known config and Inbox. It's a bit more work, but it still works and is still supported (AFAIK we will always support it, including the original shell script).

Something like this: ``` /Users/prologic/Projects/saltyim/saltyim # ./salty-chat make-user testing123@shortcircuit.net.au error: invalid endpoint "" try passing -e/--endpoint or a 2nd argument /Users/prologic/Projects/saltyim/saltyim # ``` We okay with this? `make-user` is the old manual way of creating a Salty Addr and setting up a valid Well-Known config and Inbox. It's a bit more work, but it still works and is still supported (AFAIK we will always support it, including the original shell script).
prologic closed this issue 2 weeks ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.