kopia lustrzana https://github.com/dukethis/activitypub-example
rodzic
fd8b0d20ca
commit
ff866abb7b
|
@ -3,15 +3,17 @@ ActivityPub example server
|
|||
|
||||
This is an example server implementing a few basic features of [activitypub](https://www.w3.org/TR/activitypub/).
|
||||
|
||||
Because ActivityPub is quite generic, the goal here is not the implement every aspect of ActivityPub but just a coherent subset that can be used for understanding the protocol as well as for testing. Thus the use case is microblogging: users can only publish or like notes and follow each others.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
Outbox:
|
||||
|
||||
- [ ] Accept Create activities
|
||||
- [X] Accept Create activities
|
||||
- [ ] Accept Follow activities
|
||||
- [ ] Accept Like activities
|
||||
- [ ] Accept non-activity objects and convert them to a Create
|
||||
- [X] Accept non-activity objects and convert them to a Create
|
||||
activity (only accepts Note objects for now since it is an example
|
||||
server)
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ from activitypub.views import person, note, new_note, notes, inbox, outbox
|
|||
from activitypub.views import followers, noop
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^@(\w+)/notes/(\w+)', note, name="note"),
|
||||
url(r'^@(\w+)/outbox', outbox, name="outbox"),
|
||||
url(r'^@([^/]+)$', person, name="person"),
|
||||
url(r'^admin/', admin.site.urls),
|
||||
|
|
|
@ -15,6 +15,10 @@ def person(request, username):
|
|||
person = get_object_or_404(Person, username=username)
|
||||
return JsonResponse(activities.Person(person).to_json(context=True))
|
||||
|
||||
def note(request, username, note_id):
|
||||
note = get_object_or_404(Note, pk=note_id)
|
||||
return JsonResponse(activities.Note(note).to_json(context=True))
|
||||
|
||||
@csrf_exempt
|
||||
def outbox(request, username):
|
||||
if request.method != "POST":
|
||||
|
|
Ładowanie…
Reference in New Issue