comparison sat/plugins/plugin_comp_ap_gateway/__init__.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 4f9d4650eab5
children aaa4e7815ba8
comparison
equal deleted inserted replaced
3845:4f9d4650eab5 3846:cc13efdd8360
68 TYPE_ACTOR, 68 TYPE_ACTOR,
69 TYPE_ITEM, 69 TYPE_ITEM,
70 TYPE_FOLLOWERS, 70 TYPE_FOLLOWERS,
71 TYPE_TOMBSTONE, 71 TYPE_TOMBSTONE,
72 TYPE_MENTION, 72 TYPE_MENTION,
73 NS_AP,
73 NS_AP_PUBLIC, 74 NS_AP_PUBLIC,
74 PUBLIC_TUPLE 75 PUBLIC_TUPLE
75 ) 76 )
76 from .regex import RE_MENTION 77 from .regex import RE_MENTION
77 from .http_server import HTTPServer 78 from .http_server import HTTPServer
820 f'"target" is mandatory for activity {activity!r}' 821 f'"target" is mandatory for activity {activity!r}'
821 ) 822 )
822 if activity_id is None: 823 if activity_id is None:
823 activity_id = f"{actor_id}#{activity.lower()}_{shortuuid.uuid()}" 824 activity_id = f"{actor_id}#{activity.lower()}_{shortuuid.uuid()}"
824 data: Dict[str, Any] = { 825 data: Dict[str, Any] = {
825 "@context": "https://www.w3.org/ns/activitystreams", 826 "@context": NS_AP,
826 "actor": actor_id, 827 "actor": actor_id,
827 "id": activity_id, 828 "id": activity_id,
828 "type": activity, 829 "type": activity,
829 } 830 }
830 data.update(kwargs) 831 data.update(kwargs)