Skip to content

Conversation

@fyrk
Copy link
Contributor

@fyrk fyrk commented Nov 10, 2025

This adds a new reporter for ntfy.
Closes #762 (were it not already closed).

It sends one message per job state since I think this aligns best with ntfy's design: It allows to show an "Open URL" action per notification/job.

Copy link
Owner

@thp thp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments. Also add an entry for this to CHANGELOG.md in the UNRELEASED section (search for "New reporter" there for examples).

if priority := config_priorities.get(job_state.verb):
job_headers["Priority"] = priority
if job_state.job.location_is_url():
job_headers['Actions'] = f"view, Open URL, {job_state.job.get_location()}, clear=true".encode('utf-8')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if job_state.job.get_location() contains , ? Does this value need to be URL-escaped?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch! Values can be quoted with ", so I did that.

Now, I'm not sure if the URL might contain ", of course... If so, the HtmlReporter seems to suffer from this as well, so I'd say this requires a separate fix.

if job.location_is_url():
title = '<a href="{location}">{pretty_name}</a>'
elif job.pretty_name() != job.get_location():
title = '<span title="{location}">{pretty_name}</span>'
else:
title = '{location}'
title = '<h2><span class="verb">{verb}:</span> ' + title + '</h2>'
yield SafeHtml(title).format(verb=job_state.verb,
location=job.get_location(),
pretty_name=job.pretty_name())

@thp thp mentioned this pull request Nov 18, 2025
@fyrk fyrk force-pushed the add-ntfy-reporter branch from bf73471 to af5d1ee Compare November 18, 2025 14:54
@fyrk fyrk requested a review from thp November 18, 2025 14:59
@fyrk
Copy link
Contributor Author

fyrk commented Nov 30, 2025

@thp This should fix the pytest CI :)

@thp thp merged commit 4bbc282 into thp:master Dec 2, 2025
5 checks passed
@thp
Copy link
Owner

thp commented Dec 2, 2025

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Built-in "ntfy" reporter

2 participants