增加文章最后修改日期,并且准备转向前端请求,并非后端模板的想法

This commit is contained in:
2026-04-11 02:03:21 +08:00
parent 98314cbfe3
commit abdf1b4258
4 changed files with 42 additions and 9 deletions

View File

@@ -4,11 +4,4 @@ docs_api = Blueprint('/api/docs', __name__)
@docs_api.get("/")
def home():
return """
<br><br><h1>其实我最开始是想用fastapi的.....</h1>.....
<br>
<br>
查询日志
<br>
<a href="https://ww3.tw/api/s/get/logs/">https://ww3.tw/api/s/get/logs/</a>
"""
return "123"

View File

@@ -198,3 +198,8 @@ def paint():
def paint_upload():
if request.method == "POST":
return "POST"
@blog_bp.route('/new_page/')
@blog_bp.route('/new_page/<page_name>/')
def new_page(page_name=None):
return send_from_directory(os.path.join(current_app.static_folder, 'new_page'), f'{page_name}.html')

33
static/new_page/home.html Normal file
View File

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
</html>
<!-- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
fetch('https://open-ww3-project.ww3.tw/api/s/get/logs/')
.then(response => response.json())
.then(data => {
const textContent = JSON.stringify(data, null, 2);
str = textContent
arrayStr = JSON.parse(str)
arr = arrayStr.map(obj => obj.content)
document.write(arr)
})
</script>
</body>
</html> -->

View File

@@ -20,6 +20,8 @@
<br>
<br>
<br>
最后修改时间: 【{{ posts['update_time'].replace('.', '-') }}】
<br>
<hr>
<h2>留言区: </h2>
<form method="post" action="./chat/">