mirror of
https://github.com/ComradCollective/Comrad
synced 2024-11-16 00:12:48 +00:00
good progress
This commit is contained in:
parent
95bf840926
commit
8d07fd3a5a
@ -241,7 +241,7 @@ class MainApp(MDApp):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def channel(self):
|
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:
|
if not channel in self.keys:
|
||||||
self.log('!! tsk tsk dont be nosy')
|
self.log('!! tsk tsk dont be nosy')
|
||||||
return
|
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):
|
async def get_channel_inbox(self,channel):
|
||||||
return await self.get_channel_posts(channel=channel,prefix='inbox')
|
return await self.get_channel_posts(channel=channel,prefix='inbox')
|
||||||
@ -398,13 +398,13 @@ class MainApp(MDApp):
|
|||||||
async def get_channel_outbox(self,channel):
|
async def get_channel_outbox(self,channel):
|
||||||
return await self.get_channel_posts(channel=channel,prefix='outbox')
|
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 username is None and self.username: username=self.username
|
||||||
if not username:
|
if not username:
|
||||||
self.log(f'!! whose posts?')
|
self.log(f'!! whose posts?')
|
||||||
return
|
return
|
||||||
self.log(f'get_my_posts({self.username})')
|
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):
|
def channel(self):
|
||||||
return self.app.channel
|
return self.app.channel
|
||||||
|
|
||||||
class ProtectedScreen(BaseScreen):
|
class ProtectedScreen(BaseScreen): pass
|
||||||
def on_pre_enter(self):
|
# def on_pre_enter(self):
|
||||||
async def guard():
|
# if not self.channel in self.app.api.keys:
|
||||||
keys=await self.app.get_keys()
|
# self.root.change_screen('login')
|
||||||
if not self.channel in keys:
|
# return
|
||||||
self.root.change_screen('login')
|
|
||||||
return
|
|
||||||
asyncio.create_task(guard())
|
|
@ -16,7 +16,8 @@
|
|||||||
id: loginbox
|
id: loginbox
|
||||||
orientation:'vertical'
|
orientation:'vertical'
|
||||||
cols:1
|
cols:1
|
||||||
size_hint:0.5,None
|
size_hint:None,None
|
||||||
|
width: '300sp'
|
||||||
pos_hint: {'center_x':0.5,'center_y':0.5}
|
pos_hint: {'center_x':0.5,'center_y':0.5}
|
||||||
md_bg_color: rgb(*COLOR_CARD)
|
md_bg_color: rgb(*COLOR_CARD)
|
||||||
radius:[20,]
|
radius:[20,]
|
||||||
|
@ -45,6 +45,7 @@ class LoginScreen(BaseScreen):
|
|||||||
self.label_title.color=rgb(*COLOR_TEXT)
|
self.label_title.color=rgb(*COLOR_TEXT)
|
||||||
self.label_title.text='Welcome,'
|
self.label_title.text='Welcome,'
|
||||||
# self.label_title.font_size*=1.5
|
# 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(self.label_title)
|
||||||
self.layout.add_widget(get_separator('30sp'))
|
self.layout.add_widget(get_separator('30sp'))
|
||||||
# self.layout.add_widget(MySeparator())
|
# self.layout.add_widget(MySeparator())
|
||||||
@ -81,7 +82,7 @@ class LoginScreen(BaseScreen):
|
|||||||
# self.layout.add_widget(self.layout_password)
|
# self.layout.add_widget(self.layout_password)
|
||||||
|
|
||||||
self.layout_buttons = LoginButtonLayout()
|
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.layout.add_widget(self.layout_buttons)
|
||||||
|
|
||||||
# self.login_button = LoginButton()
|
# self.login_button = LoginButton()
|
||||||
|
@ -709,7 +709,6 @@ class Api(object):
|
|||||||
post_id = get_random_id()
|
post_id = get_random_id()
|
||||||
author_privkey = self.keys[data.get('author')]
|
author_privkey = self.keys[data.get('author')]
|
||||||
channels = data.get('to_channels',[])
|
channels = data.get('to_channels',[])
|
||||||
del data['to_channels']
|
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
self.log('ADDING TO CHANNEL??',channel)
|
self.log('ADDING TO CHANNEL??',channel)
|
||||||
pubkey_channel = self.keys[channel].public_key()
|
pubkey_channel = self.keys[channel].public_key()
|
||||||
|
@ -61,11 +61,6 @@ class Server:
|
|||||||
neighbs=self.bootstrappable_neighbors()
|
neighbs=self.bootstrappable_neighbors()
|
||||||
neighbors=' '.join(':'.join(str(x) for x in ip_port) for ip_port in neighbs)
|
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}"""
|
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
|
return repr
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user