Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental push notification support (via NTFY) #227

Open
wants to merge 8 commits into
base: 1.5
Choose a base branch
from

Conversation

mgrimace
Copy link
Contributor

@mgrimace mgrimace commented Feb 8, 2025

This PR adds experimental push notification support via NTFY, closing FR #90

Summary of changes:

  • users input NTFY server, topic, and optionally auth in the config.json, parsed using Config.ts
  • Logger.ts matches [LOG], [ERROR], and [WARN] against customizable key words to generate notifications (with comments added to show where such customization can occur)
  • Ntfy.sh sends customizable notifications using Axios.ts, which include emojis and prioritization based on type (e.g., high priority for warnings).
  • Readme updated to briefly describe setup, and customization options.

By default, notifications are sent for each account: script started, 2FA/passwordless code, script successfully completed, and major warnings (e.g., searches not completed).

Huge thanks to @AariaX for fixing axios support for sending.

- Push notifications via NTFY. Only keywords, warn, and error are pushed.
completed tasks for (to remove other completed messages). Press the number to show 2FA codes.
Fixes unsent notifications. Notifications match keywords in log, error, and warn. NTFY title, priority, emoji, and body sent.

Since push, not all warn, log, or error wanted.
With thanks to @AariaX for fixing notification sending via axios
Typo, forgot 'log', whoops
Placeholder for when support for 'the script collected xxx points' is working in index.ts. This will push the total points collected as a notification
src/util/Logger.ts Outdated Show resolved Hide resolved
@AariaX
Copy link

AariaX commented Feb 8, 2025

log('main', 'MAIN-WORKER', 'All workers destroyed. Exiting main process!', 'warn')

Changing this to "Completed tasks for ALL accounts" might be nice?

@mgrimace
Copy link
Contributor Author

mgrimace commented Feb 8, 2025

log('main', 'MAIN-WORKER', 'All workers destroyed. Exiting main process!', 'warn')

Changing this to "Completed tasks for ALL accounts" might be nice?

I do get a [LOG] line that says 'completed tasks for ALL accounts' for each cluster/account = 2 notifications. I do personally prefer having it 'completed for email' instead so I could verify both completed.

If this change would generate one summary notification for all clusters that is beneficial. If it shows up as a [WARN] it would be easier to isolate from logs, but as a notification it might also (at a glance) look like there's a problem if it does show up with the warn tag.

Does all workers destroyed == tasks completed? Then there'd be no harm in changing it.

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.

2 participants