dgtlmoon / changedetection.io

The best and simplest free open source web page change detection, website watcher, restock monitor and notification service. Restock Monitor, change detection. Designed for simplicity - Simply monitor which websites had a text change for free. Free Open source web page change detection, Website defacement monitoring, Price change notification
https://changedetection.io
Apache License 2.0
16.9k stars 943 forks source link

Ntfy broken due to avatar_url= appended to the apprise url #2611

Closed ihatethecloud closed 1 week ago

ihatethecloud commented 1 week ago

Describe the bug

?avatar_url=https://raw.githubusercontent.com/dgtlmoon/changedetection.io/master/changedetectionio/static/images/avatar-256x256.png

appended to each notification line

2024/09/06 19:36:39,000 - SENDING - [{"title": "example title", "body": "example body", "url": "ntfy://user:password@ntfy.domain.com/topic?avatar_url=https://raw.githubusercontent.com/dgtlmoon/changedetection.io/master/changedetectionio/static/images/avatar-256x256.png", "body_format": "text"}, {"title": "example title2", "body": "example body2", "url": "tgram://token/chat-id?avatar_url=https://raw.githubusercontent.com/dgtlmoon/changedetection.io/master/changedetectionio/static/images/avatar-256x256.png", "body_format": "text"}]

Works fine with telegram but breaks ntfy.

Version v0.46.04

To Reproduce

Steps to reproduce the behavior:

  1. Go to Settings
  2. Go to Notifications
  3. Add telegram
  4. Add ntfy
  5. Click Send test notification
  6. Check notification log
  7. Telegram works
  8. ntfy doesn't

Expected behavior Notification sent via ntfy

dgtlmoon commented 1 week ago

please, can be more descriptive and paste the full and exact notification URL you are using, without your passwords etc obviously?

dgtlmoon commented 1 week ago

ntfy://sometopic 100% works, I cant follow what you're saying here, are YOU adding the avatar_url or? its kind of confusing (the system will add it in some cases)

ihatethecloud commented 1 week ago
Screenshot 2024-09-08 at 06 52 19 Screenshot 2024-09-08 at 06 54 21

Ntfy seems to dislike the ?avatar_url added by changedetection after the topic

dgtlmoon commented 1 week ago

@ihatethecloud can you test with a "public" channel with only like ntfy://some-cdio-test ? (and subscribe to that)

dgtlmoon commented 1 week ago

I suspect it gets confused when the username+password is added - which is why i wrote that we need to see your full notification information there

dgtlmoon commented 1 week ago

Running the ntfy container locally to test docker run -p 80:80 -it binwiederhier/ntfy serve

echo hello|apprise "ntfy://username:password@localhost/topic?avatar_url=https://raw.githubusercontent.com/dgtlmoon/changedetection.io/master/changedetectionio/static/images/avatar-256x256.png"

I can see via tcpdump that it works

POST / HTTP/1.1
Host: localhost
User-Agent: Apprise
Accept-Encoding: gzip, deflate, br
Accept: */*
Connection: keep-alive
Content-Type: application/json
X-Icon: https://raw.githubusercontent.com/dgtlmoon/changedetection.io/master/changedetectionio/static/images/avatar-256x256.png
Content-Length: 38
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
2]{"topic": "topic", "message": "hello"}{
2]HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json
Date: Mon, 09 Sep 2024 09:44:27 GMT
Content-Length: 242
{"id":"nUxk12sMKzfN","time":1725875067,"expires":1725918267,"event":"message","topic":"topic","message":"hello","icon":"https://raw.githubusercontent.com/dgtlmoon/changedetection.io/master/changedetectionio/static/images/avatar-256x256.png"}

when i test from the notification/changedetection.io settings page

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json
Date: Mon, 09 Sep 2024 09:45:37 GMT
Content-Length: 767
{"id":"AJoeZ4Uh45Jr","time":1725875137,"expires":1725918337,"event":"message","topic":"topic","title":"ChangeDetection.io Notification - https://www.pulltheplugpatches.com/collections/embroidered-backpatches/products/cannibal-corpse-butchered-at-birth-1","message":"https://www.pulltheplugpatches.com/collections/embroidered-backpatches/products/cannibal-corpse-butchered-at-birth-1 had a change.\n---\n(changed) Example text: change detection is cool\n(changed) Example text: some more examples\n(into) Example text: change detection is fantastic\n(into) Example text: even more examples\n(into) Example text: a lot more examples\n---","icon":"https://raw.githubusercontent.com/dgtlmoon/changedetection.io/master/changedetectionio/static/images/avatar-256x256.png"}

it's also a success

so I dont know what you mean by 'ntfy broken' unfortunately

can you provide more info?