Skip to content

Commit 1627ff6

Browse files
committed
translate webmention from home page into profile (actor) Update
for #376, #331
1 parent 21c79a3 commit 1627ff6

File tree

7 files changed

+262
-150
lines changed

7 files changed

+262
-150
lines changed

activitypub.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
@flask_util.cached(cache, CACHE_TIME)
4040
def actor(domain):
4141
"""Fetches a domain's h-card and converts to AS2 actor."""
42-
actor = common.actor(domain)
42+
_, _, actor, _ = common.actor(domain)
4343
return (actor, {
4444
'Content-Type': as2.CONTENT_TYPE,
4545
'Access-Control-Allow-Origin': '*',

common.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def actor(domain, user=None):
546546
domain: str
547547
user: :class:`User`, optional
548548
549-
Returns: dict, AS2 actor
549+
Returns: (dict mf2 item, dict AS1 actor, dict AS2 actor, User)
550550
"""
551551
tld = domain.split('.')[-1]
552552
if tld in TLD_BLOCKLIST:
@@ -586,7 +586,7 @@ def actor(domain, user=None):
586586
})
587587

588588
logger.info(f'Generated AS2 actor: {json_dumps(actor_as2, indent=2)}')
589-
return actor_as2
589+
return hcard, actor_as1, actor_as2, user
590590

591591

592592
def fetch_followers(domain, collection):

models.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ def verify(self):
211211

212212
# check home page
213213
try:
214-
self.actor_as2 = json_dumps(common.actor(self.key.id(), user=self))
214+
_, _, actor_as2, _ = common.actor(self.key.id(), user=self)
215+
self.actor_as2 = json_dumps(actor_as2)
215216
self.has_hcard = True
216217
except (BadRequest, NotFound):
217218
self.actor_as2 = None

templates/docs.html

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<p><em>Setup</em></p>
3434
<li><a href="#setup">How do I set it up?</a></li>
3535
<li><a href="#profile">How do I set up my profile?</a></li>
36+
<li><a href="#update-profile">How do I update my profile?</a></li>
3637
<li><a href="#user-page">Where's my user page and dashboard?</a></li>
3738

3839
<br>
@@ -173,6 +174,11 @@ <h3 id="setup">Setup</h3>
173174
</pre>
174175
</li>
175176

177+
<li id="update-profile" class="question">How do I update my profile?</li>
178+
<li class="answer">
179+
<p> If you've changed the <a href="https://indieweb.org/representative_h-card">representative h-card</a> on your site's home page, and you want to update your profile in Mastodon to match, click the <button class="btn btn-default glyphicon glyphicon-refresh"></button> button next to your domain <a href="/web-site">on your user page</a>. Alternatively, you can send a webmention from your home page to <code>https://fed.brid.gy/</code>.
180+
</li>
181+
176182
<li id="user-page" class="question">Where's my user page and dashboard?</li>
177183
<li class="answer">
178184
<p>

tests/test_redirect.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def _test_as2(self, accept, mock_get):
7777
del repost['cc']
7878
repost.update({
7979
'to': [as2.PUBLIC_AUDIENCE],
80-
'object': 'http://orig/post',
80+
'object': 'https://orig/post',
8181
})
8282

8383
mock_get.return_value = requests_response(

0 commit comments

Comments
 (0)