libregamingspaces/spaces.html

72 lines
2.5 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)">
<div class="room">
% if room['name'] != "TOP":
% if room['name'].startswith('Libre Gaming'):
<details open><summary>
% elif room['name'] != "TOP" and room['name'] != "Libre Gaming" and 'children' in room:
<details><summary>
% endif
<div class="info">
% if room['name'] != "TOP" and room['name'] != "Libre Gaming" and 'children' in room:
<div class="arrow-right"></div>
% endif
% if 'avatar_url' in room:
<img class="avatar roomAvatar" src=${mxc2url(room['avatar_url'])}>
% else:
<div class="avatar roomAvatar"></div>
% endif
% if 'room_id' in room:
% if 'canonical_alias' in room:
<a href="https://matrix.to/#/${room['canonical_alias']}">
% elif 'children' not in room and room['world_readable']:
<a href="https://view.matrix.org/room/${room['room_id']}">
% endif
% if 'name' in room:
<div> ${room['name']} </div>
% endif
</a>
% if 'topic' in room:
<p class="topic"> ${room['topic']} </p>
% endif
% endif
</div>
% if room['name'] != "TOP" and room['name'] != "Libre Gaming" and 'children' in room:
</summary>
% endif
% endif
% if 'children' in room:
% for subroom in room['children']:
${render(subroom)}
% endfor
% if room['name'] != "TOP" and room['name'] != "Libre Gaming":
</details>
% endif
% endif
</div>
</%def>
${render(s)}
</body>
</html>