diff --git a/app.py b/app.py index 3e849a2c066cd5975cf00a79bd3dd90e864c9cec..21609b8a362f12af5f8ecbb3adaa67cc23aa6954 100644 --- a/app.py +++ b/app.py @@ -131,7 +131,7 @@ async def thread_view(tid): @app.route('/f') 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) sort = int(request.args.get('sort') or 0) @@ -149,6 +149,10 @@ async def forum_view(): async def user_view(): return 'UNDER CONSTRUCTION' +@app.route('/') +async def main_view(): + return await render_template('index.html') + ###################################################################### @app.errorhandler(RuntimeError) diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000000000000000000000000000000000000..afa1a5a0b37f16bc6f2d24806bdb71ee47ab666f --- /dev/null +++ b/templates/index.html @@ -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;"> + 🐀 + </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>