Dramatically improved processing of Micropub tokens which supports both the Authorization header and the access_token field approaches

This commit is contained in:
Danielle McLean 2017-12-18 09:51:06 +11:00
parent e5f2e9d537
commit b89405ed88
Signed by untrusted user: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
4 changed files with 71 additions and 27 deletions

View file

@ -46,6 +46,11 @@ class User(ModelMeta, AbstractUser):
def get_absolute_url(self):
return self.url
@property
def full_url(self):
base = 'https://' + DjangoSite.objects.get_current().domain
return urljoin(base, self.url)
@property
def description(self):
return utils.to_plain(self.note)
@ -74,8 +79,8 @@ class User(ModelMeta, AbstractUser):
return {
'@context': 'http://schema.org',
'@type': 'Person',
'@id': urljoin(base, self.url),
'url': urljoin(base, self.url),
'@id': self.full_url,
'url': self.full_url,
'name': self.name,
'email': self.email,
'image': urljoin(base, self.avatar.url),