libregamingspaces/spaces.html

46 lines
1.3 KiB
HTML
Raw Normal View History

2022-04-17 17:56:33 +02:00
<%!
def mxc2url(mxc):
serverName = mxc.split('/')[2]
mediaId = mxc.split('/')[3]
return "https://matrix.org/_matrix/media/v3/download/" + serverName + "/" + mediaId
%>
2022-01-15 14:40:52 +01:00
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="main.css">
</head>
<body>
<%def name="render(space)">
2022-04-17 17:56:33 +02:00
<table>
2022-01-15 14:40:52 +01:00
<tbody>
% for room in space:
<tr>
2022-04-17 17:56:33 +02:00
% if 'avatar_url' in room:
<td><img class="avatar roomAvatar" src=${mxc2url(room['avatar_url'])}></td>
% endif
2022-01-15 14:40:52 +01:00
% if 'room_type' in room and room['room_type'] == "m.space":
2022-04-17 17:56:33 +02:00
<td><div> Subspace: ${room['name']} </div></td>
</tr>
<tr><td>${render(room['children_state'])}</td></tr>
2022-01-15 14:40:52 +01:00
% else:
% if 'room_id' in room:
2022-04-17 17:56:33 +02:00
<td><a href="https://view.matrix.org/room/${room['room_id']}">
2022-01-15 14:40:52 +01:00
% if 'name' in room:
2022-04-17 17:56:33 +02:00
<div> ${room['name']} </div>
2022-01-15 14:40:52 +01:00
% endif
2022-04-17 17:56:33 +02:00
</a> </td>
2022-01-15 14:40:52 +01:00
% endif
2022-04-17 17:56:33 +02:00
</tr>
2022-01-15 14:40:52 +01:00
% endif
% endfor
</tbody>
2022-04-17 17:56:33 +02:00
</table>
2022-01-15 14:40:52 +01:00
</%def>
${render(s)}
</body>
</html>