kopia lustrzana https://github.com/snarfed/bridgy-fed
rodzic
4e0fb6536c
commit
dbf4712af4
21
pages.py
21
pages.py
|
@ -113,7 +113,7 @@ def following(domain):
|
||||||
def feed(domain):
|
def feed(domain):
|
||||||
format = request.args.get('format', 'html')
|
format = request.args.get('format', 'html')
|
||||||
if format not in ('html', 'atom', 'rss'):
|
if format not in ('html', 'atom', 'rss'):
|
||||||
error(f'format {format} not supported; expected html, atom, or rss')
|
error(f'format {format} not supported; expected html, atom, or rss')
|
||||||
|
|
||||||
as2_activities, _, _ = Activity.query(
|
as2_activities, _, _ = Activity.query(
|
||||||
Activity.domain == domain, Activity.direction == 'in'
|
Activity.domain == domain, Activity.direction == 'in'
|
||||||
|
@ -130,21 +130,18 @@ def feed(domain):
|
||||||
'url': f'https://{domain}',
|
'url': f'https://{domain}',
|
||||||
}
|
}
|
||||||
title = f'Bridgy Fed feed for {domain}'
|
title = f'Bridgy Fed feed for {domain}'
|
||||||
extra = '<link rel="stylesheet" href="/static/feed.css" type="text/css" />'
|
|
||||||
if not as1_activities:
|
|
||||||
extra += '\n<p>Nothing yet. Follow more people, check back soon!</p>'
|
|
||||||
|
|
||||||
if format == 'html':
|
if format == 'html':
|
||||||
return microformats2.activities_to_html(as1_activities, extra=extra,
|
entries = [microformats2.object_to_html(a) for a in as1_activities]
|
||||||
body_class='h-feed')
|
return render_template('feed.html', **locals())
|
||||||
elif format == 'atom':
|
elif format == 'atom':
|
||||||
body = atom.activities_to_atom(as1_activities, actor=actor, title=title,
|
body = atom.activities_to_atom(as1_activities, actor=actor, title=title,
|
||||||
request_url=request.url)
|
request_url=request.url)
|
||||||
return body, {'Content-Type': atom.CONTENT_TYPE}
|
return body, {'Content-Type': atom.CONTENT_TYPE}
|
||||||
elif format == 'rss':
|
elif format == 'rss':
|
||||||
body = rss.from_activities(as1_activities, actor=actor, title=title,
|
body = rss.from_activities(as1_activities, actor=actor, title=title,
|
||||||
feed_url=request.url)
|
feed_url=request.url)
|
||||||
return body, {'Content-Type': rss.CONTENT_TYPE}
|
return body, {'Content-Type': rss.CONTENT_TYPE}
|
||||||
|
|
||||||
|
|
||||||
@app.get('/responses') # deprecated
|
@app.get('/responses') # deprecated
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}{{ domain }}'s feed - Bridgy Fed{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h2 class="row">
|
||||||
|
<a href="/user/{{ domain }}">🌐 {{ domain }}</a>'s feed
|
||||||
|
</h2>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/static/feed.css" type="text/css" />
|
||||||
|
<div class="row h-feed">
|
||||||
|
{% for e in entries %}
|
||||||
|
{{ e|safe }}
|
||||||
|
{% else %}
|
||||||
|
Nothing yet. <a href="/#To+use+it">Follow more people</a>, check back soon!
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
Ładowanie…
Reference in New Issue