good progress

pull/20/head
quadrismegistus 4 years ago
parent 95bf840926
commit 8d07fd3a5a

@ -241,7 +241,7 @@ class MainApp(MDApp):
@property
def channel(self):
return self.uri.split('/')[1] if self.uri and self.uri.count('/')>=2 else None
return self.uri.split('/')[2] if self.uri and self.uri.count('/')>=2 else None
@ -390,7 +390,7 @@ class MainApp(MDApp):
if not channel in self.keys:
self.log('!! tsk tsk dont be nosy')
return
return await self.get_posts(uri=os.path.join(prefix,channel))
return await self.get_posts(uri='/'+os.path.join(prefix,channel))
async def get_channel_inbox(self,channel):
return await self.get_channel_posts(channel=channel,prefix='inbox')
@ -398,13 +398,13 @@ class MainApp(MDApp):
async def get_channel_outbox(self,channel):
return await self.get_channel_posts(channel=channel,prefix='outbox')
async def get_my_posts(self,username=None):
async def get_my_posts(self,username=None,prefix='outbox'):
if username is None and self.username: username=self.username
if not username:
self.log(f'!! whose posts?')
return
self.log(f'get_my_posts({self.username})')
return await self.get_channel(username)
return await self.get_channel_outbox(username)

@ -26,11 +26,9 @@ class BaseScreen(MDScreen):
def channel(self):
return self.app.channel
class ProtectedScreen(BaseScreen):
def on_pre_enter(self):
async def guard():
keys=await self.app.get_keys()
if not self.channel in keys:
self.root.change_screen('login')
return
asyncio.create_task(guard())
class ProtectedScreen(BaseScreen): pass
# def on_pre_enter(self):
# if not self.channel in self.app.api.keys:
# self.root.change_screen('login')
# return

@ -16,7 +16,8 @@
id: loginbox
orientation:'vertical'
cols:1
size_hint:0.5,None
size_hint:None,None
width: '300sp'
pos_hint: {'center_x':0.5,'center_y':0.5}
md_bg_color: rgb(*COLOR_CARD)
radius:[20,]

@ -45,6 +45,7 @@ class LoginScreen(BaseScreen):
self.label_title.color=rgb(*COLOR_TEXT)
self.label_title.text='Welcome,'
# self.label_title.font_size*=1.5
self.layout.add_widget(get_separator('20sp'))
self.layout.add_widget(self.label_title)
self.layout.add_widget(get_separator('30sp'))
# self.layout.add_widget(MySeparator())
@ -81,7 +82,7 @@ class LoginScreen(BaseScreen):
# self.layout.add_widget(self.layout_password)
self.layout_buttons = LoginButtonLayout()
self.layout.add_widget(get_separator('10sp'))
self.layout.add_widget(get_separator('20sp'))
self.layout.add_widget(self.layout_buttons)
# self.login_button = LoginButton()

@ -709,7 +709,6 @@ class Api(object):
post_id = get_random_id()
author_privkey = self.keys[data.get('author')]
channels = data.get('to_channels',[])
del data['to_channels']
for channel in channels:
self.log('ADDING TO CHANNEL??',channel)
pubkey_channel = self.keys[channel].public_key()

@ -61,11 +61,6 @@ class Server:
neighbs=self.bootstrappable_neighbors()
neighbors=' '.join(':'.join(str(x) for x in ip_port) for ip_port in neighbs)
repr = f"""storing {len(self.storage.data)} keys and has {len(neighbs)} neighbors""" #:\n\t{neighbors}"""
# transport = {self.transport}
# protocol = {self.protocol}
# refresh_loop = {self.refresh_loop}
# save_state_loop = {self.save_state_loop}
return repr

Loading…
Cancel
Save