Enable Webmentions for public posts

This commit is contained in:
Thomas Sileo
2019-09-08 12:09:34 +02:00
parent 4d968264f2
commit 018b7bf553
7 changed files with 65 additions and 7 deletions

View File

@@ -1,5 +1,3 @@
import json
import little_boxes.activitypub as ap
import mf2py
import requests
@@ -49,7 +47,7 @@ def lookup(url: str) -> ap.BaseActivity:
# Maybe the page was JSON-LD?
data = resp.json()
return ap.parse_activity(data)
except json.JSONDecodeError:
except Exception:
pass
# Try content negotiation (retry with the AP Accept header)

View File

@@ -40,7 +40,7 @@ def _discover_webmention_endoint(url: str) -> Optional[str]:
return None
def discover_webmention_endoint(url: str) -> Optional[str]:
def discover_webmention_endpoint(url: str) -> Optional[str]:
"""Discover the Webmention endpoint of a given URL, if any.
Passes all the tests at https://webmention.rocks!