cli (pubsub/set, edit): add --encrypt flag:
rel 380
This commit is contained in:
parent
2e46d08225
commit
48d1f2fc21
1 changed files with 18 additions and 2 deletions
|
|
@ -1223,6 +1223,12 @@ class Set(base.CommandBase):
|
|||
|
||||
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="?",
|
||||
|
|
@ -1235,6 +1241,8 @@ class Set(base.CommandBase):
|
|||
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 @@ class Edit(base.CommandBase, common.BaseEdit):
|
|||
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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue