diff --git a/app.py b/app.py index 11a626c..f0ebf57 100644 --- a/app.py +++ b/app.py @@ -37,4 +37,4 @@ cache = Cache(app) util.set_user_agent('Bridgy Fed (https://fed.brid.gy/)') -import activitypub, add_webmention, logs, redirect, render, salmon, superfeedr, webfinger, webmention +import activitypub, add_webmention, pages, redirect, render, salmon, superfeedr, webfinger, webmention diff --git a/logs.py b/pages.py similarity index 88% rename from logs.py rename to pages.py index af04e7a..8e53f2a 100644 --- a/logs.py +++ b/pages.py @@ -4,6 +4,7 @@ from itertools import islice import urllib.parse from flask import render_template, request +from google.cloud.ndb.stats import KindStat from oauth_dropins.webutil import flask_util, logs, util from oauth_dropins.webutil.flask_util import error @@ -79,6 +80,16 @@ def responses(domain=None): return render_template('responses.html', **vars) +@app.get('/stats') +def stats(): + return render_template( + 'stats.html', + users=KindStat.query(KindStat.kind_name == 'MagicKey').get().count, + responses=KindStat.query(KindStat.kind_name == 'Response').get().count, + followers=KindStat.query(KindStat.kind_name == 'Follower').get().count, + ) + + @app.get('/log') @flask_util.cached(cache, logs.CACHE_TIME) def log(): diff --git a/templates/stats.html b/templates/stats.html new file mode 100644 index 0000000..3fd079c --- /dev/null +++ b/templates/stats.html @@ -0,0 +1,19 @@ + + + +Bridgy Fed: Stats + + + +
+

Bridgy Fed

+

Stats

+ +
+ +