Mercurial > libervia-backend
changeset 3947:08c1d5485411
cli (pubsub/set, edit): add `--encrypt` flag:
rel 380
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 15 Oct 2022 20:38:33 +0200 |
parents | f2a5936f2496 |
children | cd4d95b3fed3 |
files | sat_frontends/jp/cmd_pubsub.py |
diffstat | 1 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_pubsub.py Sat Oct 15 20:38:33 2022 +0200 +++ b/sat_frontends/jp/cmd_pubsub.py Sat Oct 15 20:38:33 2022 +0200 @@ -1224,6 +1224,12 @@ def add_parser_options(self): NodeCreate.add_node_config_options(self.parser) self.parser.add_argument( + "-e", + "--encrypt", + action="store_true", + help=_("end-to-end encrypt the blog item") + ) + self.parser.add_argument( "item", nargs="?", default="", @@ -1235,6 +1241,8 @@ element = xml_tools.getPayload(self, element) payload = etree.tostring(element, encoding="unicode") extra = {} + if self.args.encrypt: + extra["encrypted"] = True publish_options = NodeCreate.get_config_options(self.args) if publish_options: extra["publish_options"] = publish_options @@ -1381,15 +1389,23 @@ common.BaseEdit.__init__(self, self.host, PUBSUB_TMP_DIR) def add_parser_options(self): - pass + self.parser.add_argument( + "-e", + "--encrypt", + action="store_true", + help=_("end-to-end encrypt the blog item") + ) async def publish(self, content): + extra = {} + if self.args.encrypt: + extra["encrypted"] = True published_id = await self.host.bridge.psItemSend( self.pubsub_service, self.pubsub_node, content, self.pubsub_item or "", - "", + data_format.serialise(extra), self.profile, ) if published_id: