Skip to content

Commit 00013b4

Browse files
authored
Major refactor and improvements (#283)
1 parent 37ba48e commit 00013b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+5740
-3697
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Chris Caron <[email protected]>
3+
Copyright (c) 2025 Chris Caron <[email protected]>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ docker run --name apprise \
7171
-v /path/to/local/attach:/attach \
7272
-e APPRISE_STATEFUL_MODE=simple \
7373
-e APPRISE_WORKER_COUNT=1 \
74+
-e APPRISE_ADMIN=y \
7475
-d caronc/apprise:latest
7576
```
7677

@@ -89,6 +90,7 @@ docker run --name apprise \
8990
--user "$(id -u):$(id -g)" \
9091
-e APPRISE_STATEFUL_MODE=simple \
9192
-e APPRISE_WORKER_COUNT=1 \
93+
-e APPRISE_ADMIN=y \
9294
-v /etc/apprise:/config \
9395
-d apprise/local:latest
9496

@@ -100,6 +102,7 @@ docker run --name apprise \
100102
--user "$(id -u):$(id -g)" \
101103
-e APPRISE_STATEFUL_MODE=simple \
102104
-e APPRISE_WORKER_COUNT=1 \
105+
-e APPRISE_ADMIN=y \
103106
-v ./config:/config \
104107
-d apprise/local:latest
105108
```
@@ -119,6 +122,7 @@ services:
119122
environment:
120123
APPRISE_STATEFUL_MODE: simple
121124
APPRISE_WORKER_COUNT: "1"
125+
APPRISE_ADMIN: "y"
122126
volumes:
123127
- ./config:/config
124128
- ./plugin:/plugin
@@ -157,6 +161,7 @@ services:
157161
environment:
158162
APPRISE_STATEFUL_MODE: simple
159163
APPRISE_WORKER_COUNT: "1"
164+
APPRISE_ADMIN: "y"
160165
161166
# Persistent state
162167
volumes:
@@ -300,7 +305,7 @@ curl -X POST -d '{"urls": "mailto://user:[email protected]", "body":"test message"}
300305
# Send a notification with a URL based attachment
301306
curl -X POST \
302307
-F 'urls=mailto://user:[email protected]' \
303-
-F attach=attach=https://raw.githubusercontent.com/caronc/apprise/master/apprise/assets/themes/default/apprise-logo.png \
308+
-F attach=https://raw.githubusercontent.com/caronc/apprise/master/apprise/assets/themes/default/apprise-logo.png \
304309
http://localhost:8000/notify
305310
```
306311

@@ -336,7 +341,8 @@ You can pre-save all of your Apprise configuration and/or set of Apprise URLs an
336341
|------------- | ------ | ----------- |
337342
| `/add/{KEY}` | POST | Saves Apprise Configuration (or set of URLs) to the persistent store.<br/>*Payload Parameters*<br/>📌 **urls**: Define one or more Apprise URL(s) here. Use a comma and/or space to separate one URL from the next.<br/>📌 **config**: Provide the contents of either a YAML or TEXT based Apprise configuration.<br/>📌 **format**: This field is only required if you've specified the *config* parameter. Used to tell the server which of the supported (Apprise) configuration types you are passing. Valid options are *text* and *yaml*. This path does not work if `APPRISE_CONFIG_LOCK` is set.
338343
| `/del/{KEY}` | POST | Removes Apprise Configuration from the persistent store. This path does not work if `APPRISE_CONFIG_LOCK` is set.
339-
| `/get/{KEY}` | POST | Returns the Apprise Configuration from the persistent store. This can be directly used with the *Apprise CLI* and/or the *AppriseConfig()* object ([see here for details](https://github.com/caronc/apprise/wiki/config)). This path does not work if `APPRISE_CONFIG_LOCK` is set.
344+
| `/cfg/{KEY}` | POST | Returns the Apprise Configuration from the persistent store. This can be directly used with the *Apprise CLI* and/or the *AppriseConfig()* object ([see here for details](https://github.com/caronc/apprise/wiki/config)). This path does not work if `APPRISE_CONFIG_LOCK` is set. This is an alias of `/get/{KEY}` (identified next).
345+
| `/get/{KEY}` | POST | Returns the Apprise Configuration from the persistent store. This can be directly used with the *Apprise CLI* and/or the *AppriseConfig()* object ([see here for details](https://github.com/caronc/apprise/wiki/config)). This path does not work if `APPRISE_CONFIG_LOCK` is set. This is also provided via `/cfg/{KEY}` as an alias.
340346
| `/notify/{KEY}` | POST | Sends notification(s) to all of the end points you've previously configured associated with a *{KEY}*.<br/>*Payload Parameters*<br/>📌 **body**: Your message body. This is the *only* required field.<br/>📌 **title**: Optionally define a title to go along with the *body*.<br/>📌 **type**: Defines the message type you want to send as. The valid options are `info`, `success`, `warning`, and `failure`. If no *type* is specified then `info` is the default value used.<br/>📌 **tag**: Optionally notify only those tagged accordingly. Use a comma (`,`) to `OR` your tags and a space (` `) to `AND` them. More details on this can be seen documented below.<br/>📌 **format**: Optionally identify the text format of the data you're feeding Apprise. The valid options are `text`, `markdown`, `html`. The default value if nothing is specified is `text`.
341347
| `/json/urls/{KEY}` | GET | Returns a JSON response object that contains all of the URLS and Tags associated with the key specified.
342348
| `/details` | GET | Set the `Accept` Header to `application/json` and retrieve a JSON response object that contains all of the supported Apprise URLs. See [here for more details](https://github.com/caronc/apprise/wiki/Development_Apprise_Details#apprise-details)
@@ -392,7 +398,7 @@ curl -X POST \
392398
# Send a notification with a URL based attachment
393399
curl -X POST \
394400
-F 'urls=mailto://user:[email protected]' \
395-
-F attach=attach=https://raw.githubusercontent.com/caronc/apprise/master/apprise/assets/themes/default/apprise-logo.png \
401+
-F attach=https://raw.githubusercontent.com/caronc/apprise/master/apprise/assets/themes/default/apprise-logo.png \
396402
http://localhost:8000/notify/abc123
397403
```
398404

@@ -483,6 +489,8 @@ The use of environment variables allow you to provide over-rides to default sett
483489
| `IPV4_ONLY` | Force an all IPv4 only environment (default supports both IPV4 and IPv6). Nothing is done if `IPV6_ONLY` is also set as this creates an ambigious setup. **Note**: This only works if the container is not explicitly started with `--user` or `user:`.
484490
| `IPV6_ONLY` | Force an all IPv6 only environment (default supports both IPv4 and IPv6). Nothing is done if `IPV4_ONLY` is also set as this creates an ambigious setup. **Note**: This only works if the container is not explicitly started with `--user` or `user:`.
485491
| `HTTP_PORT` | Force the default listening port to be something other then `8000` within the Docker container. **Note**: This only works if the container is not explicitly started with `--user` or `user:`.
492+
| `STRICT_MODE` | Applicable only to container deployments; if this is set to `yes`, the NginX instance will not return content on any invalid or unsupported request. This is incredibly useful for those hosting Apprise publicly and pairs nicely with fail2ban. By default, the system does not operate in this strict mode.
493+
| `APPRISE_DEFAULT_THEME` | Can be set to `light` or `dark`; it defaults to `light` if not otherwise provided. The theme can be toggled from within the website as well.
486494
| `APPRISE_DEFAULT_THEME` | Can be set to `light` or `dark`; it defaults to `light` if not otherwise provided. The theme can be toggled from within the website as well.
487495
| `APPRISE_DEFAULT_CONFIG_ID` | Defaults to `apprise`. This is the presumed configuration ID you always default to when accessing the configuration manager via the website.
488496
| `APPRISE_CONFIG_DIR` | Defines an (optional) persistent store location of all configuration files saved. By default:<br/> - Configuration is written to the `apprise_api/var/config` directory when just using the _Django_ `manage runserver` script. However for the path for the container is `/config`.
@@ -502,7 +510,6 @@ The use of environment variables allow you to provide over-rides to default sett
502510
| `APPRISE_ALLOW_SERVICES` | A comma separated set of entries identifying what plugins to allow access to. You may only use alpha-numeric characters as is the restriction of Apprise Schemas (schema://) anyway. To exclusively include more the one upstream service, simply specify additional entries separated by a `,` (comma) or ` ` (space). The `APPRISE_DENY_SERVICES` entries are ignored if the `APPRISE_ALLOW_SERVICES` is identified.
503511
| `APPRISE_ATTACH_ALLOW_URLS` | A comma separated set of entries identifying the HTTP Attach URLs the Apprise API shall always accept. Use wildcards such as `*` and `?` to help construct the URL/Hosts you identify. Use a space and/or a comma to identify more then one entry. By default this is set to `*` (Accept all provided URLs).
504512
| `APPRISE_ATTACH_DENY_URLS` | A comma separated set of entries identifying the HTTP Attach URLs the Apprise API shall always reject. Use wildcards such as `*` and `?` to help construct the URL/Hosts you identify. The `APPRISE_ATTACH_DENY_URLS` is always processed before the `APPRISE_ATTACH_ALLOW_URLS` list. Use a space and/or a comma to identify more then one entry. By default this is set to `127.0.* localhost*`.
505-
By default this
506513
| `SECRET_KEY` | A Django variable acting as a *salt* for most things that require security. This API uses it for the hash sequences when writing the configuration files to disk (`hash` mode only).
507514
| `ALLOWED_HOSTS` | A list of strings representing the host/domain names that this API can serve. This is a security measure to prevent HTTP Host header attacks, which are possible even under many seemingly-safe web server configurations. By default this is set to `*` allowing any host. Use space to delimit more than one host.
508515
| `APPRISE_PLUGIN_PATHS` | Apprise supports the ability to define your own `schema://` definitions and load them. To read more about how you can create your own customizations, check out [this link here](https://github.com/caronc/apprise/wiki/decorator_notify). You may define one or more paths (separated by comma `,`) here. By default the `apprise_api/var/plugin` directory is scanned (which does not include anything). Feel free to set this to an empty string to disable any custom plugin loading.
@@ -556,6 +563,7 @@ docker run --name apprise \
556563
-v ./apprise_api.htpasswd:/etc/nginx/.htpasswd:ro \
557564
-e APPRISE_STATEFUL_MODE=simple \
558565
-e APPRISE_WORKER_COUNT=1 \
566+
-e APPRISE_ADMIN=y \
559567
-d caronc/apprise:latest
560568
```
561569

@@ -747,6 +755,8 @@ spec:
747755
value: simple
748756
- name: APPRISE_WORKER_COUNT
749757
value: "1"
758+
- name: APPRISE_ADMIN
759+
value: "y"
750760
ports:
751761
- containerPort: 8000
752762
name: http
@@ -783,28 +793,23 @@ spec:
783793
```
784794

785795
## Development Environment
786-
The following should get you a working development environment (min requirements are Python v3.12) to test with.
787-
788-
### Setup
789-
790-
```bash
791-
# Create and activate a Python 3.12 virtual environment:
792-
python3.12 -m venv .venv
793-
. .venv/bin/activate
794-
795-
# Install core dependencies:
796-
797-
pip install -e '.[dev]'
798-
```
799-
800-
### Running the Dev Server
796+
The following should get you a working development server to test with:
801797

798+
### Bare Metal
802799
```bash
803800
# Start the development server in debug mode:
804-
./manage.py runserver
801+
tox -e runserver
805802
# Then visit: http://localhost:8000/
803+
804+
# If you want to run on a different port:
805+
tox -e runserver -- "localhost:8080"
806+
# Then visit: http://localhost:8000/
807+
808+
# You can also bind it to all of your interfaces like so:
809+
tox -e runserver -- "0.0.0.0:8080"
806810
```
807811

812+
### Docker Containers
808813
For development, the repository includes a `docker-compose.override.yml` file
809814
that extends `docker-compose.yml` to build from source and bind-mount the code.
810815
Running:
@@ -999,3 +1004,17 @@ The colon `:` prefix is the switch that starts the re-mapping rule engine. You
9991004

10001005
Basic Prometheus support added through `/metrics` reference point.
10011006

1007+
## OpenAPI / Swagger Specification
1008+
1009+
Apprise API includes an OpenAPI 3 specification in `swagger.yaml` at the root
1010+
of the repository.
1011+
1012+
For local development you can bring up a standalone Swagger UI that reads the
1013+
checked-in spec file without changing how Apprise API runs:
1014+
1015+
```bash
1016+
docker compose -f docker-compose.swagger.yml up -d
1017+
# Then browse to:
1018+
# http://localhost:8001
1019+
```
1020+

Screenshot-1.png

4.15 KB
Loading

Screenshot-2.png

21.6 KB
Loading

Screenshot-3.png

-5.52 KB
Loading

Screenshot-4.png

5.42 KB
Loading

apprise_api/__init__.py

Whitespace-only changes.

apprise_api/api/apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (C) 2019 Chris Caron <[email protected]>
2+
# Copyright (C) 2025 Chris Caron <[email protected]>
33
# All rights reserved.
44
#
55
# This code is licensed under the MIT License.

apprise_api/api/context_processors.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (C) 2020 Chris Caron <[email protected]>
2+
# Copyright (C) 2025 Chris Caron <[email protected]>
33
# All rights reserved.
44
#
55
# This code is licensed under the MIT License.
@@ -49,11 +49,22 @@ def admin_enabled(request):
4949
return {"APPRISE_ADMIN": settings.APPRISE_ADMIN}
5050

5151

52-
def apprise_version(request):
52+
def apprise_metadata(request):
5353
"""
54-
Returns the current version of apprise loaded under the hood
54+
Returns the current details of the Apprise Library and API under the hood
5555
"""
56-
return {"APPRISE_VERSION": apprise.__version__}
56+
57+
return {
58+
"APPRISE_LIB_VERSION": apprise.__version__,
59+
"APPRISE_LIB_URL": "http://github.com/caronc/apprise",
60+
61+
"APPRISE_API_VERSION": settings.APP_VERSION,
62+
"APPRISE_API_URL": settings.APP_URL,
63+
"APPRISE_API_LICENSE": settings.APP_LICENSE,
64+
"APPRISE_API_COPYRIGHT": settings.APP_COPYRIGHT,
65+
66+
"APPRISE_AUTHOR": settings.APP_AUTHOR,
67+
}
5768

5869

5970
def default_config_id(request):

apprise_api/api/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (C) 2019 Chris Caron <[email protected]>
2+
# Copyright (C) 2025 Chris Caron <[email protected]>
33
# All rights reserved.
44
#
55
# This code is licensed under the MIT License.

0 commit comments

Comments
 (0)