Remove the Article API

This commit is contained in:
Thomas Sileo 2019-05-11 11:44:48 +02:00
parent 9566db1213
commit 6bd3f42040
2 changed files with 3 additions and 39 deletions

View file

@ -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`...)

40
app.py
View file

@ -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)