Whistleblower

The Whistleblower plugin is a free and open-source extension for Grav CMS.

It allows you to hook on to the native Grav Lifecycle to send custom messages through a ntfy.sh server instance.

Installation

Whistleblower is part of the official Grav repository.

Check our guide for installing Open-Source plugins.


Configuration

Setting Description Type
Enabled Enables/disables plugin functionality Boolean (default: true)
Admin Mode Whether to listen exclusively for events fired on the admin panel Boolean (default: true)
Custom Server URL to a ntfy instance. Leave null to use the public server String (default: null)
Custom Password Password if required by the custom server String (default: null)
Endpoint The ntfy endpoint/topic to send the messages String (default: null)
Events A key-value array, where the keys are the event hooks to listen and the values the messages. Check below how to customize messages. Array

user/plugins/whistleblower/whistleblower.yaml:

enabled: true
admin_mode: true
# custom_server:
# custom_password:
endpoint: ""
events:
    onUserLogin: "Someone has logged on {domain}!"
    onUserLoginFailure: "Failed login attempt at {hour}"

Variables

Variables are special keywords, that we can use on our messages, that are encapsulated within brackets {} and then are replaced by values which depend on the server or event that's getting fired.

Variable Value Example
{site} Your site name {site} has been backed up
{domain} Your domain name Someone has logged on {domain}!
{username} The username of the logged user if any {username} has deleted a page
{date} The current date in 12.31.22 format Task executed the {date}
{hour} The current hour in 7:39 PM format Failed login attempt at {hour}

Usage

To start using the plugin you need to setup a ntfy endpoint. If you're going to use the public server make sure your endpoint is unique, since anyone could guess your endpoint and listen for all notifications.

Once setup, you can start adding any event hooks from Grav or Grav plugins and pairing them with a message you want to receive.

You can use a variety of variables to customize your messages. Such as {username} to receive the user who executed the event.

To start listening to the notifications you can either install the NTFY app available at the F-Droid Store or the Google Play Store.

Or you can choose to use the Web App.

To finish, just add the exact endpoint/topic you setup on the plugin configuration.


ntfy.sh app

There are official ntfy mobile applications both for Android and iOS.

We highly recommend you the application, since this is the main reason why we created this plugin. Have the certainty of what occurs on your server at the reach of your pocket.

Download through:


Support


Credits

Thanks to Philip C. Heckel and the contributors of ntfy for making this service publicly available and free.