diff --git a/app.yaml b/app.yaml index df33857..3c4192f 100644 --- a/app.yaml +++ b/app.yaml @@ -28,6 +28,9 @@ handlers: - url: /oauth_dropins_static static_dir: oauth_dropins_static +- url: /fonts + static_dir: oauth_dropins_fonts + - url: /favicon.ico static_files: static/favicon.ico upload: static/favicon.ico diff --git a/oauth_dropins_fonts b/oauth_dropins_fonts new file mode 120000 index 0000000..d929d98 --- /dev/null +++ b/oauth_dropins_fonts @@ -0,0 +1 @@ +../oauth-dropins/oauth_dropins/fonts \ No newline at end of file diff --git a/pages.py b/pages.py index 155fa71..30c8a95 100644 --- a/pages.py +++ b/pages.py @@ -9,6 +9,7 @@ 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 +from oauth_dropins.webutil.util import json_dumps, json_loads from app import app, cache import common @@ -47,6 +48,7 @@ def user(domain): return render_template( 'user.html', + logs=logs, util=util, **locals(), ) @@ -66,12 +68,12 @@ def followers(domain): ).order(-Follower.updated) followers, before, after = fetch_page(query, Follower) - follower_links = [ - util.pretty_link( - f.src, - text=re.sub(r'^https?://(.+)/(users/|@)(.+)$', r'@\3@\1', f.src), - ) for f in followers - ] + for f in followers: + f.url = f.src + f.handle = re.sub(r'^https?://(.+)/(users/|@)(.+)$', r'@\3@\1', f.src) + if f.last_follow: + last_follow = json_loads(f.last_follow) + f.picture = last_follow.get('actor', {}).get('icon', {}).get('url') return render_template( 'followers.html', @@ -91,12 +93,9 @@ def following(domain): ).order(-Follower.updated) followers, before, after = fetch_page(query, Follower) - follower_links = [ - util.pretty_link( - f.src, - text=re.sub(r'^https?://(.+)/(users/|@)(.+)$', r'@\3@\1', f.dest), - ) for f in followers - ] + for f in followers: + f.url = f.dest + f.handle = re.sub(r'^https?://(.+)/(users/|@)(.+)$', r'@\3@\1', f.dest) return render_template( 'following.html', @@ -112,9 +111,10 @@ def recent(): query = Activity.query(Activity.status.IN(('new', 'complete', 'error'))) activities, before, after = fetch_page(query, Activity) return render_template( - 'recent.html', - util=util, - **locals(), + 'recent.html', + logs=logs, + util=util, + **locals(), ) @@ -160,11 +160,6 @@ def fetch_page(query, model_class): query_iter = query.iter() results = sorted(islice(query_iter, 0, 20), key=lambda r: r.updated, reverse=True) - for r in results: - r.log_url_path = '/log?' + urllib.parse.urlencode({ - 'key': r.key.id(), - 'start_time': calendar.timegm(r.updated.timetuple()), - }) # calculate new paging param(s) has_next = results and query_iter.probably_has_next() diff --git a/static/style.css b/static/style.css index 20c2e44..604e726 100644 --- a/static/style.css +++ b/static/style.css @@ -164,3 +164,16 @@ td, th { padding-top: .2em; padding-bottom: .2em; } + +.follower { + text-align: left; + margin-top: .5em; +} + +/* .glyphicon-warning-sign { color: gold; } */ +.glyphicon-ok-sign { color: green; } +.glyphicon-exclamation-sign { color: gold; } +.glyphicon-pause { color: gold; } +.glyphicon-refresh { color: blue; } +.glyphicon-remove { color: red !important; } +.glyphicon-transfer { color: blue; } diff --git a/templates/_followers.html b/templates/_followers.html index 1f46d0b..255800f 100644 --- a/templates/_followers.html +++ b/templates/_followers.html @@ -1,10 +1,13 @@
-{% for link in follower_links %} -
{{ link|safe }}
+{% for f in followers %} + + + {{ util.ellipsize(f.handle, chars=25) }} + {% else %} -
None
+ None {% endfor %}
diff --git a/templates/activities.html b/templates/activities.html index a2403e5..807156e 100644 --- a/templates/activities.html +++ b/templates/activities.html @@ -1,23 +1,20 @@ - - -
{% for a in activities %}
-
{{ util.pretty_link(a.source())|safe }}
-
{{ util.pretty_link(a.target())|safe }}
-
{{ a.protocol }}
-
{{ a.status }}
-
- {% if a.log_url_path %}{% endif %} - {{ a.updated.replace(microsecond=0) }} - {% if a.log_url_path %}{% endif %} +
{{ util.pretty_link(a.source())|safe }}
+
{{ util.pretty_link(a.target())|safe }}
+
+ {% if a.status == 'error' %} + + {% else %}{% if a.status == 'new' %} + + {% endif %}{% endif %} + {{ logs.maybe_link(a.updated, a.key)|safe }}
{% else %}
None
{% endfor %} - {% include "paging.html" %} diff --git a/templates/followers.html b/templates/followers.html index 11818ed..da1f96f 100644 --- a/templates/followers.html +++ b/templates/followers.html @@ -5,7 +5,7 @@ {% block content %}

- 🌐 {{ domain }}'s followers: + 🌐 {{ domain }}'s followers:

{% include "_followers.html" %} diff --git a/templates/following.html b/templates/following.html index 3c9dbe1..65be849 100644 --- a/templates/following.html +++ b/templates/following.html @@ -5,7 +5,7 @@ {% block content %}

- 🌐 {{ domain }} is following: + 🌐 {{ domain }} is following:

{% include "_followers.html" %}