CSS : Improve the design of the graphics container;

CSS    : Improve the design of actions bar;
Python : Add multiple actions (URI Query Types).
This commit is contained in:
Schimon Jehudah, Adv. 2024-10-09 23:07:16 +03:00
parent 9668ade606
commit 43f285e008
7 changed files with 99 additions and 37 deletions

26
fasi.py
View file

@ -324,19 +324,21 @@ class HttpInstance:
jid_info = await XmppXep0030.get_jid_info(xmpp_instance, jid_bare)
jid_info_iq = jid_info['iq']
jid_kind = jid_info['kind']
links = []
if jid_info['error']:
message = '{}: {} (XEP-0030)'.format(jid_info['text'], jid_info['condition'])
action = 'Connect with'
link_text = 'Connect'
link_href = 'xmpp:{}'.format(jid_bare)
links.append(['Connect', link_href])
xmpp_uri = jid_bare
elif jid_kind in ('conference', 'server'):
action = link_text = 'Discover'
action = 'Discover'
if jid_kind == 'conference':
instance = 'conferences'
elif jid_kind == 'server':
instance = 'services'
link_href = 'xmpp:{}?disco;type=get;request=items'.format(jid_bare)
links.append(['Discover', link_href])
view_href = '/d/' + jid_bare
xmpp_uri = jid_bare
elif jid_kind in ('mix', 'muc'):
@ -344,8 +346,8 @@ class HttpInstance:
# TODO Set group chat subject as description.
action = 'Join to'
instance = 'participants'
link_text = 'Join'
link_href = 'xmpp:{}?join'.format(jid_bare)
links.append(['Join', link_href])
view_href = '/v/' + jid_bare
xmpp_uri = jid_bare
# room_info = await XmppXep0045.get_room_data(xmpp_instance, jid_bare)
@ -355,23 +357,28 @@ class HttpInstance:
if node_name:
action = 'Subscribe to'
instance = 'articles'
link_text = 'Subscribe'
link_href = 'xmpp:{}?pubsub;node={};action=subscribe'.format(jid_bare, node_name)
links.append(['Subscribe', link_href])
links.append(['View', 'xmpp:{}?pubsub;node={}'.format(jid_bare, node_name)])
view_href = '/d/{}/{}'.format(jid_bare, node_name)
xmpp_uri = '{}?;node={}'.format(jid_bare, node_name)
else:
action = link_text = 'Browse'
action = 'Browse'
instance = 'nodes'
link_href = 'xmpp:{}?disco;type=get;request=items'.format(jid_bare)
links.append(['Browse', link_href])
view_href = '/d/' + jid_bare
xmpp_uri = jid_bare
else:
action = link_text = 'Message'
action = 'Message'
instance = 'articles'
link_href = 'xmpp:{}?message'.format(jid_bare)
links.append(['Add', 'xmpp:{}?roster'.format(jid_bare)])
links.append(['Message', link_href])
node_name = 'urn:xmpp:microblog:0'
view_href = '/d/{}/{}'.format(jid_bare, node_name)
xmpp_uri = jid_bare
links.append(['vCard', 'xmpp:{}?vcard'.format(jid_bare)])
# JID item count
count = None
@ -479,7 +486,7 @@ class HttpInstance:
action = 'Error'
title = 'Slixmpp error'
xmpp_uri = jid
count = filename = jid_bare = jid_kind = link_href = link_text = message = selection = url = None
count = filename = jid_bare = jid_kind = links = message = selection = url = None
template_file = 'jid.xhtml'
template_dict = {
@ -490,8 +497,7 @@ class HttpInstance:
'filename' : filename,
'jid_bare' : jid_bare,
'jid_kind' : jid_kind,
'link_href' : link_href,
'link_text' : link_text,
'links' : links,
'message' : message,
'note' : note,
'request' : request,
@ -672,7 +678,7 @@ class Graphics:
#qrcode_graphics = qrcode.make(text)
qr = qrcode.QRCode(border=2, box_size=10)
qr.add_data(text)
qrcode_graphics = qr.make_image(fill_color='#000', back_color='#f2f2f2')
qrcode_graphics = qr.make_image(fill_color='#333', back_color='#f2f2f2')
qrcode_graphics.save('qr/{}.png'.format(jid_bare))
class Syndication: