From a0a756d320d689f051d29a94d6e85b73b5105be5 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 8 Sep 2019 12:13:18 +0200 Subject: [PATCH] Allow to disable webmentions via config --- README.md | 7 ++++--- config.py | 2 ++ core/tasks.py | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f9a8412..888ba55 100644 --- a/README.md +++ b/README.md @@ -36,12 +36,13 @@ - with dark and light version - IndieWeb citizen - Microformats aware (exports `h-feed`, `h-entry`, `h-cards`, ...) - - Exports RSS/Atom/[JSON](https://jsonfeed.org/) feeds - - You stream/timeline is also available in an (authenticated) JSON feed - Implements [IndieAuth](https://indieauth.spec.indieweb.org/) endpoints (authorization and token endpoint) - U2F support - You can use your ActivityPub identity to login to other websites/app - - Comes with a tiny HTTP API to help posting new content and and read your inbox/notifications + - Send [Webmentions](https://www.w3.org/TR/webmention/) (only for public notes) + - Exports RSS/Atom/[JSON](https://jsonfeed.org/) feeds + - You stream/timeline is also available in an (authenticated) JSON feed + - Comes with a tiny HTTP API to help posting new content and and read your inbox/notifications - Deployable with Docker (Docker compose for everything: dev, test and deployment) - Focused on testing - Tested against the [official ActivityPub test suite](https://test.activitypub.rocks/), see [the results](https://activitypub.rocks/implementation-report/) diff --git a/config.py b/config.py index 4541d28..2e8af94 100644 --- a/config.py +++ b/config.py @@ -173,6 +173,8 @@ if conf.get("emoji_tpl"): # Hosts blacklist BLACKLIST = conf.get("blacklist", []) +DISABLE_WEBMENTIONS = conf.get("disable_webmentions", False) + # By default, we keep 14 of inbox data ; outbox is kept forever (along with bookmarked stuff, outbox replies, liked...) DAYS_TO_KEEP = 14 diff --git a/core/tasks.py b/core/tasks.py index 2d295d6..41479ae 100644 --- a/core/tasks.py +++ b/core/tasks.py @@ -9,6 +9,7 @@ from little_boxes import activitypub as ap from poussetaches import PousseTaches from config import MEDIA_CACHE +from config import DISABLE_WEBMENTIONS from utils import parse_datetime p = PousseTaches( @@ -43,6 +44,9 @@ class Tasks: @staticmethod def send_webmentions(activity: ap.Create, links: Set[str]) -> None: + if DISABLE_WEBMENTIONS: + return None + for link in links: p.push( {