git ignore and minor webpush fix
This commit is contained in:
parent
49148320ee
commit
252ac0ef7b
4
.gitignore
vendored
4
.gitignore
vendored
@ -1 +1,3 @@
|
||||
/static/
|
||||
settings.yml
|
||||
static/
|
||||
server/__pycache__
|
||||
|
35
example-settings.yml
Normal file
35
example-settings.yml
Normal file
@ -0,0 +1,35 @@
|
||||
dependencies:
|
||||
- djangoldp_account
|
||||
- djangoldp_notification
|
||||
- django-webpush
|
||||
|
||||
ldppackages:
|
||||
- djangoldp_account
|
||||
- djangoldp_notification
|
||||
|
||||
server:
|
||||
DEBUG: true
|
||||
ALLOWED_HOSTS:
|
||||
- "*"
|
||||
SECRET_KEY: "ak$t4x@9pcs$ypwt_m38)vcg^m=q@j7*2rs2gu7%h0wwcv)(y2"
|
||||
DATABASES:
|
||||
default:
|
||||
ENGINE: django.db.backends.postgresql_psycopg2
|
||||
NAME: djangoldp
|
||||
USER: postgres
|
||||
LDP_RDF_CONTEXT: https://cdn.happy-dev.fr/owl/hdcontext.jsonld
|
||||
ROOT_URLCONF: server.urls
|
||||
STATIC_ROOT: static
|
||||
# STATIC_URL: = '/static/'
|
||||
# STATICFILES_DIRS: = '/Users/trav/Documents/gitnsurge/autonomic/startinblox/startinblox-startinoff'
|
||||
MEDIA_ROOT: media
|
||||
INSTALLED_APPS:
|
||||
- server
|
||||
- djangoldp_crypto # only needed by decentral1se for #236
|
||||
- webpush
|
||||
|
||||
|
||||
WEBPUSH_SETTINGS:
|
||||
VAPID_PUBLIC_KEY: "BIDVJ0sd4Cyycf_aGCxhQ_SmXBneWboI3wGO-Iyj3ofeGkvYyNp5o6W9eTf13YkJSz6NlRwiCHA08m8e82n5WXI"
|
||||
VAPID_PRIVATE_KEY: "zQ-Apj3yLGvcq-l_YNFMFgNVBxQ5_JYEsUbZA36Yhes"
|
||||
VAPID_ADMIN_EMAIL: "trav@teafry.me"
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,7 +3,7 @@ from django.views.decorators.http import require_GET
|
||||
from django.http.response import JsonResponse, HttpResponse
|
||||
from django.views.decorators.http import require_GET, require_POST
|
||||
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 webpush import send_user_notification
|
||||
from django.conf import settings
|
||||
@ -27,7 +27,7 @@ def send_push(request):
|
||||
return JsonResponse(status=400, data={"message": "Invalid data format"})
|
||||
|
||||
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']}
|
||||
send_user_notification(user=user, payload=payload, ttl=1000)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user