kopia lustrzana https://github.com/snarfed/bridgy-fed
add stats page
rodzic
d8a71c9a9d
commit
d743609c6f
2
app.py
2
app.py
|
@ -37,4 +37,4 @@ cache = Cache(app)
|
||||||
util.set_user_agent('Bridgy Fed (https://fed.brid.gy/)')
|
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
|
||||||
|
|
|
@ -4,6 +4,7 @@ from itertools import islice
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
||||||
from flask import render_template, request
|
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 import flask_util, logs, util
|
||||||
from oauth_dropins.webutil.flask_util import error
|
from oauth_dropins.webutil.flask_util import error
|
||||||
|
|
||||||
|
@ -79,6 +80,16 @@ def responses(domain=None):
|
||||||
return render_template('responses.html', **vars)
|
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')
|
@app.get('/log')
|
||||||
@flask_util.cached(cache, logs.CACHE_TIME)
|
@flask_util.cached(cache, logs.CACHE_TIME)
|
||||||
def log():
|
def log():
|
|
@ -0,0 +1,19 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Bridgy Fed: Stats</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<main class="tp-main lead container">
|
||||||
|
<h1>Bridgy Fed</h1>
|
||||||
|
<h3>Stats</h3>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://snarfed.org/2017-10-22_bridgy-fed">Launched Octover 17, 2022</a>
|
||||||
|
<li>{{ users }} users</li>
|
||||||
|
<li>{{ followers }} fediverse followers</li>
|
||||||
|
<li>{{ responses }} activities handled</li>
|
||||||
|
</ul>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
Ładowanie…
Reference in New Issue