make homepage use tdp format
parent
7217826feb
commit
37768ae726
|
@ -135,8 +135,6 @@ def tdp_user(username, homedir):
|
||||||
'title': get_title(index_html),
|
'title': get_title(index_html),
|
||||||
'mtime': int(most_recent_within(public_html) * 1000),
|
'mtime': int(most_recent_within(public_html) * 1000),
|
||||||
# tilde.town extensions and backward compatibility
|
# tilde.town extensions and backward compatibility
|
||||||
# FIXME: just shelling out to diff -q might be way faster than all
|
|
||||||
# these hashes.
|
|
||||||
'favicon': 'TODO',
|
'favicon': 'TODO',
|
||||||
'default': subprocess.call(
|
'default': subprocess.call(
|
||||||
['diff', '-q', DEFAULT_HTML_FILENAME, index_html],
|
['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': now.strftime('%Y-%m-%d %H:%M:%S'),
|
||||||
'generated_at_msec': int(now.timestamp() * 1000),
|
'generated_at_msec': int(now.timestamp() * 1000),
|
||||||
'uptime': subprocess.check_output(['uptime', '-p'], universal_newlines=True),
|
'uptime': subprocess.check_output(['uptime', '-p'], universal_newlines=True),
|
||||||
})
|
'live_user_count': sum(1 for x in data['users'] if not x['default']),
|
||||||
# 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']),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
|
@ -22,16 +22,18 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td valign="top" width="20%">
|
<td valign="top" width="20%">
|
||||||
<h3>our esteemed users </h3>
|
<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>generated at {{generated_at}}</sub><br>
|
||||||
<sub>sorted by recent changes</sub><br>
|
<sub>sorted by recent changes</sub><br>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
{{#live_users}}
|
{{#users}}
|
||||||
<li>
|
{{^default}}
|
||||||
<a href="/~{{username}}">{{username}}</a>
|
<li>
|
||||||
</li>
|
<a href="/~{{username}}">{{username}}</a>
|
||||||
{{/live_users}}
|
</li>
|
||||||
|
{{/default}}
|
||||||
|
{{/users}}
|
||||||
</ul>
|
</ul>
|
||||||
<a href="/users.html">full user list</a>
|
<a href="/users.html">full user list</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
Reference in New Issue