From 17a5257feae8947055c50beb4ed6291323cd3d7f Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 18 Aug 2019 10:20:13 +0200 Subject: [PATCH] Also hide following in the AP API if requested --- app.py | 5 +++++ core/activitypub.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index f6d134d..4dd1e1b 100644 --- a/app.py +++ b/app.py @@ -772,6 +772,11 @@ def following(): if is_api_request(): _log_sig() + if config.HIDE_FOLLOWING: + return jsonify( + **activitypub.simple_build_ordered_collection("following", []) + ) + return jsonify( **activitypub.build_ordered_collection( DB.activities, diff --git a/core/activitypub.py b/core/activitypub.py index 9c172c2..3e071f7 100644 --- a/core/activitypub.py +++ b/core/activitypub.py @@ -24,6 +24,7 @@ from little_boxes.httpsig import HTTPSigAuth from config import BASE_URL from config import DB +from config import DEFAULT_CTX from config import EXTRA_INBOXES from config import ID from config import KEY @@ -538,7 +539,7 @@ def embed_collection(total_items, first_page_id): def simple_build_ordered_collection(col_name, data): return { - "@context": ap.COLLECTION_CTX, + "@context": DEFAULT_CTX, "id": BASE_URL + "/" + col_name, "totalItems": len(data), "type": ap.ActivityType.ORDERED_COLLECTION.value,