Verified Commit 703d70d5 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Use absolute urls

parent 0c8faf83
...@@ -6,6 +6,7 @@ from django.conf import settings ...@@ -6,6 +6,7 @@ from django.conf import settings
from dynamic_preferences.registries import global_preferences_registry from dynamic_preferences.registries import global_preferences_registry
from . import models from . import models
from . import utils
def get_actor_data(actor_url): def get_actor_data(actor_url):
...@@ -29,18 +30,22 @@ def get_base_system_actor_arguments(name): ...@@ -29,18 +30,22 @@ def get_base_system_actor_arguments(name):
'type': 'Person', 'type': 'Person',
'name': '{}\'s library'.format(settings.FEDERATION_HOSTNAME), 'name': '{}\'s library'.format(settings.FEDERATION_HOSTNAME),
'manually_approves_followers': True, 'manually_approves_followers': True,
'url': reverse( 'url': utils.full_url(
'federation:instance-actors-detail', reverse(
kwargs={'actor': name}), 'federation:instance-actors-detail',
'shared_inbox_url': reverse( kwargs={'actor': name})),
'federation:instance-actors-inbox', 'shared_inbox_url': utils.full_url(
kwargs={'actor': name}), reverse(
'inbox_url': reverse( 'federation:instance-actors-inbox',
'federation:instance-actors-inbox', kwargs={'actor': name})),
kwargs={'actor': name}), 'inbox_url': utils.full_url(
'outbox_url': reverse( reverse(
'federation:instance-actors-outbox', 'federation:instance-actors-inbox',
kwargs={'actor': name}), kwargs={'actor': name})),
'outbox_url': utils.full_url(
reverse(
'federation:instance-actors-outbox',
kwargs={'actor': name})),
'public_key': preferences['federation__public_key'], 'public_key': preferences['federation__public_key'],
'summary': 'Bot account to federate with {}\'s library'.format( 'summary': 'Bot account to federate with {}\'s library'.format(
settings.FEDERATION_HOSTNAME settings.FEDERATION_HOSTNAME
......
from django.urls import reverse from django.urls import reverse
from funkwhale_api.federation import actors from funkwhale_api.federation import actors
from funkwhale_api.federation import utils
def test_actor_fetching(r_mock): def test_actor_fetching(r_mock):
...@@ -24,15 +25,18 @@ def test_get_library(settings, preferences): ...@@ -24,15 +25,18 @@ def test_get_library(settings, preferences):
'type': 'Person', 'type': 'Person',
'name': '{}\'s library'.format(settings.FEDERATION_HOSTNAME), 'name': '{}\'s library'.format(settings.FEDERATION_HOSTNAME),
'manually_approves_followers': True, 'manually_approves_followers': True,
'url': reverse( 'url': utils.full_url(
'federation:instance-actors-detail', reverse(
kwargs={'actor': 'library'}), 'federation:instance-actors-detail',
'shared_inbox_url': reverse( kwargs={'actor': 'library'})),
'federation:instance-actors-inbox', 'shared_inbox_url': utils.full_url(
kwargs={'actor': 'library'}), reverse(
'inbox_url': reverse( 'federation:instance-actors-inbox',
'federation:instance-actors-inbox', kwargs={'actor': 'library'})),
kwargs={'actor': 'library'}), 'inbox_url': utils.full_url(
reverse(
'federation:instance-actors-inbox',
kwargs={'actor': 'library'})),
'public_key': 'public_key', 'public_key': 'public_key',
'summary': 'Bot account to federate with {}\'s library'.format( 'summary': 'Bot account to federate with {}\'s library'.format(
settings.FEDERATION_HOSTNAME), settings.FEDERATION_HOSTNAME),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment