diff --git a/README.md b/README.md index a816d5b..23b404b 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,25 @@ The way this is implemented works in the following order: - No: Return error 420 - Yes: Continue and display UI of configurator +### API + +Starting at version 0.2.5 you can add / remove IP addresses and networks from and to the `ALLOWED_NETWORKS` and `BANNED_IPS` lists at runtime. Keep in mind though, that these changes are not persistent and will be lost when the service is restarted. The API can be used through the UI in the _Network status_ menu or by sending POST requests. A possible use case could be programmatically allowing access from your dynamic public IP, which can be required for some setups involving SSL. + +#### API targets: + +- `api/allowed_networks` + #### Methods: + - `add` + - `remove` + #### Example: + - `curl -d "method=add&network=1.2.3.4" -X POST http://127.0.0.1:3218/api/allowed_networks` +- `api/banned_ips` + #### Methods: + - `ban` + - `unban` + #### Example: + - Example: `curl -d "method=ban&ip=9.9.9.9" -X POST http://127.0.0.1:3218/api/banned_ips` + ### Embedding into HASS HASS has the [panel_iframe](https://home-assistant.io/components/panel_iframe/) component. With this it is possible to embed the configurator directly into HASS, allowing you to modify your configuration through the HASS frontend. An example configuration would look like this: diff --git a/changelog.txt b/changelog.txt index 0ba823a..a076307 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Version 0.2.5 (2018-) - Added warning-logs for access failure @danielperna84 - Added transparency to whitespace characters @danielperna84 - Using external repository for Docker @Munsio +- Modify BANNED_IPS and ALLOWED_NETWORKS at runtime @danielperna84 Version 0.2.4 (2018-01-02) - Added YAML linting @AtoxIO diff --git a/configurator.py b/configurator.py index fd60fca..cfaadca 100755 --- a/configurator.py +++ b/configurator.py @@ -299,8 +299,13 @@ INDEX = Template(r""" } .input-field input[type=text].valid { - border-bottom: 1px solid #03a9f4;; - box-shadow: 0 1px 0 0 #03a9f4;; + border-bottom: 1px solid #03a9f4 !important; + box-shadow: 0 1px 0 0 #03a9f4 !important; + } + + .input-field input[type=text]:focus { + border-bottom: 1px solid #03a9f4 !important; + box-shadow: 0 1px 0 0 #03a9f4 !important; } .row .input-field input:focus { @@ -624,6 +629,7 @@ INDEX = Template(r"""
Do you really want to remove the network / IP from the list of allowed networks?
+Do you really want to Add the network / IP to the list of allowed networks?
+$listening_address
+$hass_api_address
+Modifying the following lists is not persistent. To statically control access please use the configuration file.
++
+
" + resp.message + "
" + resp.message + "
" + resp.message + "
" + resp.message + "
" + resp.message + "
" + resp.message + "
" + resp.message + "
" + resp.message + "
Do you really want to remove the network / IP from the list of allowed networks?
+Do you really want to Add the network / IP to the list of allowed networks?
+$listening_address
+$hass_api_address
+Modifying the following lists is not persistent. To statically control access please use the configuration file.
++
+
" + resp.message + "
" + resp.message + "
" + resp.message + "
" + resp.message + "
" + resp.message + "
" + resp.message + "
" + resp.message + "
" + resp.message + "