Renamed entire project from "chapeau" to "kepi".
This is because of a name clash in PyPI.remote_update_not_partial
|
@ -9,4 +9,4 @@ build/
|
||||||
dist/
|
dist/
|
||||||
static
|
static
|
||||||
examples/
|
examples/
|
||||||
chapeau/chapeau/local_config.py
|
kepi/kepi/local_config.py
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include LICENSE.txt
|
include LICENSE.txt
|
||||||
include README.md
|
include README.md
|
||||||
recursive-include chapeau *.py
|
recursive-include kepi *.py
|
||||||
recursive-include chapeau *.xml
|
recursive-include kepi *.xml
|
||||||
recursive-include chapeau *.html
|
recursive-include kepi *.html
|
||||||
|
|
12
README.md
|
@ -1,7 +1,7 @@
|
||||||
chapeau
|
kepi
|
||||||
====
|
====
|
||||||
|
|
||||||
chapeau is an ActivityPub daemon.
|
kepi is an ActivityPub daemon.
|
||||||
|
|
||||||
[ActivityPub](https://www.w3.org/TR/activitypub/) is a standard protocol
|
[ActivityPub](https://www.w3.org/TR/activitypub/) is a standard protocol
|
||||||
for integrating social media across Internet sites.
|
for integrating social media across Internet sites.
|
||||||
|
@ -11,14 +11,14 @@ might reply to it, and someone else might "like" it. Someone else again
|
||||||
might "follow" you, in order to get notifications when you post
|
might "follow" you, in order to get notifications when you post
|
||||||
anything else.
|
anything else.
|
||||||
|
|
||||||
chapeau runs in the background on your server, distributing your messages
|
kepi runs in the background on your server, distributing your messages
|
||||||
to other sites, and receiving their responses.
|
to other sites, and receiving their responses.
|
||||||
|
|
||||||
* [Installation guide](docs/installation.md)
|
* [Installation guide](docs/installation.md)
|
||||||
* [Source](https://gitlab.com/marnanel/chapeau/)
|
* [Source](https://gitlab.com/marnanel/kepi/)
|
||||||
|
|
||||||
If you'd like to contribute, there's lots to do. Find something on the
|
If you'd like to contribute, there's lots to do. Find something on the
|
||||||
[bug tracker](https://gitlab.com/marnanel/chapeau/issues?label_name%5B%5D=newbie)
|
[bug tracker](https://gitlab.com/marnanel/kepi/issues?label_name%5B%5D=newbie)
|
||||||
and dive in. If you'd like a gentler learning curve, look
|
and dive in. If you'd like a gentler learning curve, look
|
||||||
for
|
for
|
||||||
[bugs marked "newbie"](https://gitlab.com/marnanel/chapeau/issues?label_name%5B%5D=newbie)
|
[bugs marked "newbie"](https://gitlab.com/marnanel/kepi/issues?label_name%5B%5D=newbie)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
__title__ = 'chapeau'
|
__title__ = 'kepi'
|
||||||
__version__ = '0.4.0'
|
__version__ = '0.4.0'
|
||||||
VERSION = __version__
|
VERSION = __version__
|
||||||
__author__ = 'Marnanel Thurman'
|
__author__ = 'Marnanel Thurman'
|
|
@ -1,6 +1,6 @@
|
||||||
# admin.py
|
# admin.py
|
||||||
#
|
#
|
||||||
# Part of chapeau, an ActivityPub daemon.
|
# Part of kepi, an ActivityPub daemon.
|
||||||
# Copyright (c) 2018-2019 Marnanel Thurman.
|
# Copyright (c) 2018-2019 Marnanel Thurman.
|
||||||
# Licensed under the GNU Public License v2.
|
# Licensed under the GNU Public License v2.
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@ with bowler_pub's models.
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from polymorphic.admin import *
|
from polymorphic.admin import *
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
from chapeau.bowler_pub.validation import IncomingMessage
|
from kepi.bowler_pub.validation import IncomingMessage
|
||||||
import chapeau.bowler_pub.forms as bowler_pub_forms
|
import kepi.bowler_pub.forms as bowler_pub_forms
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import chapeau.bowler_pub.settings
|
import kepi.bowler_pub.settings
|
||||||
from django.core.management import get_commands, call_command
|
from django.core.management import get_commands, call_command
|
||||||
from django.core.management.base import CommandError
|
from django.core.management.base import CommandError
|
||||||
from django.conf import settings
|
from django.conf import settings
|
|
@ -1,6 +1,6 @@
|
||||||
# create.py
|
# create.py
|
||||||
#
|
#
|
||||||
# Part of chapeau, an ActivityPub daemon and library.
|
# Part of kepi, an ActivityPub daemon and library.
|
||||||
# Copyright (c) 2018-2019 Marnanel Thurman.
|
# Copyright (c) 2018-2019 Marnanel Thurman.
|
||||||
# Licensed under the GNU Public License v2.
|
# Licensed under the GNU Public License v2.
|
||||||
|
|
||||||
|
@ -8,12 +8,12 @@
|
||||||
This module contains create(), which creates objects.
|
This module contains create(), which creates objects.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
import django.db.utils
|
import django.db.utils
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
def _fix_value_type(v):
|
def _fix_value_type(v):
|
||||||
if type(v) in [str, int, bool]:
|
if type(v) in [str, int, bool]:
|
||||||
|
@ -59,8 +59,8 @@ def create(
|
||||||
Don't confuse create() with objects of type Create!
|
Don't confuse create() with objects of type Create!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from chapeau.bowler_pub.delivery import deliver
|
from kepi.bowler_pub.delivery import deliver
|
||||||
from chapeau.bowler_pub.models.activity import AcActivity
|
from kepi.bowler_pub.models.activity import AcActivity
|
||||||
|
|
||||||
if value is None:
|
if value is None:
|
||||||
value = {}
|
value = {}
|
||||||
|
@ -96,7 +96,7 @@ def create(
|
||||||
|
|
||||||
class_name = 'Ac'+value['type']
|
class_name = 'Ac'+value['type']
|
||||||
try:
|
try:
|
||||||
import chapeau.bowler_pub.models as bowler_pub_models
|
import kepi.bowler_pub.models as bowler_pub_models
|
||||||
cls = getattr(locals()['bowler_pub_models'], class_name)
|
cls = getattr(locals()['bowler_pub_models'], class_name)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
logger.warn("There's no type called %s",
|
logger.warn("There's no type called %s",
|
|
@ -1,6 +1,6 @@
|
||||||
# crypto.py
|
# crypto.py
|
||||||
#
|
#
|
||||||
# Part of chapeau, an ActivityPub daemon.
|
# Part of kepi, an ActivityPub daemon.
|
||||||
# Copyright (c) 2018-2019 Marnanel Thurman.
|
# Copyright (c) 2018-2019 Marnanel Thurman.
|
||||||
# Licensed under the GNU Public License v2.
|
# Licensed under the GNU Public License v2.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# delivery.py
|
# delivery.py
|
||||||
#
|
#
|
||||||
# Part of chapeau, an ActivityPub daemon.
|
# Part of kepi, an ActivityPub daemon.
|
||||||
# Copyright (c) 2018-2019 Marnanel Thurman.
|
# Copyright (c) 2018-2019 Marnanel Thurman.
|
||||||
# Licensed under the GNU Public License v2.
|
# Licensed under the GNU Public License v2.
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ to their audiences.
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
from celery import shared_task
|
from celery import shared_task
|
||||||
from chapeau.bowler_pub.find import find, find_local, is_local
|
from kepi.bowler_pub.find import find, find_local, is_local
|
||||||
import chapeau.bowler_pub.models
|
import kepi.bowler_pub.models
|
||||||
from httpsig.verify import HeaderVerifier
|
from httpsig.verify import HeaderVerifier
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
|
@ -28,7 +28,7 @@ import httpsig
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
from . import PUBLIC_IDS
|
from . import PUBLIC_IDS
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
def _rfc822_datetime(when=None):
|
def _rfc822_datetime(when=None):
|
||||||
"""
|
"""
|
||||||
|
@ -55,7 +55,7 @@ def _find_local_actor(activity_form):
|
||||||
the "attributedTo" field.
|
the "attributedTo" field.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from chapeau.bowler_pub.models.acobject import AcObject
|
from kepi.bowler_pub.models.acobject import AcObject
|
||||||
|
|
||||||
parts = None
|
parts = None
|
||||||
for fieldname in ['actor', 'attributedTo']:
|
for fieldname in ['actor', 'attributedTo']:
|
||||||
|
@ -216,8 +216,8 @@ def _activity_form_to_outgoing_string(activity_form):
|
||||||
an HTTP response.
|
an HTTP response.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from chapeau.bowler_pub import ATSIGN_CONTEXT
|
from kepi.bowler_pub import ATSIGN_CONTEXT
|
||||||
from chapeau.bowler_pub.utils import as_json
|
from kepi.bowler_pub.utils import as_json
|
||||||
|
|
||||||
format_for_delivery = activity_form.copy()
|
format_for_delivery = activity_form.copy()
|
||||||
for blind_field in ['bto', 'bcc']:
|
for blind_field in ['bto', 'bcc']:
|
||||||
|
@ -414,8 +414,8 @@ def deliver(
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
activity = chapeau.bowler_pub.models.AcActivity.objects.get(id=activity_id)
|
activity = kepi.bowler_pub.models.AcActivity.objects.get(id=activity_id)
|
||||||
except chapeau.bowler_pub.models.AcActivity.DoesNotExist:
|
except kepi.bowler_pub.models.AcActivity.DoesNotExist:
|
||||||
logger.warn("Can't deliver activity %s because it doesn't exist",
|
logger.warn("Can't deliver activity %s because it doesn't exist",
|
||||||
activity_id)
|
activity_id)
|
||||||
return None
|
return None
|
|
@ -1,6 +1,6 @@
|
||||||
# find.py
|
# find.py
|
||||||
#
|
#
|
||||||
# Part of chapeau, an ActivityPub daemon.
|
# Part of kepi, an ActivityPub daemon.
|
||||||
# Copyright (c) 2018-2019 Marnanel Thurman.
|
# Copyright (c) 2018-2019 Marnanel Thurman.
|
||||||
# Licensed under the GNU Public License v2.
|
# Licensed under the GNU Public License v2.
|
||||||
|
|
||||||
|
@ -15,13 +15,13 @@ from django.conf import settings
|
||||||
import django.urls
|
import django.urls
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from chapeau.bowler_pub.utils import is_short_id
|
from kepi.bowler_pub.utils import is_short_id
|
||||||
import json
|
import json
|
||||||
import mimeparse
|
import mimeparse
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
class Fetch(models.Model):
|
class Fetch(models.Model):
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ def find_remote(url,
|
||||||
its stated audiences. This is usually not what you want.
|
its stated audiences. This is usually not what you want.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from chapeau.bowler_pub.models.acobject import AcObject
|
from kepi.bowler_pub.models.acobject import AcObject
|
||||||
|
|
||||||
logger.debug('%s: find remote', url)
|
logger.debug('%s: find remote', url)
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ def _short_id_lookup(number):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from chapeau.bowler_pub.models import AcObject
|
from kepi.bowler_pub.models import AcObject
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = AcObject.objects.get(
|
result = AcObject.objects.get(
|
|
@ -1,6 +1,6 @@
|
||||||
# forms.py
|
# forms.py
|
||||||
#
|
#
|
||||||
# Part of chapeau, an ActivityPub daemon.
|
# Part of kepi, an ActivityPub daemon.
|
||||||
# Copyright (c) 2018-2019 Marnanel Thurman.
|
# Copyright (c) 2018-2019 Marnanel Thurman.
|
||||||
# Licensed under the GNU Public License v2.
|
# Licensed under the GNU Public License v2.
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ the admin interface. It's not very elaborate yet.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
import chapeau.bowler_pub.models as bowler_pub_models
|
import kepi.bowler_pub.models as bowler_pub_models
|
||||||
|
|
||||||
class NoteAdminForm(forms.ModelForm):
|
class NoteAdminForm(forms.ModelForm):
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
@ -7,7 +7,7 @@ import re
|
||||||
|
|
||||||
ENVIRON_USER = 'KEPI_USER'
|
ENVIRON_USER = 'KEPI_USER'
|
||||||
|
|
||||||
logger = logging.Logger('chapeau')
|
logger = logging.Logger('kepi')
|
||||||
|
|
||||||
class KepiCommand(BaseCommand):
|
class KepiCommand(BaseCommand):
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.management import KepiCommand, objects_by_keywords
|
from kepi.bowler_pub.management import KepiCommand, objects_by_keywords
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
|
|
||||||
logger = logging.Logger('chapeau')
|
logger = logging.Logger('kepi')
|
||||||
|
|
||||||
class Command(KepiCommand):
|
class Command(KepiCommand):
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.management import KepiCommand
|
from kepi.bowler_pub.management import KepiCommand
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.Logger('chapeau')
|
logger = logging.Logger('kepi')
|
||||||
|
|
||||||
class Command(KepiCommand):
|
class Command(KepiCommand):
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.management import KepiCommand
|
from kepi.bowler_pub.management import KepiCommand
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.Logger('chapeau')
|
logger = logging.Logger('kepi')
|
||||||
|
|
||||||
class Command(KepiCommand):
|
class Command(KepiCommand):
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.management import KepiCommand
|
from kepi.bowler_pub.management import KepiCommand
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.Logger('chapeau')
|
logger = logging.Logger('kepi')
|
||||||
|
|
||||||
class Command(KepiCommand):
|
class Command(KepiCommand):
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.management import KepiCommand
|
from kepi.bowler_pub.management import KepiCommand
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.Logger('chapeau')
|
logger = logging.Logger('kepi')
|
||||||
|
|
||||||
class Command(KepiCommand):
|
class Command(KepiCommand):
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.management import KepiCommand, objects_by_keywords
|
from kepi.bowler_pub.management import KepiCommand, objects_by_keywords
|
||||||
from collections import abc
|
from collections import abc
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.Logger('chapeau')
|
logger = logging.Logger('kepi')
|
||||||
|
|
||||||
class Command(KepiCommand):
|
class Command(KepiCommand):
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ class Command(KepiCommand):
|
||||||
|
|
||||||
def _show_json(self, thing, *args, **options):
|
def _show_json(self, thing, *args, **options):
|
||||||
|
|
||||||
from chapeau.bowler_pub.utils import as_json
|
from kepi.bowler_pub.utils import as_json
|
||||||
|
|
||||||
print(as_json(thing.activity_form))
|
print(as_json(thing.activity_form))
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.management import KepiCommand
|
from kepi.bowler_pub.management import KepiCommand
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.Logger('chapeau')
|
logger = logging.Logger('kepi')
|
||||||
|
|
||||||
class Command(KepiCommand):
|
class Command(KepiCommand):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# middleware.py
|
# middleware.py
|
||||||
#
|
#
|
||||||
# Part of chapeau, an ActivityPub daemon.
|
# Part of kepi, an ActivityPub daemon.
|
||||||
# Copyright (c) 2018-2019 Marnanel Thurman.
|
# Copyright (c) 2018-2019 Marnanel Thurman.
|
||||||
# Licensed under the GNU Public License v2.
|
# Licensed under the GNU Public License v2.
|
||||||
|
|
|
@ -3,18 +3,18 @@ from django.conf import settings
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from polymorphic.models import PolymorphicModel
|
from polymorphic.models import PolymorphicModel
|
||||||
from polymorphic.managers import PolymorphicManager
|
from polymorphic.managers import PolymorphicManager
|
||||||
from chapeau.bowler_pub.models.audience import Audience, AUDIENCE_FIELD_NAMES
|
from kepi.bowler_pub.models.audience import Audience, AUDIENCE_FIELD_NAMES
|
||||||
from chapeau.bowler_pub.models.thingfield import ThingField
|
from kepi.bowler_pub.models.thingfield import ThingField
|
||||||
from chapeau.bowler_pub.models.mention import Mention
|
from kepi.bowler_pub.models.mention import Mention
|
||||||
from chapeau.bowler_pub.utils import configured_path, uri_to_url
|
from kepi.bowler_pub.utils import configured_path, uri_to_url
|
||||||
from .. import URL_REGEXP, SERIAL_NUMBER_REGEXP
|
from .. import URL_REGEXP, SERIAL_NUMBER_REGEXP
|
||||||
import chapeau.bowler_pub.side_effects as side_effects
|
import kepi.bowler_pub.side_effects as side_effects
|
||||||
import logging
|
import logging
|
||||||
import random
|
import random
|
||||||
import warnings
|
import warnings
|
||||||
import re
|
import re
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ class AcObject(PolymorphicModel):
|
||||||
@property
|
@property
|
||||||
def activity_form(self):
|
def activity_form(self):
|
||||||
|
|
||||||
from chapeau.bowler_pub.utils import short_id_to_url
|
from kepi.bowler_pub.utils import short_id_to_url
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
'id': self.url,
|
'id': self.url,
|
||||||
|
@ -189,7 +189,7 @@ class AcObject(PolymorphicModel):
|
||||||
|
|
||||||
def __getitem__(self, name):
|
def __getitem__(self, name):
|
||||||
|
|
||||||
from chapeau.bowler_pub.find import find
|
from kepi.bowler_pub.find import find
|
||||||
|
|
||||||
name_parts = name.split('__')
|
name_parts = name.split('__')
|
||||||
name = name_parts.pop(0)
|
name = name_parts.pop(0)
|
||||||
|
@ -265,7 +265,7 @@ class AcObject(PolymorphicModel):
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
from chapeau.bowler_pub.utils import as_json
|
from kepi.bowler_pub.utils import as_json
|
||||||
|
|
||||||
if self.pk is None:
|
if self.pk is None:
|
||||||
# See above
|
# See above
|
||||||
|
@ -304,8 +304,8 @@ class AcObject(PolymorphicModel):
|
||||||
|
|
||||||
def run_side_effects(self):
|
def run_side_effects(self):
|
||||||
|
|
||||||
from chapeau.bowler_pub.find import find
|
from kepi.bowler_pub.find import find
|
||||||
from chapeau.bowler_pub.delivery import deliver
|
from kepi.bowler_pub.delivery import deliver
|
||||||
|
|
||||||
f_type = self.f_type.lower()
|
f_type = self.f_type.lower()
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ class AcObject(PolymorphicModel):
|
||||||
find() would ignore these.
|
find() would ignore these.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from chapeau.bowler_pub.find import find
|
from kepi.bowler_pub.find import find
|
||||||
|
|
||||||
logger.debug(' -- finding object with url %s', url)
|
logger.debug(' -- finding object with url %s', url)
|
||||||
result = find(url,
|
result = find(url,
|
|
@ -2,7 +2,7 @@ from django.db import models
|
||||||
from . import acobject
|
from . import acobject
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ class AcActivity(acobject.AcObject):
|
||||||
|
|
||||||
def go_into_outbox_if_local(self):
|
def go_into_outbox_if_local(self):
|
||||||
|
|
||||||
from chapeau.bowler_pub.models.collection import Collection
|
from kepi.bowler_pub.models.collection import Collection
|
||||||
from chapeau.bowler_pub.find import find
|
from kepi.bowler_pub.find import find
|
||||||
|
|
||||||
if not self.is_local:
|
if not self.is_local:
|
||||||
return
|
return
|
|
@ -1,12 +1,12 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from . import acobject, following, collection
|
from . import acobject, following, collection
|
||||||
import chapeau.bowler_pub.crypto as crypto
|
import kepi.bowler_pub.crypto as crypto
|
||||||
from chapeau.bowler_pub.utils import configured_url, uri_to_url
|
from kepi.bowler_pub.utils import configured_url, uri_to_url
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
LIST_NAMES = [
|
LIST_NAMES = [
|
||||||
'inbox', 'outbox', 'followers', 'following',
|
'inbox', 'outbox', 'followers', 'following',
|
||||||
|
@ -122,7 +122,7 @@ class AcActor(acobject.AcObject):
|
||||||
|
|
||||||
elif name=='publicKey':
|
elif name=='publicKey':
|
||||||
|
|
||||||
from chapeau.bowler_pub.utils import as_json
|
from kepi.bowler_pub.utils import as_json
|
||||||
|
|
||||||
self.publicKey = as_json(value,
|
self.publicKey = as_json(value,
|
||||||
indent=None)
|
indent=None)
|
|
@ -3,7 +3,7 @@ from collections import defaultdict
|
||||||
from .. import PUBLIC_IDS
|
from .. import PUBLIC_IDS
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger('chapeau')
|
logger = logging.getLogger('kepi')
|
||||||
|
|
||||||
FIELD_AUDIENCE = 0x01 # literally "audience"
|
FIELD_AUDIENCE = 0x01 # literally "audience"
|
||||||
FIELD_TO = 0x02
|
FIELD_TO = 0x02
|
|
@ -3,7 +3,7 @@ from django.conf import settings
|
||||||
from .acobject import AcObject
|
from .acobject import AcObject
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
class Collection(models.Model):
|
class Collection(models.Model):
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from chapeau.bowler_pub.utils import short_id_to_url
|
from kepi.bowler_pub.utils import short_id_to_url
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
class Following(models.Model):
|
class Following(models.Model):
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.conf import settings
|
||||||
import logging
|
import logging
|
||||||
import random
|
import random
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class AcItem(acobject.AcObject):
|
||||||
@property
|
@property
|
||||||
def thread(self):
|
def thread(self):
|
||||||
|
|
||||||
from chapeau.bowler_pub.find import find
|
from kepi.bowler_pub.find import find
|
||||||
|
|
||||||
if hasattr(self, '_thread'):
|
if hasattr(self, '_thread'):
|
||||||
return self._thread
|
return self._thread
|
||||||
|
@ -190,7 +190,7 @@ class AcItem(acobject.AcObject):
|
||||||
in which case this property will be None.
|
in which case this property will be None.
|
||||||
You can still find the name of the actor in f_attributedTo.
|
You can still find the name of the actor in f_attributedTo.
|
||||||
"""
|
"""
|
||||||
from chapeau.bowler_pub.find import find
|
from kepi.bowler_pub.find import find
|
||||||
|
|
||||||
return find(self.f_attributedTo, local_only=True)
|
return find(self.f_attributedTo, local_only=True)
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ class AcItem(acobject.AcObject):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mentions(self):
|
def mentions(self):
|
||||||
from chapeau.bowler_pub.models.mention import Mention
|
from kepi.bowler_pub.models.mention import Mention
|
||||||
|
|
||||||
logger.info('Finding Mentions for %s', self)
|
logger.info('Finding Mentions for %s', self)
|
||||||
return [x.to_actor for x in
|
return [x.to_actor for x in
|
|
@ -1,7 +1,7 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
|
|
@ -2,7 +2,7 @@ from django.db import models
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
class ThingField(models.Model):
|
class ThingField(models.Model):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# side_effects.py
|
# side_effects.py
|
||||||
#
|
#
|
||||||
# Part of chapeau, an ActivityPub daemon.
|
# Part of kepi, an ActivityPub daemon.
|
||||||
# Copyright (c) 2018-2019 Marnanel Thurman.
|
# Copyright (c) 2018-2019 Marnanel Thurman.
|
||||||
# Licensed under the GNU Public License v2.
|
# Licensed under the GNU Public License v2.
|
||||||
|
|
||||||
|
@ -13,14 +13,14 @@ the new activity as a parameter.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from chapeau.bowler_pub.find import find, is_local
|
from kepi.bowler_pub.find import find, is_local
|
||||||
from chapeau.bowler_pub.delivery import deliver
|
from kepi.bowler_pub.delivery import deliver
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
def accept(activity):
|
def accept(activity):
|
||||||
|
|
||||||
from chapeau.bowler_pub.models.following import Following
|
from kepi.bowler_pub.models.following import Following
|
||||||
|
|
||||||
obj = activity['object__obj']
|
obj = activity['object__obj']
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ def accept(activity):
|
||||||
|
|
||||||
def follow(activity):
|
def follow(activity):
|
||||||
|
|
||||||
from chapeau.bowler_pub.models.following import Following
|
from kepi.bowler_pub.models.following import Following
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
|
|
||||||
if not is_local(activity['object']):
|
if not is_local(activity['object']):
|
||||||
logger.info('Following a remote user has no local side-effects.')
|
logger.info('Following a remote user has no local side-effects.')
|
||||||
|
@ -72,7 +72,7 @@ def follow(activity):
|
||||||
|
|
||||||
def reject(activity):
|
def reject(activity):
|
||||||
|
|
||||||
from chapeau.bowler_pub.models.following import Following
|
from kepi.bowler_pub.models.following import Following
|
||||||
|
|
||||||
obj = activity['object__obj']
|
obj = activity['object__obj']
|
||||||
|
|
||||||
|
@ -92,9 +92,9 @@ def reject(activity):
|
||||||
|
|
||||||
def create(activity):
|
def create(activity):
|
||||||
|
|
||||||
import chapeau.bowler_pub.models as bowler_pub_models
|
import kepi.bowler_pub.models as bowler_pub_models
|
||||||
from chapeau.bowler_pub.create import create as bowler_pub_create
|
from kepi.bowler_pub.create import create as bowler_pub_create
|
||||||
from chapeau.bowler_pub.models.audience import AUDIENCE_FIELD_KEYS
|
from kepi.bowler_pub.models.audience import AUDIENCE_FIELD_KEYS
|
||||||
|
|
||||||
raw_material = activity['object'].copy()
|
raw_material = activity['object'].copy()
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ def create(activity):
|
||||||
|
|
||||||
def it_is_relevant(something, activity):
|
def it_is_relevant(something, activity):
|
||||||
|
|
||||||
from chapeau.bowler_pub.models import Audience
|
from kepi.bowler_pub.models import Audience
|
||||||
|
|
||||||
logger.debug('Checking whether the new object is relevant to us.')
|
logger.debug('Checking whether the new object is relevant to us.')
|
||||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 95 KiB Po Szerokość: | Wysokość: | Rozmiar: 95 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 8.2 KiB Po Szerokość: | Wysokość: | Rozmiar: 8.2 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 8.3 KiB Po Szerokość: | Wysokość: | Rozmiar: 8.3 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 8.7 KiB Po Szerokość: | Wysokość: | Rozmiar: 8.7 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 9.9 KiB Po Szerokość: | Wysokość: | Rozmiar: 9.9 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 9.9 KiB Po Szerokość: | Wysokość: | Rozmiar: 9.9 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 58 KiB Po Szerokość: | Wysokość: | Rozmiar: 58 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 5.3 KiB Po Szerokość: | Wysokość: | Rozmiar: 5.3 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 9.1 KiB Po Szerokość: | Wysokość: | Rozmiar: 9.1 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 58 KiB Po Szerokość: | Wysokość: | Rozmiar: 58 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 124 KiB Po Szerokość: | Wysokość: | Rozmiar: 124 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 129 KiB Po Szerokość: | Wysokość: | Rozmiar: 129 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 18 KiB Po Szerokość: | Wysokość: | Rozmiar: 18 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 272 KiB Po Szerokość: | Wysokość: | Rozmiar: 272 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 9.1 KiB Po Szerokość: | Wysokość: | Rozmiar: 9.1 KiB |
|
@ -1,7 +1,7 @@
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.validation import IncomingMessage, validate
|
from kepi.bowler_pub.validation import IncomingMessage, validate
|
||||||
from chapeau.bowler_pub.models import AcObject, AcActor
|
from kepi.bowler_pub.models import AcObject, AcActor
|
||||||
from chapeau.bowler_pub.utils import as_json, uri_to_url, configured_url
|
from kepi.bowler_pub.utils import as_json, uri_to_url, configured_url
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import django.test
|
import django.test
|
||||||
import httpretty
|
import httpretty
|
||||||
|
@ -33,10 +33,10 @@ PUBLIC = "https://www.w3.org/ns/activitystreams#Public"
|
||||||
|
|
||||||
CONTEXT_URL = "https://www.w3.org/ns/activitystreams"
|
CONTEXT_URL = "https://www.w3.org/ns/activitystreams"
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
def create_local_person(name='jemima',
|
def create_local_person(name='jemima',
|
||||||
load_default_keys_from='chapeau/bowler_pub/tests/keys/keys-0003.json',
|
load_default_keys_from='kepi/bowler_pub/tests/keys/keys-0003.json',
|
||||||
**kwargs):
|
**kwargs):
|
||||||
|
|
||||||
if 'publicKey' or 'privateKey' not in kwargs:
|
if 'publicKey' or 'privateKey' not in kwargs:
|
||||||
|
@ -363,7 +363,7 @@ def remote_user(url, name,
|
||||||
|
|
||||||
def remote_object_is_recorded(url):
|
def remote_object_is_recorded(url):
|
||||||
|
|
||||||
from chapeau.bowler_pub.models import AcObject
|
from kepi.bowler_pub.models import AcObject
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = AcObject.objects.get(id=url)
|
result = AcObject.objects.get(id=url)
|
|
@ -1,7 +1,7 @@
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
from .. import create_local_person
|
from .. import create_local_person
|
||||||
|
|
||||||
class KepiPostTest(TestCase):
|
class KepiPostTest(TestCase):
|
|
@ -1,9 +1,9 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from chapeau.bowler_pub.tests import create_local_note, create_local_person
|
from kepi.bowler_pub.tests import create_local_note, create_local_person
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.models.audience import Audience, AUDIENCE_FIELD_NAMES
|
from kepi.bowler_pub.models.audience import Audience, AUDIENCE_FIELD_NAMES
|
||||||
from chapeau.bowler_pub.models.mention import Mention
|
from kepi.bowler_pub.models.mention import Mention
|
||||||
from chapeau.bowler_pub.models.item import AcItem
|
from kepi.bowler_pub.models.item import AcItem
|
||||||
from .. import create_local_person
|
from .. import create_local_person
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
|
@ -12,7 +12,7 @@ from django.conf import settings
|
||||||
REMOTE_ALICE = 'https://somewhere.example.com/users/alice'
|
REMOTE_ALICE = 'https://somewhere.example.com/users/alice'
|
||||||
LOCAL_FRED = 'https://testserver/users/fred'
|
LOCAL_FRED = 'https://testserver/users/fred'
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
class TestCreate(TestCase):
|
class TestCreate(TestCase):
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ class TestCreate(TestCase):
|
||||||
|
|
||||||
def test_when_sender_is_followed_by_local_users(self):
|
def test_when_sender_is_followed_by_local_users(self):
|
||||||
|
|
||||||
from chapeau.bowler_pub.models.following import Following
|
from kepi.bowler_pub.models.following import Following
|
||||||
|
|
||||||
local_user = create_local_person()
|
local_user = create_local_person()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from chapeau.bowler_pub.tests import create_local_note, create_local_person
|
from kepi.bowler_pub.tests import create_local_note, create_local_person
|
||||||
from unittest import skip
|
from unittest import skip
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
class TestLike(TestCase):
|
class TestLike(TestCase):
|
|
@ -1,15 +1,15 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from chapeau.bowler_pub.tests import create_local_note, create_local_person
|
from kepi.bowler_pub.tests import create_local_note, create_local_person
|
||||||
from unittest import skip
|
from unittest import skip
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
SENDER_ID = 'https://example.com/actor'
|
SENDER_ID = 'https://example.com/actor'
|
||||||
SENDER_DOMAIN = 'example.com'
|
SENDER_DOMAIN = 'example.com'
|
||||||
SENDER_FOLLOWERS = 'https://example.com/followers'
|
SENDER_FOLLOWERS = 'https://example.com/followers'
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
# XXX Why does this only test updating of profiles?
|
# XXX Why does this only test updating of profiles?
|
||||||
# XXX I thought we should update items as well.
|
# XXX I thought we should update items as well.
|
|
@ -1,17 +1,17 @@
|
||||||
# test_activity.py
|
# test_activity.py
|
||||||
#
|
#
|
||||||
# Part of chapeau, an ActivityPub daemon.
|
# Part of kepi, an ActivityPub daemon.
|
||||||
# Copyright (c) 2018-2019 Marnanel Thurman.
|
# Copyright (c) 2018-2019 Marnanel Thurman.
|
||||||
# Licensed under the GNU Public License v2.
|
# Licensed under the GNU Public License v2.
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from chapeau.bowler_pub.models import AcObject, AcActivity
|
from kepi.bowler_pub.models import AcObject, AcActivity
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from unittest import skip
|
from unittest import skip
|
||||||
from . import remote_object_is_recorded, create_local_person
|
from . import remote_object_is_recorded, create_local_person
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.Logger(name='chapeau')
|
logger = logging.Logger(name='kepi')
|
||||||
|
|
||||||
REMOTE_ID_1 = 'https://users.example.com/activity/1'
|
REMOTE_ID_1 = 'https://users.example.com/activity/1'
|
||||||
REMOTE_ID_2 = 'https://users.example.com/item/2'
|
REMOTE_ID_2 = 'https://users.example.com/item/2'
|
||||||
|
@ -39,7 +39,7 @@ class TestAcObject(TestCase):
|
||||||
|
|
||||||
def test_remote_no_id(self):
|
def test_remote_no_id(self):
|
||||||
|
|
||||||
from chapeau.bowler_pub.models import AcObject
|
from kepi.bowler_pub.models import AcObject
|
||||||
|
|
||||||
create(
|
create(
|
||||||
f_type = "Create",
|
f_type = "Create",
|
|
@ -1,6 +1,6 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from chapeau.bowler_pub.models import Audience
|
from kepi.bowler_pub.models import Audience
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from . import create_local_person, REMOTE_FRED, REMOTE_JIM
|
from . import create_local_person, REMOTE_FRED, REMOTE_JIM
|
||||||
|
|
||||||
class TestAudience(TestCase):
|
class TestAudience(TestCase):
|
|
@ -1,14 +1,14 @@
|
||||||
from django.test import TestCase, Client
|
from django.test import TestCase, Client
|
||||||
from unittest import skip
|
from unittest import skip
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
from chapeau.bowler_pub.find import find
|
from kepi.bowler_pub.find import find
|
||||||
from chapeau.bowler_pub.utils import as_json
|
from kepi.bowler_pub.utils import as_json
|
||||||
from . import *
|
from . import *
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.Logger('chapeau')
|
logger = logging.Logger('kepi')
|
||||||
|
|
||||||
EXAMPLE_SERVER = 'http://testserver'
|
EXAMPLE_SERVER = 'http://testserver'
|
||||||
JSON_TYPE = 'application/activity+json; charset=utf-8'
|
JSON_TYPE = 'application/activity+json; charset=utf-8'
|
|
@ -1,6 +1,6 @@
|
||||||
# test_deliver.py
|
# test_deliver.py
|
||||||
#
|
#
|
||||||
# Part of chapeau, an ActivityPub daemon.
|
# Part of kepi, an ActivityPub daemon.
|
||||||
# Copyright (c) 2018-2019 Marnanel Thurman.
|
# Copyright (c) 2018-2019 Marnanel Thurman.
|
||||||
# Licensed under the GNU Public License v2.
|
# Licensed under the GNU Public License v2.
|
||||||
|
|
||||||
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
from django.test import TestCase, Client
|
from django.test import TestCase, Client
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from chapeau.bowler_pub.delivery import deliver
|
from kepi.bowler_pub.delivery import deliver
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.models import AcObject
|
from kepi.bowler_pub.models import AcObject
|
||||||
import chapeau.bowler_pub.views as bowler_pub_views
|
import kepi.bowler_pub.views as bowler_pub_views
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
from . import *
|
from . import *
|
||||||
import logging
|
import logging
|
||||||
|
@ -24,7 +24,7 @@ import requests
|
||||||
# FIXME test caching
|
# FIXME test caching
|
||||||
# FIXME test invalid keys
|
# FIXME test invalid keys
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
REMOTE_PATH_NAMES = {
|
REMOTE_PATH_NAMES = {
|
||||||
'/users/fred/inbox': 'fred',
|
'/users/fred/inbox': 'fred',
|
||||||
|
@ -38,7 +38,7 @@ class TestDelivery(TestCase):
|
||||||
|
|
||||||
def _set_up_remote_user_mocks(self):
|
def _set_up_remote_user_mocks(self):
|
||||||
|
|
||||||
keys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
keys = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
|
|
||||||
create_remote_person(
|
create_remote_person(
|
||||||
url = REMOTE_FRED,
|
url = REMOTE_FRED,
|
||||||
|
@ -86,7 +86,7 @@ class TestDelivery(TestCase):
|
||||||
|
|
||||||
def _set_up_local_user_mocks(self):
|
def _set_up_local_user_mocks(self):
|
||||||
|
|
||||||
keys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0002.json', 'r'))
|
keys = json.load(open('kepi/bowler_pub/tests/keys/keys-0002.json', 'r'))
|
||||||
|
|
||||||
# I know these aren't mocks. This is just for consistency.
|
# I know these aren't mocks. This is just for consistency.
|
||||||
create_local_person(name='alice',
|
create_local_person(name='alice',
|
|
@ -1,14 +1,14 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from chapeau.bowler_pub.find import find
|
from kepi.bowler_pub.find import find
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from . import *
|
from . import *
|
||||||
import httpretty
|
import httpretty
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from chapeau.bowler_pub.utils import as_json
|
from kepi.bowler_pub.utils import as_json
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
REMOTE_URL = 'https://remote.example.net/fnord'
|
REMOTE_URL = 'https://remote.example.net/fnord'
|
||||||
|
|
|
@ -6,7 +6,7 @@ import json
|
||||||
HOST_META_URL = 'https://altair.example.com/.well-known/host-meta'
|
HOST_META_URL = 'https://altair.example.com/.well-known/host-meta'
|
||||||
HOST_META_MIME_TYPE = 'application/xrd+xml'
|
HOST_META_MIME_TYPE = 'application/xrd+xml'
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
class TestHostMeta(TestCase):
|
class TestHostMeta(TestCase):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import json
|
||||||
HOST_META_URL = 'https://altair.example.com/.well-known/host-meta'
|
HOST_META_URL = 'https://altair.example.com/.well-known/host-meta'
|
||||||
HOST_META_MIME_TYPE = 'application/xrd+xml'
|
HOST_META_MIME_TYPE = 'application/xrd+xml'
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
class TestHostMeta(TestCase):
|
class TestHostMeta(TestCase):
|
||||||
|
|
|
@ -7,7 +7,7 @@ NODEINFO_PART_1_URL = 'http://testserver/.well-known/nodeinfo'
|
||||||
NODEINFO_PART_2_URL = 'http://testserver/nodeinfo.json'
|
NODEINFO_PART_2_URL = 'http://testserver/nodeinfo.json'
|
||||||
MIME_TYPE = 'application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#'
|
MIME_TYPE = 'application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#'
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
class TestNodeinfo(TestCase):
|
class TestNodeinfo(TestCase):
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class TestNodeinfo(TestCase):
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
response['software']['name'],
|
response['software']['name'],
|
||||||
'chapeau',
|
'kepi',
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertIn(
|
self.assertIn(
|
|
@ -1,10 +1,10 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from unittest import skip
|
from unittest import skip
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.models import *
|
from kepi.bowler_pub.models import *
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
class TestPolymorph(TestCase):
|
class TestPolymorph(TestCase):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test import TestCase, Client
|
from django.test import TestCase, Client
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from . import create_local_person
|
from . import create_local_person
|
||||||
import httpretty
|
import httpretty
|
||||||
import logging
|
import logging
|
||||||
|
@ -12,7 +12,7 @@ OUTBOX_PATH = '/users/alice/outbox'
|
||||||
|
|
||||||
MIME_TYPE = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
MIME_TYPE = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
VICTORIA_WOOD = {
|
VICTORIA_WOOD = {
|
||||||
"type": "Create",
|
"type": "Create",
|
||||||
|
@ -126,7 +126,7 @@ class TestOutbox(TestCase):
|
||||||
what):
|
what):
|
||||||
|
|
||||||
if not hasattr(self, '_example_user'):
|
if not hasattr(self, '_example_user'):
|
||||||
keys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
keys = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
|
|
||||||
alice = create_local_person(
|
alice = create_local_person(
|
||||||
name='alice',
|
name='alice',
|
|
@ -1,11 +1,11 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from unittest import skip
|
from unittest import skip
|
||||||
from chapeau.bowler_pub.tests import *
|
from kepi.bowler_pub.tests import *
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.models.audience import Audience, AUDIENCE_FIELD_NAMES
|
from kepi.bowler_pub.models.audience import Audience, AUDIENCE_FIELD_NAMES
|
||||||
from chapeau.bowler_pub.models.mention import Mention
|
from kepi.bowler_pub.models.mention import Mention
|
||||||
from chapeau.bowler_pub.models.item import AcItem
|
from kepi.bowler_pub.models.item import AcItem
|
||||||
from chapeau.bowler_pub.models.following import Following
|
from kepi.bowler_pub.models.following import Following
|
||||||
from django.test import Client
|
from django.test import Client
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import httpretty
|
import httpretty
|
||||||
|
@ -43,7 +43,7 @@ OBJECT_FORM = {
|
||||||
MIME_TYPE = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
MIME_TYPE = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||||
INVALID_UTF8 = b"\xa0\xa1"
|
INVALID_UTF8 = b"\xa0\xa1"
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
class TestInbox2(TestCase):
|
class TestInbox2(TestCase):
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class TestInbox2(TestCase):
|
||||||
]
|
]
|
||||||
|
|
||||||
if recipientKeys is None:
|
if recipientKeys is None:
|
||||||
recipientKeys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
recipientKeys = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
|
|
||||||
if recipient is None:
|
if recipient is None:
|
||||||
recipient = create_local_person(
|
recipient = create_local_person(
|
||||||
|
@ -75,7 +75,7 @@ class TestInbox2(TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
if senderKeys is None:
|
if senderKeys is None:
|
||||||
senderKeys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0002.json', 'r'))
|
senderKeys = json.load(open('kepi/bowler_pub/tests/keys/keys-0002.json', 'r'))
|
||||||
|
|
||||||
if sender is None:
|
if sender is None:
|
||||||
sender = create_remote_person(
|
sender = create_remote_person(
|
||||||
|
@ -163,7 +163,7 @@ class TestInbox2(TestCase):
|
||||||
|
|
||||||
@httpretty.activate
|
@httpretty.activate
|
||||||
def test_sole_inbox(self):
|
def test_sole_inbox(self):
|
||||||
recipientKeys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
recipientKeys = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
recipient = create_local_person(
|
recipient = create_local_person(
|
||||||
name = 'alice',
|
name = 'alice',
|
||||||
publicKey = recipientKeys['public'],
|
publicKey = recipientKeys['public'],
|
||||||
|
@ -192,7 +192,7 @@ class TestInbox2(TestCase):
|
||||||
|
|
||||||
@httpretty.activate
|
@httpretty.activate
|
||||||
def test_shared_inbox(self):
|
def test_shared_inbox(self):
|
||||||
recipientKeys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
recipientKeys = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
recipient = create_local_person(
|
recipient = create_local_person(
|
||||||
name = 'alice',
|
name = 'alice',
|
||||||
publicKey = recipientKeys['public'],
|
publicKey = recipientKeys['public'],
|
|
@ -1,12 +1,12 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from unittest import skip
|
from unittest import skip
|
||||||
from chapeau.bowler_pub.tests import *
|
from kepi.bowler_pub.tests import *
|
||||||
from chapeau.bowler_pub.create import create
|
from kepi.bowler_pub.create import create
|
||||||
from chapeau.bowler_pub.models.audience import Audience, AUDIENCE_FIELD_NAMES
|
from kepi.bowler_pub.models.audience import Audience, AUDIENCE_FIELD_NAMES
|
||||||
from chapeau.bowler_pub.models.mention import Mention
|
from kepi.bowler_pub.models.mention import Mention
|
||||||
from chapeau.bowler_pub.models.item import AcItem
|
from kepi.bowler_pub.models.item import AcItem
|
||||||
from chapeau.bowler_pub.models.acobject import AcObject
|
from kepi.bowler_pub.models.acobject import AcObject
|
||||||
from chapeau.bowler_pub.models.activity import AcActivity
|
from kepi.bowler_pub.models.activity import AcActivity
|
||||||
from django.test import Client
|
from django.test import Client
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import httpretty
|
import httpretty
|
||||||
|
@ -44,7 +44,7 @@ CREATE_FORM = {
|
||||||
'object': OBJECT_FORM,
|
'object': OBJECT_FORM,
|
||||||
}
|
}
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
class TestOutbox(TestCase):
|
class TestOutbox(TestCase):
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class TestOutbox(TestCase):
|
||||||
):
|
):
|
||||||
|
|
||||||
if keys is None:
|
if keys is None:
|
||||||
keys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
keys = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
|
|
||||||
if sender is None:
|
if sender is None:
|
||||||
sender = create_local_person(
|
sender = create_local_person(
|
||||||
|
@ -163,7 +163,7 @@ class TestOutbox(TestCase):
|
||||||
|
|
||||||
def test_post_by_remote_interloper(self):
|
def test_post_by_remote_interloper(self):
|
||||||
|
|
||||||
keys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0002.json', 'r'))
|
keys = json.load(open('kepi/bowler_pub/tests/keys/keys-0002.json', 'r'))
|
||||||
|
|
||||||
sender = create_remote_person(
|
sender = create_remote_person(
|
||||||
url = REMOTE_DAVE_ID,
|
url = REMOTE_DAVE_ID,
|
||||||
|
@ -190,8 +190,8 @@ class TestOutbox(TestCase):
|
||||||
|
|
||||||
def test_post_by_local_interloper(self):
|
def test_post_by_local_interloper(self):
|
||||||
|
|
||||||
keys1 = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
keys1 = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
keys2 = json.load(open('chapeau/bowler_pub/tests/keys/keys-0002.json', 'r'))
|
keys2 = json.load(open('kepi/bowler_pub/tests/keys/keys-0002.json', 'r'))
|
||||||
|
|
||||||
create_local_person(
|
create_local_person(
|
||||||
name = 'alice',
|
name = 'alice',
|
||||||
|
@ -344,7 +344,7 @@ class TestOutbox(TestCase):
|
||||||
|
|
||||||
c = Client()
|
c = Client()
|
||||||
|
|
||||||
keys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
keys = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
|
|
||||||
alice = create_local_person(
|
alice = create_local_person(
|
||||||
name = 'alice',
|
name = 'alice',
|
|
@ -1,6 +1,6 @@
|
||||||
from django.test import TestCase, Client
|
from django.test import TestCase, Client
|
||||||
from chapeau.bowler_pub.validation import IncomingMessage, validate
|
from kepi.bowler_pub.validation import IncomingMessage, validate
|
||||||
from chapeau.bowler_pub.models import AcObject
|
from kepi.bowler_pub.models import AcObject
|
||||||
from unittest import skip
|
from unittest import skip
|
||||||
import httpretty
|
import httpretty
|
||||||
from . import *
|
from . import *
|
||||||
|
@ -13,7 +13,7 @@ import json
|
||||||
# FIXME test caching
|
# FIXME test caching
|
||||||
# FIXME test invalid keys
|
# FIXME test invalid keys
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
ACTIVITY_ID = "https://example.com/04b065f8-81c4-408e-bec3-9fb1f7c06408"
|
ACTIVITY_ID = "https://example.com/04b065f8-81c4-408e-bec3-9fb1f7c06408"
|
||||||
INBOX_HOST = 'europa.example.com'
|
INBOX_HOST = 'europa.example.com'
|
||||||
|
@ -37,7 +37,7 @@ class TestValidationTasks(TestCase):
|
||||||
@httpretty.activate
|
@httpretty.activate
|
||||||
def test_local_lookup(self):
|
def test_local_lookup(self):
|
||||||
|
|
||||||
keys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
keys = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
|
|
||||||
alice = create_local_person(
|
alice = create_local_person(
|
||||||
name = 'alice',
|
name = 'alice',
|
||||||
|
@ -67,7 +67,7 @@ class TestValidationTasks(TestCase):
|
||||||
@httpretty.activate
|
@httpretty.activate
|
||||||
def test_remote_user_known(self):
|
def test_remote_user_known(self):
|
||||||
|
|
||||||
keys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
keys = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
fetched = {
|
fetched = {
|
||||||
'fred': False,
|
'fred': False,
|
||||||
}
|
}
|
||||||
|
@ -108,8 +108,8 @@ class TestValidationTasks(TestCase):
|
||||||
@httpretty.activate
|
@httpretty.activate
|
||||||
def test_remote_user_spoofed(self):
|
def test_remote_user_spoofed(self):
|
||||||
|
|
||||||
keys1 = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
keys1 = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
keys2 = json.load(open('chapeau/bowler_pub/tests/keys/keys-0002.json', 'r'))
|
keys2 = json.load(open('kepi/bowler_pub/tests/keys/keys-0002.json', 'r'))
|
||||||
|
|
||||||
fetched = {
|
fetched = {
|
||||||
'fred': False,
|
'fred': False,
|
||||||
|
@ -153,7 +153,7 @@ class TestValidationTasks(TestCase):
|
||||||
@httpretty.activate
|
@httpretty.activate
|
||||||
def test_remote_user_gone(self):
|
def test_remote_user_gone(self):
|
||||||
|
|
||||||
keys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
keys = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
fetched = {
|
fetched = {
|
||||||
'fred': False,
|
'fred': False,
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ class TestValidationTasks(TestCase):
|
||||||
@httpretty.activate
|
@httpretty.activate
|
||||||
def test_remote_user_unknown(self):
|
def test_remote_user_unknown(self):
|
||||||
|
|
||||||
keys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
keys = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
fetched = {
|
fetched = {
|
||||||
'fred': False,
|
'fred': False,
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ from . import *
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
ALICE_SUMMARY = 'Remember Alice? It\'s a song about Alice.'
|
ALICE_SUMMARY = 'Remember Alice? It\'s a song about Alice.'
|
||||||
|
|
|
@ -8,12 +8,12 @@ WEBFINGER_BASE_URL = 'https://altair.example.com/.well-known/webfinger'
|
||||||
WEBFINGER_URL = WEBFINGER_BASE_URL + '?resource={}'
|
WEBFINGER_URL = WEBFINGER_BASE_URL + '?resource={}'
|
||||||
WEBFINGER_MIME_TYPE = 'application/jrd+json; charset=utf-8'
|
WEBFINGER_MIME_TYPE = 'application/jrd+json; charset=utf-8'
|
||||||
|
|
||||||
logger = logging.getLogger(name='chapeau')
|
logger = logging.getLogger(name='kepi')
|
||||||
|
|
||||||
class TestWebfinger(TestCase):
|
class TestWebfinger(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
keys = json.load(open('chapeau/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
keys = json.load(open('kepi/bowler_pub/tests/keys/keys-0001.json', 'r'))
|
||||||
|
|
||||||
create_local_person(
|
create_local_person(
|
||||||
name='alice',
|
name='alice',
|