Merge branch 'main' of ssh://git.autonomic.zone:2222/decentral1se/startinblox-startinoff into main

no idea what is different
This commit is contained in:
trav 2021-04-07 10:23:36 -04:00
commit 379b349e19
18 changed files with 13 additions and 5 deletions

4
.gitignore vendored
View File

@ -1 +1,3 @@
/static/ settings.yml
static/
server/__pycache__

View File

@ -1,6 +1,11 @@
dependencies: dependencies:
djangoldp_notifications - djangoldp_account
- djangoldp_notification
- django-webpush
ldppackages: ldppackages:
- djangoldp_account
- djangoldp_notification
server: server:
DEBUG: true DEBUG: true
@ -11,6 +16,7 @@ server:
default: default:
ENGINE: django.db.backends.postgresql_psycopg2 ENGINE: django.db.backends.postgresql_psycopg2
NAME: djangoldp NAME: djangoldp
USER: postgres
LDP_RDF_CONTEXT: https://cdn.happy-dev.fr/owl/hdcontext.jsonld LDP_RDF_CONTEXT: https://cdn.happy-dev.fr/owl/hdcontext.jsonld
ROOT_URLCONF: server.urls ROOT_URLCONF: server.urls
STATIC_ROOT: static STATIC_ROOT: static

View File

@ -3,7 +3,7 @@ from django.views.decorators.http import require_GET
from django.http.response import JsonResponse, HttpResponse from django.http.response import JsonResponse, HttpResponse
from django.views.decorators.http import require_GET, require_POST from django.views.decorators.http import require_GET, require_POST
from django.shortcuts import render, get_object_or_404 from django.shortcuts import render, get_object_or_404
from django.contrib.auth.models import User from djangoldp_account.models import LDPUser
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from webpush import send_user_notification from webpush import send_user_notification
from django.conf import settings from django.conf import settings
@ -27,7 +27,7 @@ def send_push(request):
return JsonResponse(status=400, data={"message": "Invalid data format"}) return JsonResponse(status=400, data={"message": "Invalid data format"})
user_id = data['id'] user_id = data['id']
user = get_object_or_404(User, pk=user_id) user = get_object_or_404(LDPUser, pk=user_id)
payload = {'head': data['head'], 'body': data['body']} payload = {'head': data['head'], 'body': data['body']}
send_user_notification(user=user, payload=payload, ttl=1000) send_user_notification(user=user, payload=payload, ttl=1000)