/?limit=0のサポート

This commit is contained in:
yuuki 2025-03-05 08:57:28 +00:00
parent 9c7f06a57d
commit 46eba541f4
2 changed files with 3 additions and 2 deletions

4
app.py
View file

@ -227,9 +227,9 @@ async def api_ng_delete(item: NGItem):
return PlainTextResponse("OK")
@app.get("/")
async def home(req: Request):
async def home(req: Request, limit: int = 50):
res = ctx["templates"].TemplateResponse(req, "index.html", {
"notes": get_litey_notes(limit=50),
"notes": get_litey_notes(limit=limit),
"ng_words": get_ng_words()
})
res.headers["Cache-Control"] = f"public, max-age=60, s-maxage=60"

View file

@ -11,6 +11,7 @@
<h1>掲示板へようこそ!</h1>
<p>良識のあるメッセージを心がけてください</p>
<p>荒らしが横行しているため、最初の50件のみ表示しています。</p>
<p>全て表示するには<a href="/?limit=0">こちら</a></p>
<textarea placeholder="ここにメッセージを入力" rows="4" cols="50" id="message"></textarea>
<input type="submit" value="今すぐ送信!" onclick="notePost();">
{% for note in notes %}