From 414e0194c05cf93e72b71d232cccd3296c9a2846 Mon Sep 17 00:00:00 2001 From: John Xina <bingchilling@riseup.net> Date: Thu, 13 Jul 2023 21:09:04 +0800 Subject: [PATCH] front page of course! --- app.py | 6 ++++- templates/index.html | 56 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 templates/index.html diff --git a/app.py b/app.py index 3e849a2..21609b8 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 0000000..afa1a5a --- /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> -- GitLab