Skip to content
Snippets Groups Projects
Commit dd16ffe3 authored by John Xina's avatar John Xina
Browse files

Temporary remove popularity sort, Bump up aiotieba version

parent 965c8f2c
No related branches found
No related tags found
No related merge requests found
......@@ -131,16 +131,15 @@ async def thread_view(tid):
async def forum_view():
fname = request.args['kw']
pn = int(request.args.get('pn') or 1)
sort = int(request.args.get('sort') or 0)
sort = int(request.args.get('sort') or 5)
async with aiotieba.Client() as tieba:
forum_info, threads = await asyncio.gather(awaitify(find_tieba_info)(fname),
tieba.get_threads(fname, rn=50, pn=pn, sort=sort))
tieba.get_threads(fname, pn=pn, sort=sort))
if threads.page.current_page > threads.page.total_page or pn < 1:
return await render_template('error.html', msg = \
f'请求越界,本贴吧共有 { threads.page.total_page }'
f'而您查询了第 { threads.page.current_page}')
return await render_template('bar.html', info=forum_info, threads=threads, sort=sort)
@app.route('/home/main')
......
aioflask==0.4.0
flask==2.1.3
aiotieba==3.4.5
aiotieba==3.5.0
Flask-Caching
beautifulsoup4
requests
......
......@@ -23,12 +23,13 @@
</header>
<div class="list">
<div class="vlist">
<div><a {% if sort == 0 %} class="current-sel" {% endif %}
href="/f?kw={{ info['name'] }}&pn={{ threads.page.current_page }}&sort=0">时下热门</a></div>
<div><a {% if sort == 1 %} class="current-sel" {% endif %}
href="/f?kw={{ info['name'] }}&pn={{ threads.page.current_page }}&sort=1">最新发布</a></div>
<!-- POPULAR SORT IS UNAVAILABLE -->
<!-- <div><a {% if sort == 0 %} class="current-sel" {% endif %}
href="/f?kw={{ info['name'] }}&pn={{ threads.page.current_page }}&sort=0">时下热门</a></div> -->
<div><a {% if sort == 5 %} class="current-sel" {% endif %}
href="/f?kw={{ info['name'] }}&pn={{ threads.page.current_page }}&sort=5">最新回复</a></div>
href="/f?kw={{ info['name'] }}&sort=5">最新回复</a></div>
<div><a {% if sort == 1 %} class="current-sel" {% endif %}
href="/f?kw={{ info['name'] }}&sort=1">最新发布</a></div>
</div>
</div>
<div class="list">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment