bark: each push carries magpie's icon (豆子 on Discord)
A Bark push showed Bark's default icon, so in the notification list it wasn't clear the push came from magpie. Push now sends Bark's `icon` field, pointing at https://usemagpie.ai/apple-touch-icon.png: the app's own 180px apple-touch-icon, copied into site/public and already deployed (curl: 200 image/png). Run: - mote-run go test -count=1 ./internal/bark: ok (the push test now checks the icon field). - gofmt -l internal/bark: clean. Not tried: a real push to the Bark app on a phone.
This commit is contained in:
@@ -51,6 +51,10 @@ func proxied() http.RoundTripper {
|
||||
// group names the pushes in the Bark app's list.
|
||||
const group = "magpie"
|
||||
|
||||
// icon is magpie's own icon, which the Bark app shows on each push. It is
|
||||
// the site's copy of the app's apple-touch-icon.
|
||||
const icon = "https://usemagpie.ai/apple-touch-icon.png"
|
||||
|
||||
// Push sends title and body to t. The error names the server's answer,
|
||||
// never the device key.
|
||||
func Push(ctx context.Context, t Target, title, body string) error {
|
||||
@@ -62,6 +66,7 @@ func Push(ctx context.Context, t Target, title, body string) error {
|
||||
"title": title,
|
||||
"body": body,
|
||||
"group": group,
|
||||
"icon": icon,
|
||||
})
|
||||
req, err := http.NewRequestWithContext(ctx, "POST", t.url(), bytes.NewReader(b))
|
||||
if err != nil {
|
||||
|
||||
@@ -49,7 +49,7 @@ func TestPushPostsJSONAndNeverPutsTheKeyInTheAddress(t *testing.T) {
|
||||
t.Fatalf("requests %v", f.urls)
|
||||
}
|
||||
m := f.got[0]
|
||||
if m["device_key"] != "SECRETKEY123" || m["title"] != "Title" || m["body"] != "Body" || m["group"] != "magpie" {
|
||||
if m["device_key"] != "SECRETKEY123" || m["title"] != "Title" || m["body"] != "Body" || m["group"] != "magpie" || m["icon"] != "https://usemagpie.ai/apple-touch-icon.png" {
|
||||
t.Fatalf("body %v", m)
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
Reference in New Issue
Block a user