From 6bd3f4204081209f41a4439adc88b5dc76b2be4b Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sat, 11 May 2019 11:44:48 +0200 Subject: [PATCH] Remove the Article API --- README.md | 2 +- app.py | 40 ++-------------------------------------- 2 files changed, 3 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 8d35791..c10c6ce 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Getting closer to a stable release, it should be the "last" migration. ## Features - Implements a basic [ActivityPub](https://activitypub.rocks/) server (with federation) - - Compatible with [Mastodon](https://joinmastodon.org/) and others ([Pleroma](https://pleroma.social/), Hubzilla...) + - Compatible with [Mastodon](https://joinmastodon.org/) and others ([Pleroma](https://pleroma.social/), Plume, PixelFed, Hubzilla...) - Also implements a remote follow compatible with Mastodon instances - Exposes your outbox as a basic microblog - Support all content types from the Fediverse (`Note`, `Article`, `Page`, `Video`, `Image`, `Question`...) diff --git a/app.py b/app.py index 05d2991..eef70fd 100644 --- a/app.py +++ b/app.py @@ -1863,41 +1863,6 @@ def api_new_note(): return _user_api_response(activity=create_id) -@app.route("/api/new_article", methods=["POST"]) -@api_required -def api_new_article(): - content = _user_api_arg("content") - if not content: - raise ValueError("missing content") - - name = _user_api_arg("name") - if not name: - raise ValueError("missing name") - - url = _user_api_arg("url") - if not url: - raise ValueError("missing url") - - _id = _user_api_arg("id") - - raw_article = dict( - name=name, - content=content, - url=url, - attributedTo=MY_PERSON.id, - cc=[ID + "/followers"], - to=[ap.AS_PUBLIC], - tag=[], - inReplyTo=None, - ) - - article = ap.Article(**raw_article) - create = article.build_create() - create_id = post_to_outbox(create, obj_id=_id) - - return _user_api_response(activity=create_id) - - @app.route("/api/new_question", methods=["POST"]) @api_required def api_new_question(): @@ -2614,13 +2579,12 @@ def task_finish_post_to_inbox(): return "" -def post_to_outbox(activity: ap.BaseActivity, obj_id: Optional[str] = None) -> str: +def post_to_outbox(activity: ap.BaseActivity) -> str: if activity.has_type(ap.CREATE_TYPES): activity = activity.build_create() # Assign create a random ID - if obj_id is None: - obj_id = back.random_object_id() + obj_id = back.random_object_id() activity.set_id(back.activity_url(obj_id), obj_id)