comparison sat/plugins/plugin_comp_ap_gateway/http_server.py @ 3793:b5c9021020df

component AP gateway: convert `Delete` AP activities to corresponding Pubsub `retract`: when a `Delete` actity is received, the item is removed from cache, and the corresponding item `retract` is sent to local XMPP subscribers. rel 367
author Goffi <goffi@goffi.org>
date Fri, 17 Jun 2022 14:15:23 +0200
parents 125c7043b277
children 983df907d456
comparison
equal deleted inserted replaced
3792:865167c34b82 3793:b5c9021020df
229 raise exceptions.InternalError( 229 raise exceptions.InternalError(
230 f"Unhandled subscription state {sub.state!r}" 230 f"Unhandled subscription state {sub.state!r}"
231 ) 231 )
232 else: 232 else:
233 log.warning(f"Unmanaged accept type: {type_!r}") 233 log.warning(f"Unmanaged accept type: {type_!r}")
234
235 async def handleDeleteActivity(
236 self,
237 request: "HTTPRequest",
238 data: dict,
239 account_jid: Optional[jid.JID],
240 node: Optional[str],
241 ap_account: Optional[str],
242 ap_url: str,
243 signing_actor: str
244 ):
245 digest = request.getHeader("digest")
246 if digest in self._seen_digest:
247 log.debug(f"Ignoring duplicated request (digest: {digest!r})")
248 return
249 self._seen_digest.append(digest)
250 if node is None:
251 node = self.apg._m.namespace
252 client = await self.apg.getVirtualClient(signing_actor)
253 objects = await self.apg.apGetList(data, "object")
254 for obj in objects:
255 await self.apg.newAPDeleteItem(client, account_jid, node, obj)
234 256
235 async def handleCreateActivity( 257 async def handleCreateActivity(
236 self, 258 self,
237 request: "HTTPRequest", 259 request: "HTTPRequest",
238 data: dict, 260 data: dict,