|
|
|
## Step 1
|
|
|
|
To install this API on your enviroment, please install requirements for Django: [https://docs.djangoproject.com/en/3.0/topics/install/](https://docs.djangoproject.com/en/3.0/topics/install/)
|
|
|
|
|
|
|
|
Then proceed to install required libraries:
|
|
|
|
## Step 2
|
|
|
|
Install required libraries:
|
|
|
|
* `pip install wheel` (There can be issues when installing rest-framework if wheel is not installed
|
|
|
|
* `pip install pycryptodome==3.4.3`
|
|
|
|
* `pip install crypto`
|
| ... | ... | @@ -9,3 +11,31 @@ Then proceed to install required libraries: |
|
|
|
* `pip install urllib`
|
|
|
|
* `pip install djangorestframework`
|
|
|
|
|
|
|
|
## Step 3
|
|
|
|
Configuration setup:
|
|
|
|
1. Navigate to the project's root, and enter this command: `python cmd_utils/genkey.py`, you'll get a secret key to terminal. Copy that value, and place it in `settings.py`'s `SECRET_KEY` value (i.e. `SECRET_KEY = 'YOUR_GENERATED_KEY'`)
|
|
|
|
2. Copy/rename file `notifier.example.py` to `notifier.py`
|
|
|
|
|
|
|
|
# Step 4
|
|
|
|
Configure `notifier.py`
|
|
|
|
|
|
|
|
These are available settings to configure:
|
|
|
|
### `API_KEY_CHECK_ENABLED`
|
|
|
|
This boolean will enable to check if apikey is included and correct using the `API_KEYS` string array, which contains all API keys that you define
|
|
|
|
### `API_KEYS`
|
|
|
|
This array should contain String API keys if `API_KEY_CHECK_ENABLED` is set to true. Include one of defined keys to `apikey` parameter in your API requests. Otherwise request gets blocked because of missing or invalid `apikey`
|
|
|
|
### `DJANGO_ADMIN_PANEL`
|
|
|
|
This boolean enables or disables the Django Administration site, which you can access at `/admin` if enabled
|
|
|
|
### `VALIDATE_CLIENT_KEY`
|
|
|
|
When client gives its FCM Key (Instance ID), API can validate if the key is yours by checking if it exists, and is created from allowed source which you define in `VALID_CLIENT_PACKAGES`
|
|
|
|
### `VALID_CLIENT_PACKAGES`
|
|
|
|
This array should contain Android App's package names if `VALIDATE_CLIENT_KEY` is set to true. You should define your own apps package names which needs notifier REST Api to deny access from other apps.
|
|
|
|
### `NOTIFIER_ROUTINES`
|
|
|
|
By default there are some routines that Wilma Plus supports. You can add your own by defining its package name, and class name like shown in the example (`{'package': 'routines.exams', 'class': 'Exams'}`)
|
|
|
|
### `FCM_SERVER_KEY`
|
|
|
|
In order to send Push messages to the client, you need to fill in your Firebase Cloud Messaging Server Key. You can find it in Firebase Control Panel (**Project Settings -> Cloud Messaging**)
|
|
|
|
### `IID_SERVER_KEY`
|
|
|
|
In order to verify FCM Keys (Instance IDs), you need to fill in your Firebase Cloud Messaging API key. You can find it in Firebase Control Panel (**Project Settings -> Cloud Messaging**)
|
|
|
|
|
|
|
|
### `FCM_URL` and `IID_URL`
|
|
|
|
These should be unchanged, as they are API URLs to Google's API servers |
|
|
\ No newline at end of file |