kopia lustrzana https://github.com/snarfed/bridgy-fed
minor tweaks to /stats
rodzic
71d4c260b3
commit
6339fd6156
17
pages.py
17
pages.py
|
@ -9,6 +9,7 @@ import urllib.parse
|
|||
from flask import redirect, render_template, request
|
||||
from google.cloud.ndb.stats import KindStat
|
||||
from granary import as2, atom, microformats2, rss
|
||||
import humanize
|
||||
from oauth_dropins.webutil import flask_util, logs, util
|
||||
from oauth_dropins.webutil.flask_util import error, flash, redirect
|
||||
from oauth_dropins.webutil.util import json_dumps, json_loads
|
||||
|
@ -342,12 +343,16 @@ def fetch_activities(query):
|
|||
|
||||
@app.get('/stats')
|
||||
def stats():
|
||||
return render_template(
|
||||
'stats.html',
|
||||
users=KindStat.query(KindStat.kind_name == 'MagicKey').get().count,
|
||||
activities=KindStat.query(KindStat.kind_name == 'Response').get().count,
|
||||
followers=KindStat.query(KindStat.kind_name == 'Follower').get().count,
|
||||
)
|
||||
def count(kind):
|
||||
return humanize.intcomma(
|
||||
KindStat.query(KindStat.kind_name == kind).get().count)
|
||||
|
||||
return render_template(
|
||||
'stats.html',
|
||||
users=count('MagicKey'),
|
||||
activities=count('Response'),
|
||||
followers=count('Follower'),
|
||||
)
|
||||
|
||||
|
||||
@app.get('/log')
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<h3>Stats</h3>
|
||||
<ul>
|
||||
<li><a href="https://snarfed.org/2017-10-22_bridgy-fed">Launched Octover 17, 2022</a>
|
||||
<li><a href="https://snarfed.org/2017-10-22_bridgy-fed">Launched October 17, 2022</a>
|
||||
<li>{{ users }} users</li>
|
||||
<li>{{ followers }} fediverse followers</li>
|
||||
<li>{{ activities }} activities handled</li>
|
||||
|
|
Ładowanie…
Reference in New Issue