Compare commits
3 Commits
3a872bceb2
...
1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
e7b8993446
|
|||
|
39a461df56
|
|||
|
711fbfd821
|
37
INSTALL.md
37
INSTALL.md
@ -161,3 +161,40 @@ jänE doé
|
|||||||
```
|
```
|
||||||
|
|
||||||
would still work, but `Jane D` wouldn't).
|
would still work, but `Jane D` wouldn't).
|
||||||
|
|
||||||
|
### Automatic data deletion (GDPR compliance)
|
||||||
|
|
||||||
|
The `delete_after_days` configuration option can be set to a number of days
|
||||||
|
after which attendance records are purged from the database. If it is not set
|
||||||
|
(or empty) automatic deletion is deactivated. Automatic deletion is final and
|
||||||
|
non-recoverable. This option is intended to help make the system fully GDPR
|
||||||
|
compliant by guaranteeing deletion after a certain period. Keep in mind that a
|
||||||
|
legally binding data protection guideline and user consent are still required.
|
||||||
|
|
||||||
|
### User notification on forgotten sign-out
|
||||||
|
|
||||||
|
`ftracker` is capable of notifying users if they forgot to sign-out at the end
|
||||||
|
of a day using modern web push notifications using the VAPID system. To make
|
||||||
|
this work, a few things are needed:
|
||||||
|
|
||||||
|
Firstly, you need an EC-Prime256v1 keypair in base64url encoding. If you're
|
||||||
|
using the Docker container, this is automatically generated for you. If not,
|
||||||
|
the easiest way to create one is to install the `web-push` `npm` package and
|
||||||
|
run it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo npm install -g web-push
|
||||||
|
web-push generate-vapid-keys
|
||||||
|
```
|
||||||
|
|
||||||
|
The keys then need to be copied into the config options `push_public_key` and
|
||||||
|
`push_private_key` respectively so the backend can handle the rest.
|
||||||
|
|
||||||
|
Next, to be VAPID compliant you have to announce an contact address claim to
|
||||||
|
the push services so they can contact you if anything is going wrong with your
|
||||||
|
notifications. Do this by entering your email address as a `mailto:` link in
|
||||||
|
the `push_sender_info` option, like `mailto:it@fasttube.de`.
|
||||||
|
|
||||||
|
Finally, you can use the `notify_after_hrs` option to specify how long the
|
||||||
|
system should wait after a user's arrival to notify them of their missing
|
||||||
|
departure.
|
||||||
|
|||||||
@ -26,8 +26,10 @@ guideline_url = https://fasttube.de/wp-content/uploads/2020/12/Cororna-Regeln-St
|
|||||||
json_indent = 4
|
json_indent = 4
|
||||||
|
|
||||||
# VAPID credentials for push notifications
|
# VAPID credentials for push notifications
|
||||||
|
# private key: base64url encoded public part of an EC-Prime256v1 keypair. See INSTALL.md
|
||||||
# private key: base64url encoded private part of an EC-Prime256v1 keypair. See INSTALL.md
|
# private key: base64url encoded private part of an EC-Prime256v1 keypair. See INSTALL.md
|
||||||
# sender info: usually mailto link to responsible party to contact about issues
|
# sender info: usually mailto link to responsible party to contact about issues
|
||||||
|
push_public_key = BBwBPYxhogHLU3B1FpxfQNzO3q7qZpmD1n1KaaL8WJbcVmJSHhi1uB-VmvsVjjUHWYCeqKyLT7w-1LBfpIcbbcg
|
||||||
push_private_key = abcdefghijklm_NOPQRSTUVWXYZ-0123456789
|
push_private_key = abcdefghijklm_NOPQRSTUVWXYZ-0123456789
|
||||||
push_sender_info = mailto:it@fasttube.de
|
push_sender_info = mailto:it@fasttube.de
|
||||||
# when to notify users, in hours after arrival
|
# when to notify users, in hours after arrival
|
||||||
|
|||||||
@ -6,6 +6,6 @@
|
|||||||
|
|
||||||
# Corona time tracker
|
# Corona time tracker
|
||||||
|
|
||||||
VERSION = (1, 0, 0)
|
VERSION = (1, 1, 0)
|
||||||
|
|
||||||
__version__ = '.'.join(map(str, VERSION))
|
__version__ = '.'.join(map(str, VERSION))
|
||||||
|
|||||||
@ -171,6 +171,25 @@ def get_data():
|
|||||||
return json.dumps(r, indent=SPACES), 200
|
return json.dumps(r, indent=SPACES), 200
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/pushinfo')
|
||||||
|
def get_pushinfo():
|
||||||
|
|
||||||
|
if config['notify_after_hrs']:
|
||||||
|
|
||||||
|
r = {
|
||||||
|
'enabled': True,
|
||||||
|
'publickey': config['push_public_key']
|
||||||
|
}
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
r = {
|
||||||
|
'enabled': False,
|
||||||
|
'publickey': None
|
||||||
|
}
|
||||||
|
|
||||||
|
return json.dumps(r, indent=SPACES), 200
|
||||||
|
|
||||||
@app.route('/pushsubscribe', methods=['POST'])
|
@app.route('/pushsubscribe', methods=['POST'])
|
||||||
def post_pushsub():
|
def post_pushsub():
|
||||||
|
|
||||||
|
|||||||
@ -26,8 +26,10 @@ guideline_url = https://youtu.be/oHg5SJYRHA0
|
|||||||
json_indent = 4
|
json_indent = 4
|
||||||
|
|
||||||
# VAPID credentials for push notifications
|
# VAPID credentials for push notifications
|
||||||
|
# private key: base64url encoded public part of an EC-Prime256v1 keypair. See INSTALL.md
|
||||||
# private key: base64url encoded private part of an EC-Prime256v1 keypair. See INSTALL.md
|
# private key: base64url encoded private part of an EC-Prime256v1 keypair. See INSTALL.md
|
||||||
# sender info: usually mailto link to responsible party to contact about issues
|
# sender info: usually mailto link to responsible party to contact about issues
|
||||||
|
push_public_key = abcdefghijklm_NOPQRSTUVWXYZ-0123456789abcdefghijklm_NOPQRSTUVWXYZ-0123456789abcdefghijklm_NOPQRSTUVWXYZ-0123456789
|
||||||
push_private_key = abcdefghijklm_NOPQRSTUVWXYZ-0123456789
|
push_private_key = abcdefghijklm_NOPQRSTUVWXYZ-0123456789
|
||||||
push_sender_info = mailto:admin@example.com
|
push_sender_info = mailto:admin@example.com
|
||||||
# when to notify users, in hours after arrival
|
# when to notify users, in hours after arrival
|
||||||
|
|||||||
@ -10,11 +10,10 @@ then
|
|||||||
|
|
||||||
web-push generate-vapid-keys --json > $VAPID_CREDS_FILE
|
web-push generate-vapid-keys --json > $VAPID_CREDS_FILE
|
||||||
|
|
||||||
echo "Patching public key into frontend ..."
|
echo "Patching keypair into config ..."
|
||||||
PUB_KEY=`cat $VAPID_CREDS_FILE | jq -r .publicKey`
|
PUB_KEY=`cat $VAPID_CREDS_FILE | jq -r .publicKey`
|
||||||
sed -i "s/pushServerPublicKey = '[a-zA-Z0-9_\-]*'/pushServerPublicKey = '${PUB_KEY}'/" /var/www/html/ftracker/main.js
|
echo "pushServerPublicKey = ${PUB_KEY}" >> /var/www/html/ftracker/main.js
|
||||||
|
|
||||||
echo "Patching private key into backend config ..."
|
|
||||||
PRIV_KEY=`cat $VAPID_CREDS_FILE | jq -r .privateKey`
|
PRIV_KEY=`cat $VAPID_CREDS_FILE | jq -r .privateKey`
|
||||||
echo "push_private_key = ${PRIV_KEY}" >> /etc/ftracker/config.ini
|
echo "push_private_key = ${PRIV_KEY}" >> /etc/ftracker/config.ini
|
||||||
|
|
||||||
|
|||||||
2
setup.py
2
setup.py
@ -8,7 +8,7 @@ with open("LICENSE.md", "r") as f:
|
|||||||
|
|
||||||
st.setup(
|
st.setup(
|
||||||
name="ftracker",
|
name="ftracker",
|
||||||
version="1.0.0",
|
version="1.1.0",
|
||||||
author="Oskar @ FaSTTUBe",
|
author="Oskar @ FaSTTUBe",
|
||||||
author_email="o.winkels@fasttube.de",
|
author_email="o.winkels@fasttube.de",
|
||||||
description="Small webapp to track who was in which room at which time to backtrace potential viral infections",
|
description="Small webapp to track who was in which room at which time to backtrace potential viral infections",
|
||||||
|
|||||||
14
web/main.js
14
web/main.js
@ -1,5 +1,3 @@
|
|||||||
var pushServerPublicKey = 'BBwBPYxhogHLU3B1FpxfQNzO3q7qZpmD1n1KaaL8WJbcVmJSHhi1uB-VmvsVjjUHWYCeqKyLT7w-1LBfpIcbbcg'
|
|
||||||
|
|
||||||
var spage = document.getElementById('startpage')
|
var spage = document.getElementById('startpage')
|
||||||
var mform = document.getElementById('mainform')
|
var mform = document.getElementById('mainform')
|
||||||
|
|
||||||
@ -226,6 +224,18 @@ function initPush(name) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetch('/pushinfo').then(function(res) {
|
||||||
|
if (res.ok)
|
||||||
|
res.json().then(function(push) {
|
||||||
|
if (push.enabled)
|
||||||
|
registerPush(name, push.publickey);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function registerPush(name, pushServerPublicKey) {
|
||||||
|
|
||||||
// Register service worker
|
// Register service worker
|
||||||
navigator.serviceWorker.register("/sw.js").then(function(swRegistration) {
|
navigator.serviceWorker.register("/sw.js").then(function(swRegistration) {
|
||||||
console.log("ServiceWorker registered:", swRegistration)
|
console.log("ServiceWorker registered:", swRegistration)
|
||||||
|
|||||||
Reference in New Issue
Block a user