libregamingspaces/spaces.html

46 lines
1.3 KiB
HTML

<%!
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>
<link rel="stylesheet" href="main.css">
</head>
<body>
<%def name="render(space)">
<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><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']}">
% if 'name' in room:
<div> ${room['name']} </div>
% endif
</a> </td>
% endif
</tr>
% endif
% endfor
</tbody>
</table>
</%def>
${render(s)}
</body>
</html>