Add avatars and urls
This commit is contained in:
parent
9fc2bcc671
commit
2f626d7982
10
main.css
10
main.css
|
@ -1,4 +1,11 @@
|
|||
/* Theming taken from https://github.com/vector-im/riot-web/blob/cf5cf02529f95a094d88051c12fdb87a03d87335/src/skins/vector/css/themes/_base.scss */
|
||||
tbody {
|
||||
margin-left: 2em;
|
||||
}
|
||||
tr {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
body {
|
||||
color: #454545;
|
||||
background-color: #ffffff;
|
||||
|
@ -81,6 +88,9 @@ table#timeline {
|
|||
table#timeline tr {
|
||||
vertical-align: top;
|
||||
}
|
||||
tr {
|
||||
margin-left: 2em;
|
||||
}
|
||||
td.rightAlign {
|
||||
text-align: right;
|
||||
min-width: 120px;
|
||||
|
|
|
@ -3,8 +3,17 @@ import json
|
|||
import itertools
|
||||
import argparse
|
||||
|
||||
|
||||
def mxc2url(mxc):
|
||||
serverName = mxc.split('/')[2]
|
||||
mediaId = mxc.split('/')[3]
|
||||
return "https://matrix.org/_matrix/media/v3/download/" + serverName + "/" + mediaId
|
||||
|
||||
appTemplate = Template(filename='./spaces.html')
|
||||
f = open('libregamingspaces.json')
|
||||
spaces=json.load(f)
|
||||
|
||||
print(appTemplate.render(s=spaces))
|
||||
|
||||
|
||||
|
||||
|
|
28
spaces.html
28
spaces.html
|
@ -1,3 +1,9 @@
|
|||
<%!
|
||||
def mxc2url(mxc):
|
||||
serverName = mxc.split('/')[2]
|
||||
mediaId = mxc.split('/')[3]
|
||||
return "https://matrix.org/_matrix/media/v3/download/" + serverName + "/" + mediaId
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -5,29 +11,33 @@
|
|||
</head>
|
||||
<body>
|
||||
<%def name="render(space)">
|
||||
<table id="roomList">
|
||||
<table>
|
||||
<tbody>
|
||||
% for room in space:
|
||||
<tr>
|
||||
% if 'avatar_url' in room:
|
||||
<td><img class="avatar roomAvatar" src=${mxc2url(room['avatar_url'])}></td>
|
||||
% endif
|
||||
% if 'room_type' in room and room['room_type'] == "m.space":
|
||||
<td> Subspace: ${room['name']} <td>
|
||||
${render(room['children_state'])}
|
||||
<td><div> Subspace: ${room['name']} </div></td>
|
||||
</tr>
|
||||
<tr><td>${render(room['children_state'])}</td></tr>
|
||||
% else:
|
||||
|
||||
% if 'room_id' in room:
|
||||
<td>
|
||||
<a href="https://view.matrix.org/room/${room['room_id']}">
|
||||
<td><a href="https://view.matrix.org/room/${room['room_id']}">
|
||||
|
||||
% if 'name' in room:
|
||||
<div> ${room['name']} </td>
|
||||
<div> ${room['name']} </div>
|
||||
% endif
|
||||
|
||||
</a>
|
||||
</td>
|
||||
</a> </td>
|
||||
% endif
|
||||
</tr>
|
||||
% endif
|
||||
</tr>
|
||||
% endfor
|
||||
</tbody>
|
||||
</table>
|
||||
</%def>
|
||||
|
||||
${render(s)}
|
||||
|
|
Loading…
Reference in New Issue