kopia lustrzana https://github.com/snarfed/bridgy-fed
lots of UI tweaks
rodzic
4f3dc03a3e
commit
3cc1be5493
3
app.yaml
3
app.yaml
|
@ -28,6 +28,9 @@ handlers:
|
||||||
- url: /oauth_dropins_static
|
- url: /oauth_dropins_static
|
||||||
static_dir: oauth_dropins_static
|
static_dir: oauth_dropins_static
|
||||||
|
|
||||||
|
- url: /fonts
|
||||||
|
static_dir: oauth_dropins_fonts
|
||||||
|
|
||||||
- url: /favicon.ico
|
- url: /favicon.ico
|
||||||
static_files: static/favicon.ico
|
static_files: static/favicon.ico
|
||||||
upload: static/favicon.ico
|
upload: static/favicon.ico
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../oauth-dropins/oauth_dropins/fonts
|
35
pages.py
35
pages.py
|
@ -9,6 +9,7 @@ from flask import render_template, request
|
||||||
from google.cloud.ndb.stats import KindStat
|
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
|
||||||
|
from oauth_dropins.webutil.util import json_dumps, json_loads
|
||||||
|
|
||||||
from app import app, cache
|
from app import app, cache
|
||||||
import common
|
import common
|
||||||
|
@ -47,6 +48,7 @@ def user(domain):
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'user.html',
|
'user.html',
|
||||||
|
logs=logs,
|
||||||
util=util,
|
util=util,
|
||||||
**locals(),
|
**locals(),
|
||||||
)
|
)
|
||||||
|
@ -66,12 +68,12 @@ def followers(domain):
|
||||||
).order(-Follower.updated)
|
).order(-Follower.updated)
|
||||||
followers, before, after = fetch_page(query, Follower)
|
followers, before, after = fetch_page(query, Follower)
|
||||||
|
|
||||||
follower_links = [
|
for f in followers:
|
||||||
util.pretty_link(
|
f.url = f.src
|
||||||
f.src,
|
f.handle = re.sub(r'^https?://(.+)/(users/|@)(.+)$', r'@\3@\1', f.src)
|
||||||
text=re.sub(r'^https?://(.+)/(users/|@)(.+)$', r'@\3@\1', f.src),
|
if f.last_follow:
|
||||||
) for f in followers
|
last_follow = json_loads(f.last_follow)
|
||||||
]
|
f.picture = last_follow.get('actor', {}).get('icon', {}).get('url')
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'followers.html',
|
'followers.html',
|
||||||
|
@ -91,12 +93,9 @@ def following(domain):
|
||||||
).order(-Follower.updated)
|
).order(-Follower.updated)
|
||||||
followers, before, after = fetch_page(query, Follower)
|
followers, before, after = fetch_page(query, Follower)
|
||||||
|
|
||||||
follower_links = [
|
for f in followers:
|
||||||
util.pretty_link(
|
f.url = f.dest
|
||||||
f.src,
|
f.handle = re.sub(r'^https?://(.+)/(users/|@)(.+)$', r'@\3@\1', f.dest)
|
||||||
text=re.sub(r'^https?://(.+)/(users/|@)(.+)$', r'@\3@\1', f.dest),
|
|
||||||
) for f in followers
|
|
||||||
]
|
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'following.html',
|
'following.html',
|
||||||
|
@ -112,9 +111,10 @@ def recent():
|
||||||
query = Activity.query(Activity.status.IN(('new', 'complete', 'error')))
|
query = Activity.query(Activity.status.IN(('new', 'complete', 'error')))
|
||||||
activities, before, after = fetch_page(query, Activity)
|
activities, before, after = fetch_page(query, Activity)
|
||||||
return render_template(
|
return render_template(
|
||||||
'recent.html',
|
'recent.html',
|
||||||
util=util,
|
logs=logs,
|
||||||
**locals(),
|
util=util,
|
||||||
|
**locals(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,11 +160,6 @@ def fetch_page(query, model_class):
|
||||||
|
|
||||||
query_iter = query.iter()
|
query_iter = query.iter()
|
||||||
results = sorted(islice(query_iter, 0, 20), key=lambda r: r.updated, reverse=True)
|
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)
|
# calculate new paging param(s)
|
||||||
has_next = results and query_iter.probably_has_next()
|
has_next = results and query_iter.probably_has_next()
|
||||||
|
|
|
@ -164,3 +164,16 @@ td, th {
|
||||||
padding-top: .2em;
|
padding-top: .2em;
|
||||||
padding-bottom: .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; }
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% for link in follower_links %}
|
{% for f in followers %}
|
||||||
<div class="col-sm-4">{{ link|safe }}</div>
|
<a class="follower col-xs-6 col-sm-4" href="{{ f.url }}" title="{{ f.handle }}">
|
||||||
|
<img class="profile u-photo" src="{{ f.picture }}" width="48px">
|
||||||
|
{{ util.ellipsize(f.handle, chars=25) }}
|
||||||
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="col-sm-4">None</div>
|
None
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
<!-- <table> -->
|
|
||||||
<!-- <tr><th>Source</th> <th>Target</th> <th>Protocol</th> <th>Status</th> <th>Time (click for log)</th></tr> -->
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
{% for a in activities %}
|
{% for a in activities %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-3">{{ util.pretty_link(a.source())|safe }}</div>
|
<div class="col-sm-5">{{ util.pretty_link(a.source())|safe }}</div>
|
||||||
<div class="col-sm-3">{{ util.pretty_link(a.target())|safe }}</div>
|
<div class="col-sm-4">{{ util.pretty_link(a.target())|safe }}</div>
|
||||||
<div class="col-sm-2">{{ a.protocol }}</div>
|
<div class="col-sm-3">
|
||||||
<div class="col-sm-2">{{ a.status }}</div>
|
{% if a.status == 'error' %}
|
||||||
<div class="col-sm-2">
|
<span title="Error" class="glyphicon glyphicon-exclamation-sign"></span>
|
||||||
{% if a.log_url_path %}<a href="{{ a.log_url_path }}">{% endif %}
|
{% else %}{% if a.status == 'new' %}
|
||||||
{{ a.updated.replace(microsecond=0) }}
|
<span title="Processing" class="glyphicon glyphicon-transfer"></span>
|
||||||
{% if a.log_url_path %}</a>{% endif %}
|
{% endif %}{% endif %}
|
||||||
|
{{ logs.maybe_link(a.updated, a.key)|safe }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="row">None</div>
|
<div class="row">None</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<!-- </table> -->
|
|
||||||
|
|
||||||
{% include "paging.html" %}
|
{% include "paging.html" %}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h2 class="row">
|
<h2 class="row">
|
||||||
<a href="https://{{ domain }}/">🌐 {{ domain }}</a>'s followers:
|
<a href="/user/{{ domain }}">🌐 {{ domain }}</a>'s followers:
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
{% include "_followers.html" %}
|
{% include "_followers.html" %}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h2 class="row">
|
<h2 class="row">
|
||||||
<a href="https://{{ domain }}/">🌐 {{ domain }}</a> is following:
|
<a href="/user/{{ domain }}">🌐 {{ domain }}</a> is following:
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
{% include "_followers.html" %}
|
{% include "_followers.html" %}
|
||||||
|
|
Ładowanie…
Reference in New Issue