mirror of
https://github.com/ComradCollective/Comrad
synced 2024-11-13 07:10:49 +00:00
meeting, finally
This commit is contained in:
parent
f056c8bc88
commit
fda1281b86
Binary file not shown.
Before Width: | Height: | Size: 333 KiB |
Binary file not shown.
Before Width: | Height: | Size: 276 KiB |
Binary file not shown.
Before Width: | Height: | Size: 276 KiB |
Binary file not shown.
Before Width: | Height: | Size: 40 KiB |
Binary file not shown.
Before Width: | Height: | Size: 568 KiB |
@ -886,6 +886,30 @@ class MainApp(MDApp, Logger):
|
||||
self.remove_widget(self.msg_dialog)
|
||||
|
||||
|
||||
async def prompt_addcontact(self,post_data):
|
||||
meet_name = post_data.get('meet_name')
|
||||
meet_uri = post_data.get('meet').decode()
|
||||
|
||||
yn=await self.get_input(f"Exchange public keys with {meet_name}? It will allow you and @{meet_name} to read and write encrypted messages to one another.",yesno=True)
|
||||
|
||||
if yn:
|
||||
fnfn = self.comrad.save_uri_as_qrcode(
|
||||
uri_id=meet_uri,
|
||||
name=meet_name
|
||||
)
|
||||
await self.stat(f'''Saved {meet_name}'s public key:\n{meet_uri}.''',img_src=fnfn)
|
||||
await self.stat('Now returning the invitation...')
|
||||
res = await self.comrad.meet_async(meet_name,returning=True)
|
||||
if res.get('success'):
|
||||
await self.stat('Invitation successfully sent.')
|
||||
do_pause()
|
||||
else:
|
||||
self.stat(res.get('status'))
|
||||
|
||||
|
||||
# async def meet(self,other_name,other_uri=None):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -106,6 +106,7 @@ class PostCard(MDCard):
|
||||
# self.log('PostCard() got data: '+str(data))
|
||||
self.author = data.get('author','[Anonymous]')
|
||||
self.recipient = data.get('to_name','')
|
||||
self.post_data = data.get('post_data', {})
|
||||
if not self.recipient:
|
||||
self.recipient=self.app.channel
|
||||
|
||||
@ -223,6 +224,74 @@ class PostCard(MDCard):
|
||||
self.add_widget(scroller)
|
||||
# self.add_widget(post_layout)
|
||||
|
||||
|
||||
###
|
||||
# Add any buttons? Any prompts?
|
||||
if self.post_data.get('type')=='prompt':
|
||||
# # prepare button layout
|
||||
# self.button_layout = MDBoxLayout()
|
||||
# self.button_layout.adaptive_width=True
|
||||
# self.button_layout.height='56dp'
|
||||
# self.button_layout.spacing='10dp'
|
||||
# self.button_layout.pos_hint={'center_x': .5, 'y':0.05}
|
||||
|
||||
if self.post_data.get('prompt_id')=='addcontact':
|
||||
def on_touch_down(touch):
|
||||
if hasattr(self,'_touched') and self._touched: return
|
||||
if self.collide_point(*touch.pos):
|
||||
asyncio.create_task(self.app.prompt_addcontact(self.post_data))
|
||||
self._touched=True
|
||||
self.on_touch_down=on_touch_down
|
||||
|
||||
# # self.stat(f"Add @{meet_name}'s public key to your address book? It will allow you and @{meet_name} to read and write encrypted messages to one another.")
|
||||
|
||||
|
||||
# if do_adduser.strip().lower()=='y':
|
||||
|
||||
# import pyqrcode
|
||||
# print('meet_uri',meet_uri,'???')
|
||||
# qr = pyqrcode.create(meet_uri)
|
||||
# fnfn = os.path.join(PATH_QRCODES,meet_name+'.png') # self.get_path_qrcode(name=name)
|
||||
# qr.png(fnfn,scale=5)
|
||||
|
||||
# clear_screen()
|
||||
# self.stat(f'The public key of @{meet_name} has been saved as a QRcode to {fnfn}')
|
||||
# print(qrstr)
|
||||
# do_pause()
|
||||
# clear_screen()
|
||||
|
||||
# self.button = MDRectangleFlatButton()
|
||||
# self.post_button = PostButton()
|
||||
# self.post_button.screen = self
|
||||
# self.post_status = PostStatus()
|
||||
# self.post_status_added = False
|
||||
|
||||
|
||||
# self.button_layout.add_widget(self.upload_button)
|
||||
# self.button_layout.add_widget(self.post_button)
|
||||
|
||||
# self.upload_button.font_size='8sp'
|
||||
# self.post_button.font_size='8sp'
|
||||
|
||||
|
||||
# self.post_button.md_bg_color=rgb(*COLOR_CARD)
|
||||
# self.upload_button.md_bg_color=rgb(*COLOR_CARD)
|
||||
# self.post_status.md_bg_color=rgb(*COLOR_CARD)
|
||||
|
||||
# post.add_widget(self.button_layout)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# self.log('?????',self.cache_img_src, os.path.exists(self.cache_img_src), os.stat(self.cache_img_src).st_size)
|
||||
if self.cache_img_src and (not os.path.exists(self.cache_img_src) or not os.stat(self.cache_img_src).st_size):
|
||||
async def do_download_later():
|
||||
@ -308,7 +377,8 @@ class FeedScreen(ProtectedScreen):
|
||||
'author':post.from_name,
|
||||
'to_name':post.to_name,
|
||||
'content':post.msg.get('txt') if type(post.msg)==dict else str(post.msg),
|
||||
'timestamp':post.timestamp
|
||||
'timestamp':post.timestamp,
|
||||
'post_data':post.data,
|
||||
}
|
||||
post_obj = PostCard(data)
|
||||
self.posts.append(post_obj)
|
||||
|
@ -911,7 +911,7 @@ class LoginScreen(BaseScreen):
|
||||
self.log('My keychain now looks like v2:',dict_format(commie.keychain()))
|
||||
|
||||
|
||||
await logfunc(f'With this scrambled password we can encrypt your super-sensitive private key to:\n(after) {privkey_encr_obj.discreet}',pause=True,clear=False)
|
||||
await logfunc(f'With this scrambled password we can encrypt your super-sensitive private key to (redacted):\n{privkey_encr_obj.discreet}',pause=True,clear=False)
|
||||
|
||||
# store privkey pieces
|
||||
commie.crypt_keys.set(uri_id, privkey_encr_obj.data, prefix='/privkey_encr/')
|
||||
|
@ -380,7 +380,10 @@ class ComradX(Caller):
|
||||
|
||||
|
||||
### MEETING PEOLPE
|
||||
async def meet(self,name=None,pubkey=None,returning=False):
|
||||
def meet(self,*x,**y):
|
||||
return asyncio.run(self.meet_async(*x,**y))
|
||||
|
||||
async def meet_async(self,name=None,pubkey=None,returning=False):
|
||||
if not name and not pubkey:
|
||||
return {'success':False,'status':'Meet whom?'}
|
||||
|
||||
@ -960,7 +963,7 @@ class ComradX(Caller):
|
||||
'msg': msg_from_op.get('msg')
|
||||
}
|
||||
)
|
||||
self.log('msg2me is now v1',msg2me,msg2me.is_encrypted,msg2me.has_embedded_msg)
|
||||
self.log('msg2me is now v1',dict_format(msg2me.msg_d),dict_format(msg2me.data),msg2me.is_encrypted,msg2me.has_embedded_msg)
|
||||
|
||||
if not msg2me.is_encrypted:
|
||||
return {
|
||||
|
@ -818,9 +818,11 @@ class TheOperator(Operator):
|
||||
returning = data.get('returning')
|
||||
|
||||
if returning:
|
||||
txt=f'''Comrad @{meet_from_name} has agreed to make your acquaintance.\n\nTheir public key is:\n{meet_from_uri.decode()}.'''
|
||||
# txt=f'''Comrad @{meet_from_name} has agreed to make your acquaintance.\n\nTheir public key is:\n{meet_from_uri.decode()}.'''
|
||||
txt=f'''Comrad @{meet_from_name} has agreed to make your acquaintance.'''
|
||||
else:
|
||||
txt=f'''Comrad @{meet_from_name} would like to make your acquaintance.\n\nTheir public key is:\n{meet_from_uri.decode()}.'''
|
||||
# txt=f'''Comrad @{meet_from_name} would like to make your acquaintance.\n\nTheir public key is:\n{meet_from_uri.decode()}.'''
|
||||
txt=f'''Comrad @{meet_from_name} would like to make your acquaintance.'''
|
||||
|
||||
# txt_encr = SMessage(
|
||||
# self.privkey.data,
|
||||
|
Loading…
Reference in New Issue
Block a user