make homepage use tdp format

master
Michael F. Lamb 2015-10-20 21:10:26 +00:00
parent 7217826feb
commit 37768ae726
2 changed files with 9 additions and 19 deletions

View File

@ -135,8 +135,6 @@ def tdp_user(username, homedir):
'title': get_title(index_html),
'mtime': int(most_recent_within(public_html) * 1000),
# tilde.town extensions and backward compatibility
# FIXME: just shelling out to diff -q might be way faster than all
# these hashes.
'favicon': 'TODO',
'default': subprocess.call(
['diff', '-q', DEFAULT_HTML_FILENAME, index_html],
@ -176,17 +174,7 @@ def tdp():
'generated_at': now.strftime('%Y-%m-%d %H:%M:%S'),
'generated_at_msec': int(now.timestamp() * 1000),
'uptime': subprocess.check_output(['uptime', '-p'], universal_newlines=True),
})
# redundant entries we should drop after changing homepage template
data.update({
'all_users': data['users'],
'num_users': data['user_count'],
'live_users': [u for u in data['users'] if not u['default']],
'site_name': data['name'],
'site_url': data['url'],
})
data.update({
'num_live_users': len(data['live_users']),
'live_user_count': sum(1 for x in data['users'] if not x['default']),
})
return data

View File

@ -22,16 +22,18 @@
<tr>
<td valign="top" width="20%">
<h3>our esteemed users </h3>
<sub>({{num_live_users}} / {{num_users}} shown)</sub><br>
<sub>({{live_user_count}} / {{user_count}} shown)</sub><br>
<sub>generated at {{generated_at}}</sub><br>
<sub>sorted by recent changes</sub><br>
<ul>
{{#live_users}}
<li>
<a href="/~{{username}}">{{username}}</a>
</li>
{{/live_users}}
{{#users}}
{{^default}}
<li>
<a href="/~{{username}}">{{username}}</a>
</li>
{{/default}}
{{/users}}
</ul>
<a href="/users.html">full user list</a>
</td>