front page of course!

This commit is contained in:
John Xina 2023-07-13 21:09:04 +08:00
parent 6b75b414c1
commit 414e0194c0
2 changed files with 61 additions and 1 deletions

6
app.py
View File

@ -131,7 +131,7 @@ async def thread_view(tid):
@app.route('/f') @app.route('/f')
async def forum_view(): async def forum_view():
fname = request.args['kw'] fname = request.args['kw'][:-1] if request.args['kw'][-1] == '' else request.args['kw']
pn = int(request.args.get('pn') or 1) pn = int(request.args.get('pn') or 1)
sort = int(request.args.get('sort') or 0) sort = int(request.args.get('sort') or 0)
@ -149,6 +149,10 @@ async def forum_view():
async def user_view(): async def user_view():
return 'UNDER CONSTRUCTION' return 'UNDER CONSTRUCTION'
@app.route('/')
async def main_view():
return await render_template('index.html')
###################################################################### ######################################################################
@app.errorhandler(RuntimeError) @app.errorhandler(RuntimeError)

56
templates/index.html Normal file
View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<head>
<title>错误 - RAT</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/static/css/main.css" rel="stylesheet">
<style>
.list {
margin: 5% !important;
padding: 1% !important;
}
form {
display: flex;
flex-direction: row;
margin: 1%;
font-size: large;
}
form > label {
flex-shrink: 0;
text-align: right;
}
form > input {
flex-grow: 1;
text-align: center;
}
</style>
</head>
<body>
<div class="list" style="text-align: center;">
<div style="font-size: 10em;">
<a title="吱?" style="text-decoration: none;">
&#x1F400;
</a>
</div>
<h1>RAT Ain't Tieba</h1>
<h2>一款<a href="https://writefreesoftware.org/">尊重用户自由的</a>百度贴吧前端</h2>
</div>
<div class="list">
<form action="/f" method="get">
<label for="kw">贴吧传送门:</label>
<input type="text" name="kw" required />
</form>
</div>
<footer>
<div><a href="https://0xacab.org/johnxina/rat">RAT Ain't Tieba</a></div>
<div><a href="https://0xacab.org/johnxina/rat/-/blob/no-masters/LICENSE">自豪地以 AGPLv3 释出</a></div>
<div><a href="https://0xacab.org/johnxina/rat">源代码</a></div>
</footer>
</body>