diff --git a/.gitignore b/.gitignore index 8067297..610e6b7 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ __pycache__/ # Distribution / packaging / virtualenv .Python +.bash_history env/ build/ develop-eggs/ diff --git a/README.md b/README.md index ffc678e..2a2789d 100644 --- a/README.md +++ b/README.md @@ -275,7 +275,7 @@ curl -X POST -d '{"tag":"leaders teamA, leaders teamB", "body":"meeting now"}' \ ### API Notes - `{KEY}` must be 1-128 alphanumeric characters in length. In addition to this, the underscore (`_`) and dash (`-`) are also accepted. - - Consider using keys like `sha1`, `sha512`, `uuid`, etc to secure shared namespaces if you wish to open your platform to others. Or keep it simple in a controlled environment and just use the default string `apprise` as your key (and as illustrated in the examples above). + - Consider using keys like `sha1`, `sha512`, `uuid`, etc to secure shared namespaces if you wish to open your platform to others. Or keep it simple in a controlled environment and just use the default string `apprise` as your key (and as illustrated in the examples above). You can over-ride this default value by setting the `APPRISE_DEFAULT_CONFIG_ID`(see below). - Specify the `Content-Type` of `application/json` to use the JSON support otherwise the default expected format is `application/x-www-form-urlencoded` (whether it is specified or not). - There is no authentication (or SSL encryption) required to use this API; this is by design. The intention here is to be a light-weight and fast micro-service. - There are no additional dependencies (such as database requirements, etc) should you choose to use the optional persistent store (mounted as `/config`). @@ -287,6 +287,7 @@ The use of environment variables allow you to provide over-rides to default sett | Variable | Description | |--------------------- | ----------- | | `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. +| `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. | `APPRISE_CONFIG_DIR` | Defines an (optional) persistent store location of all configuration files saved. By default:
- 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`. | `APPRISE_ATTACH_DIR` | The directory the uploaded attachments are placed in. By default:
- Attachments are written to the `apprise_api/var/attach` directory when just using the _Django_ `manage runserver` script. However for the path for the container is `/attach`. | `APPRISE_ATTACH_SIZE` | Over-ride the attachment size (defined in MB). By default it is set to `200` (Megabytes). You can set this up to a maximum value of `500` which is the restriction in place for NginX (internal hosting ervice) at this time. If you set this to zero (`0`) then attachments will not be passed along even if provided. diff --git a/apprise_api/api/context_processors.py b/apprise_api/api/context_processors.py index e1fb378..90849d0 100644 --- a/apprise_api/api/context_processors.py +++ b/apprise_api/api/context_processors.py @@ -22,6 +22,7 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. +from .utils import gen_unique_config_id from .utils import ConfigCache from django.conf import settings import apprise @@ -46,3 +47,17 @@ def apprise_version(request): Returns the current version of apprise loaded under the hood """ return {'APPRISE_VERSION': apprise.__version__} + + +def default_config_id(request): + """ + Returns a unique config identifier + """ + return {'DEFAULT_CONFIG_ID': settings.APPRISE_DEFAULT_CONFIG_ID} + + +def unique_config_id(request): + """ + Returns a unique config identifier + """ + return {'UNIQUE_CONFIG_ID': gen_unique_config_id()} diff --git a/apprise_api/api/templates/base.html b/apprise_api/api/templates/base.html index 1164a76..dee0a6b 100644 --- a/apprise_api/api/templates/base.html +++ b/apprise_api/api/templates/base.html @@ -36,7 +36,7 @@

{% trans "Apprise API" %}

@@ -46,8 +46,10 @@
{% if STATEFUL_MODE != 'disabled' %} {% endif %}