diff --git a/app/portal/__init__.py b/app/portal/__init__.py index d0a83bf..49c22df 100644 --- a/app/portal/__init__.py +++ b/app/portal/__init__.py @@ -14,7 +14,7 @@ portal = Blueprint("portal", __name__, template_folder="templates", static_folde @portal.app_template_filter("mirror_expiry") def calculate_mirror_expiry(s): expiry = s + timedelta(days=3) - countdown = expiry - datetime.utcnow() + countdown = expiry - datetime.now(timezone.utc) if countdown.days == 0: return f"{countdown.seconds // 3600} hours" return f"{countdown.days} days" @@ -29,7 +29,12 @@ def format_datetime(s): @portal.route("/") def portal_home(): - return render_template("home.html.j2", section="home") + groups = Group.query.order_by(Group.group_name).all() + now = datetime.now(timezone.utc) + last24 = len(Proxy.query.filter(Proxy.deprecated > (now - timedelta(days=1))).all()) + last72 = len(Proxy.query.filter(Proxy.deprecated > (now - timedelta(days=3))).all()) + lastweek = len(Proxy.query.filter(Proxy.deprecated > (now - timedelta(days=7))).all()) + return render_template("home.html.j2", section="home", groups=groups, last24=last24, last72=last72, lastweek=lastweek) @portal.route("/groups") diff --git a/app/portal/templates/home.html.j2 b/app/portal/templates/home.html.j2 index b392e13..d278064 100644 --- a/app/portal/templates/home.html.j2 +++ b/app/portal/templates/home.html.j2 @@ -3,4 +3,39 @@ {% block content %}
Welcome to the Bypass Censorship portal.
+ +{% for group in groups %}{{ group.group_name }}{{ ", " if not loop.last else "" }}{% endfor %}
+Marked blocked: +
This is a longer card with supporting text below as a natural lead-in to additional content.
+