kopia lustrzana https://github.com/snarfed/bridgy-fed
rodzic
47b3dd29d0
commit
d30eccbe8b
26
pages.py
26
pages.py
|
|
@ -55,14 +55,14 @@ def web_user_redirects(**kwargs):
|
|||
|
||||
@app.get(f'/<any({",".join(PROTOCOLS)}):protocol>/<id>')
|
||||
def user(protocol, id):
|
||||
# TODO: unify this with followers_or_following, others
|
||||
cls = PROTOCOLS[protocol]
|
||||
g.user = cls.get_by_id(id)
|
||||
if not g.user:
|
||||
g.user = cls.query(cls.readable_id == id).get()
|
||||
|
||||
if not g.user or not g.user.direct:
|
||||
return USER_NOT_FOUND_HTML, 404
|
||||
elif id != g.user.readable_or_key_id(): # this also handles use_instead
|
||||
elif id != g.user.readable_or_key_id(): # this also handles use_instead
|
||||
return redirect(g.user.user_page_path(), code=301)
|
||||
|
||||
assert not g.user.use_instead
|
||||
|
|
@ -94,9 +94,17 @@ def user(protocol, id):
|
|||
|
||||
@app.get(f'/<any({",".join(PROTOCOLS)}):protocol>/<id>/<any(followers,following):collection>')
|
||||
def followers_or_following(protocol, id, collection):
|
||||
g.user = PROTOCOLS[protocol].get_by_id(id) # g.user is used in template
|
||||
# TODO: unify this with user, feed
|
||||
cls = PROTOCOLS[protocol]
|
||||
g.user = cls.get_by_id(id)
|
||||
if not g.user:
|
||||
g.user = cls.query(cls.readable_id == id).get()
|
||||
if not g.user or not g.user.direct:
|
||||
return USER_NOT_FOUND_HTML, 404
|
||||
elif id != g.user.readable_or_key_id(): # this also handles use_instead
|
||||
return redirect(g.user.user_page_path(), code=301)
|
||||
|
||||
assert not g.user.use_instead
|
||||
|
||||
followers, before, after = Follower.fetch_page(id, collection)
|
||||
|
||||
|
|
@ -123,9 +131,17 @@ def feed(protocol, id):
|
|||
if format not in ('html', 'atom', 'rss'):
|
||||
error(f'format {format} not supported; expected html, atom, or rss')
|
||||
|
||||
g.user = PROTOCOLS[protocol].get_by_id(id)
|
||||
# TODO: unify this with user, followers_or_following
|
||||
cls = PROTOCOLS[protocol]
|
||||
g.user = cls.get_by_id(id)
|
||||
if not g.user:
|
||||
return render_template('user_not_found.html', domain=id), 404
|
||||
g.user = cls.query(cls.readable_id == id).get()
|
||||
if not g.user or not g.user.direct:
|
||||
return USER_NOT_FOUND_HTML, 404
|
||||
elif id != g.user.readable_or_key_id(): # this also handles use_instead
|
||||
return redirect(g.user.user_page_path(), code=301)
|
||||
|
||||
assert not g.user.use_instead
|
||||
|
||||
objects, _, _ = Object.query(
|
||||
Object.domains == id, Object.labels == 'feed') \
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
<div class="row big">Following</div>
|
||||
|
||||
{% if g.user.LABEL != 'activitypub' %}
|
||||
<div class="row">
|
||||
<form method="post" action="/follow/start">
|
||||
<p>
|
||||
|
|
@ -20,6 +21,7 @@
|
|||
</p>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% with page_name="following" %}
|
||||
{% include "_followers.html" %}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
{% if g.user.LABEL == 'web' %}
|
||||
{% if g.user.has_redirects == False %}
|
||||
<div class="row promo warning">
|
||||
<form method="post" action="/web-site">
|
||||
|
|
@ -35,6 +36,7 @@
|
|||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% include "user_addresses.html" %}
|
||||
|
||||
|
|
@ -48,6 +50,7 @@
|
|||
· <a href="{{ g.user.ap_actor() }}">ActivityPub</a>
|
||||
</div>
|
||||
|
||||
{% if g.user.LABEL != 'activitypub' %}
|
||||
<div class="row">
|
||||
<form method="post" action="/remote-follow">
|
||||
<p>
|
||||
|
|
@ -60,6 +63,7 @@
|
|||
</p>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% include "activities.html" %}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,15 @@
|
|||
|
||||
<nobr>
|
||||
{{ util.pretty_link(g.user.web_url(), text_prefix='🌐', attrs={'title': 'Web site'})|safe }}
|
||||
|
||||
{% if g.user.LABEL != 'activitypub' %}
|
||||
<form method="post" action="/webmention-interactive">
|
||||
<input name="source" type="hidden" value="{{ g.user.web_url() }}/" />
|
||||
<button id="update-profile-button" type="submit"
|
||||
title="Update profile from web site"
|
||||
class="btn btn-default glyphicon glyphicon-refresh"></button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</nobr>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue