diff --git a/app.py b/app.py index 0d98efe..fd546cb 100644 --- a/app.py +++ b/app.py @@ -104,11 +104,13 @@ async def _jinja2_filter_translate(frags, reply_id=0): async def thread_view(tid): tid = int(tid) pn = int(request.args.get('pn') or 1) + ao = int(request.args.get('ao') or 0) async with aiotieba.Client() as tieba: # Default to 15 posts per page, confirm to tieba.baidu.com thread_info = await tieba.get_posts(tid, rn=15, pn=pn, - with_comments=should_fetch_comments) + with_comments=should_fetch_comments, + only_thread_author=ao) available_users = [] for floor in thread_info: @@ -125,7 +127,7 @@ async def thread_view(tid): await asyncio.gather(*(cache_name_from_id(tieba, i) for i in all_users)) - return await render_template('thread.html', info=thread_info) + return await render_template('thread.html', info=thread_info, ao=ao) @app.route('/f') async def forum_view(): diff --git a/templates/thread.html b/templates/thread.html index 8abcdfd..3b88050 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -1,6 +1,6 @@ - {{ info.thread.text }} - 自由软件吧 - RAT + {{ info.thread.text }}{{ ao }} - 自由软件吧 - RAT @@ -14,6 +14,12 @@
{{ info.thread.title }}
{{ info.forum.fname }}吧
+
+
+
全部回复
+
仅看楼主
+
+
{% for p in info %}
@@ -61,13 +67,13 @@
{% if info.page.current_page > 1 %} - 首页 + 首页 {% endif %} {% for i in range(5) %} {% set np = info.page.current_page - 5 + i %} {% if np > 0 %} - {{ np }} + {{ np }} {% endif %} {% endfor %} @@ -76,12 +82,12 @@ {% for i in range(5) %} {% set np = info.page.current_page + 1 + i %} {% if np <= info.page.total_page %} - {{ np }} + {{ np }} {% endif %} {% endfor %} {% if info.page.current_page < info.page.total_page %} - 尾页 + 尾页 {% endif %}