Added FUNKWHALE_HOSTNAME and FEDERATION_HOSTNAME settings

This commit is contained in:
Eliot Berriot 2018-03-29 00:00:01 +02:00
parent 588da6ff33
commit 90c1d02919
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
3 changed files with 36 additions and 1 deletions

View file

@ -0,0 +1,14 @@
from django.conf import settings
def full_url(path):
"""
Given a relative path, return a full url usable for federation purpose
"""
root = settings.FUNKWHALE_URL
if path.startswith('/') and root.endswith('/'):
return root + path[1:]
elif not path.startswith('/') and not root.endswith('/'):
return root + '/' + path
else:
return root + path