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(room)">
<table>
<tbody>
<tr>
% if 'avatar_url' in room:
<td><img class="avatar roomAvatar" src=${mxc2url(room['avatar_url'])}></td>
% endif
% if 'children' in room:
<td><div>${room['name']} </div></td>
</tr>
% for subroom in room['children']:
<tr><td>${render(subroom)}</td></tr>
% endfor
% 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
</tbody>
</table>
</%def>
${render(s)}
</body>
</html>