Add link and functionality to bbs

This commit is contained in:
juan 2022-05-14 11:33:20 +08:00
parent fc42e62ceb
commit ed98e328cd
3 changed files with 38 additions and 17 deletions

2
app.py
View File

@ -20,4 +20,4 @@ def privacypolicy():
if __name__ == "__main__":
app.run(host="0.0.0.0")
app.run(host="127.0.0.1")

View File

@ -1,9 +1,28 @@
import requests as python_requests
discussionPrefix = "https://talk.zhdo.space/topic/"
def getRecentArticle():
# TODO fetch latest article
recent = {"title": "N/A", "link": "#"}
return recent
def getRecentDiscussion():
# TODO fetch latest discussion
recent = {"title": "N/A", "link": "#"}
return recent
obj = python_requests.get("https://talk.zhdo.space/api/recent/posts/week")
if obj.status_code == 200:
recent["title"] = str(obj.json()[0]["topic"]["title"])
recent["link"] = discussionPrefix + str(obj.json()[0]["topic"]["slug"])
return recent
else:
return "error"
def main():
print(getRecentDiscussion())
if __name__ == "__main__":
main()

View File

@ -5,9 +5,9 @@
<div class="container-fluid py-5">
<h1 class="display-5 fw-bold">智互奥运</h1>
<p class="col-md-8 fs-4">
Using a series of utilities, you can create this jumbotron, just like
the one in previous versions of Bootstrap. Check out the examples
below for how you can remix and restyle it to your liking.
Elit est id esse iste impedit odit adipisci? Ea quia perspiciatis eos
adipisci aut numquam Veniam expedita repellendus temporibus voluptatem
nam aperiam Nemo doloremque ex at non deserunt. Blanditiis repellat
</p>
</div>
</div>
@ -15,15 +15,15 @@
<div class="row align-items-md-stretch">
<div class="col-md-6 mb-4">
<div class="h-100 p-5 text-white bg-darkblue rounded-3">
<h2>奥运文化</h2>
<h2>体育文化</h2>
<p>
Sports Culture即体育文化
公众号主要是为大学生提供一个有关体育文化的有趣的中英文知识学习及互动平台,
公众号主要是为大学生提供一个有关体育文化的有趣的中英文知识学习及互动平台,
让大家在了解体育知识与文化的同时学习到英语知识。
</p>
<h6 class="mb-3">
最新文章:
<u>
最新文章:
<a href="{{ recentArticle['link'] }}"
>{{ recentArticle['title'] }}</a
>
@ -38,22 +38,24 @@
<div class="h-100 p-5 bg-lightblue border rounded-3">
<h2>奥运交流</h2>
<p>
Or, keep it light and add a border for some added definition to the
boundaries of your content. Be sure to look under the hood at the
source HTML here as we've adjusted the alignment and sizing of both
column's content for equal-height.
Adipisicing veniam repudiandae molestias molestiae sint Sit deserunt
blanditiis sit ut distinctio doloribus. Modi sit est pariatur enim
labore officiis quo At eligendi accusamus aspernatur corrupti animi
voluptas libero! Porro
</p>
<h6 class="mb-3">
最新讨论:
<u>
最新讨论:
<a href="{{ recentDiscussion['link'] }}"
>{{ recentDiscussion['title'] }}</a
>
</u>
</h6>
<button class="btn btn-outline-secondary" type="button">
跳转至讨论区
</button>
<a href="https://talk.zhdo.space/">
<button class="btn btn-outline-secondary" type="button">
跳转至讨论区
</button>
</a>
</div>
</div>
</div>