Mercurial > libervia-backend
diff sat/plugins/plugin_comp_ap_gateway/http_server.py @ 3846:cc13efdd8360
component AP gateway: return item when `item` URL is used:
a request on an `item` type URL will return the suitable cached item.
rel 370
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 14 Jul 2022 12:55:30 +0200 |
parents | 65e5718e7710 |
children | aaa4e7815ba8 |
line wrap: on
line diff
--- a/sat/plugins/plugin_comp_ap_gateway/http_server.py Thu Jul 14 12:55:30 2022 +0200 +++ b/sat/plugins/plugin_comp_ap_gateway/http_server.py Thu Jul 14 12:55:30 2022 +0200 @@ -39,7 +39,7 @@ from sat.memory.sqla_mapping import SubscriptionState from .constants import ( - CONTENT_TYPE_AP, TYPE_ACTOR, TYPE_INBOX, TYPE_SHARED_INBOX, TYPE_OUTBOX, + NS_AP, CONTENT_TYPE_AP, TYPE_ACTOR, TYPE_INBOX, TYPE_SHARED_INBOX, TYPE_OUTBOX, AP_REQUEST_TYPES, PAGE_SIZE, ACTIVITY_TYPES_LOWER, ACTIVIY_NO_ACCOUNT_ALLOWED, SIGN_HEADERS, HS2019, SIGN_EXP, TYPE_FOLLOWERS, TYPE_FOLLOWING ) @@ -706,6 +706,9 @@ avatar_filename = extra_args[0] avatar_path = self.apg.host.common_cache.getPath(avatar_filename) return static.File(str(avatar_path)).render(request) + elif request_type == "item": + ret_data = await self.apg.apGetLocalObject(ap_url) + ret_data["@context"] = NS_AP else: if len(extra_args) > 1: log.warning(f"unexpected extra arguments: {extra_args!r}")