Add support for contents of Libervia (XEP-0277);
Various of visual improvements.
This commit is contained in:
parent
44e7778578
commit
ad34af72ff
5 changed files with 67 additions and 28 deletions
|
@ -16,8 +16,6 @@ try:
|
|||
except:
|
||||
import tomli as tomllib
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
class XmppInstance(ClientXMPP):
|
||||
def __init__(self, jid, password):
|
||||
super().__init__(jid, password)
|
||||
|
@ -27,6 +25,8 @@ class XmppInstance(ClientXMPP):
|
|||
|
||||
xmpp = None
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
# Mount static graphic, script and stylesheet directories
|
||||
app.mount("/css", StaticFiles(directory="css"), name="css")
|
||||
app.mount("/data", StaticFiles(directory="data"), name="data")
|
||||
|
@ -38,6 +38,7 @@ app.mount("/xsl", StaticFiles(directory="xsl"), name="xsl")
|
|||
async def favicon():
|
||||
return FileResponse('favicon.ico')
|
||||
|
||||
@app.route('/')
|
||||
@app.get('/opml')
|
||||
async def view_pubsub_nodes(request: Request):
|
||||
global xmpp
|
||||
|
@ -305,7 +306,14 @@ def generate_atom(iq, link):
|
|||
content_type_text = 'html' if 'html' in content_type else 'text'
|
||||
ET.SubElement(e_entry, 'content', {'type': content_type_text}).text = content_text
|
||||
else:
|
||||
ET.SubElement(e_entry, 'content').text = 'No content.'
|
||||
summary = item_payload.find(namespace + 'summary')
|
||||
summary_text = summary.text
|
||||
if summary_text:
|
||||
summary_type = summary.attrib['type'] if 'type' in summary.attrib else 'html'
|
||||
summary_type_text = 'html' if 'html' in summary_type else 'text'
|
||||
ET.SubElement(e_entry, 'content', {'type': summary_type_text}).text = summary_text
|
||||
else:
|
||||
ET.SubElement(e_entry, 'content').text = 'No content.'
|
||||
published = item_payload.find(namespace + 'published')
|
||||
published_text = None if published == None else published.text
|
||||
ET.SubElement(e_entry, 'published').text = published_text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue