脑袋好乱啊,先上传了

This commit is contained in:
2025-12-28 23:12:28 +08:00
parent 8ca06abe4a
commit 4266c8ac5c
10 changed files with 179 additions and 147 deletions

View File

@@ -44,11 +44,13 @@ def posts_list():
def show_posts_id(posts_id):
conn = get_owp_db_conn()
sql_posts = "SELECT * FROM posts WHERE status = 1 AND id = ?"
sql_message = "SELECT * FROM messages WHERE posts_id = ?"
posts = conn.execute(sql_posts, (posts_id,)).fetchone()
message = conn.execute(sql_message, (posts_id,)).fetchall()
conn.close()
if posts is None:
return f'未找到该文章{posts_id}<title>未找到该文章{posts_id}</title>', 404
return render_template('blog/posts.html', posts=posts)
return render_template('blog/posts.html', posts=posts, message=message[::-1])

0
packages/__init__.py Normal file
View File

55
templates/blog/base.html Normal file
View File

@@ -0,0 +1,55 @@
{# base_home模板 #}
<!DOCTYPE html>
<html>
<title>{% block title %}{% endblock %} | ww3</title>
<body>
<div id="logs_and_page">
{% block logs_and_page %}
{# 这里存放写入模板的数据 #}
{% endblock %}
</div>
{% include 'blog/footer.html' %}
</body>
</html>
{# css部分 #}
<style>
#navbar {
width: 100%;
text-align: center;
}
#url_ {
margin: 0 5px 0 0;
color: black;
font-weight: bold;
}
#logs_and_page {
margin: 0 0 0 0;
margin-left: 5%;
width: 90%;
height: 640px;
background-color: #93B9FFA4;
}
#navbar1 {
font-size: 125%;
width: 35%;
height: 13px;
background-color: rgba(169, 198, 252, 0);
}
#navbar {
font-size: 125%;
width: 500px;
height: auto;
background-color: rgb(169, 198, 252);
}
html, body {
margin: 0;
}
a {
text-decoration: none;
}
body {
background-color: rgb(92, 92, 92);
}
</style>

View File

@@ -0,0 +1,27 @@
<footer style="
text-align: center;
background-color: rgba(0, 0, 0, 0);
color: rgb(255, 255, 255);
padding: 10px;
margin-top: 0;
">
<hr>
© 2025 | open-ww3-poject for ww3.tw
<br>
<a href="https://wiki.ww3.tw/doku.php?id=zh_cn:skimrme" style="color: rgb(188, 188, 255);">关于站长</a>
<a href="{{ url_for('blog.sitemap') }}" style="color: rgb(188, 188, 255);">网页地图</a>
<br>
<br>
联系:
<br>
电子邮件: <a style="color: rgb(188, 188, 255);">master@ww3.tw<a>
<br>
社交:
<br>
暂不提供
<br>
其他平台:
<br>
<br>
暂不提供
</footer>

4
templates/blog/head.html Normal file
View File

@@ -0,0 +1,4 @@
<head>
<meta charset="utf-8" lang="zh_CN">
<link rel="icon" type="image/x-icon" href="/static/icon/original.ico">
</head>

View File

@@ -1,9 +1,13 @@
{# 引入base #}
{% extends 'blog/home_base.html' %}
{% extends 'blog/base.html' %}
{# 引入标题 #}
{% block title %}首页{% endblock %}
{% include 'blog/head.html' %}
{% include 'blog/wallpaper.html' %}
{% block logs_and_page %}
<h1>欢迎访问open-ww3-project</h1>
<!-- 屑站日志 -->
@@ -52,13 +56,13 @@
<!-- css 部分 -->
<style>
#posts {
margin: -20% 0 0 60%;
margin: -31% 0 0 60%;
}
/* 日志 */
#logs
{
height: 220px;
width: 460px;
height: 50%;
width: 40%;
overflow: auto;
background: #ffffffbc;
/* up、right、down、left */

View File

@@ -1,142 +0,0 @@
{# base模板 #}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" lang="zh_CN">
<link rel="icon" type="image/x-icon" href="/static/icon/original.ico">
<link rel="preload" href="{{ wallpaper }}" as="image">
<title>{% block title %}{% endblock %} | ww3</title>
</head>
<body>
{% set navbar_list = [
{"id":1, "name": "首页", "url": url_for('blog.home')},
{"id":2, "name": "关于", "url": url_for('blog.about')},
{"id":3, "name": "文章", "url": url_for('blog.posts_list')},
{"id":4, "name": "mirrors", "url": url_for('blog.autoindex')},
{"id":5, "name": "study", "url": url_for('study.home')},
]%}
{% set wallpaper_apis =[
'https://www.loliapi.com/acg/pc/',
'https://api.sretna.cn/api/pc.php',
'https://www.api.plus/API/dongman/',
'https://moe.jitsu.top/img/?sort=pc',
'https://www.dmoe.cc/random.php',
'https://api.r10086.com/樱道随机图片api接口.php?图片系列=猫娘1',
'https://api.mtyqx.cn/tapi/random.php'] %}
{% set wallpaper = wallpaper_apis | random %}
<div style="display: none;">
<p>一个致力于分享个人学习到的知识的记录形式的屑站</p>
<p>在这里,我会分享我学到的计算机知识或者记录一些自己经常碰到的问题</p>
</div>
<div id="wallpaper">
<div id="navbar1">
<br>
</div>
<div id="navbar">
{% for navbar in navbar_list %}
<a href="{{ navbar.url }}" id="url_">{{ navbar.name }}</a></td>
{% endfor %}
<a id="url_" href="https://api.ww3.tw">api</a>
<a id="url_" href="https://gitea.ww3.tw">gitea</a>
</div>
<br>
<div style="text-align: center;
font-weight: bolder;
text-shadow:
3px 3px 0 rgba(0,0,0,0.2),
6px 6px 0 rgba(0,0,0,0.1);
font-size: 300%;
color: rgb(240, 248, 255);
">
<p>open-ww3-poject</p>
</div>
<div>
<p style="text-align: right; margin: 420px 0 0 0;">图片来源: <a href="{{ wallpaper }}" style="color: rgb(247, 74, 74);">{{ wallpaper }}<a></p>
</div>
<div style="text-align: center; color: rgba(255, 255, 255, 0.664); margin: -400px 0 0 0; text-shadow: 3px 3px 5px rgba(47, 79, 79, 0.7);">
<p>一个致力于分享个人学习到的知识的记录形式的屑站</p>
<p>在这里,我会分享我学到的计算机知识或者记录一些自己经常碰到的问题</p>
</div>
</div>
<div id="logs_and_page">
{% block logs_and_page %}
{# 这里存放写入模板的数据 #}
{% endblock %}
</div>
<footer style="
text-align: center;
background-color: rgba(0, 0, 0, 0);
color: rgb(255, 255, 255);
padding: 10px;
margin-top: 0;
">
© 2025 | open-ww3-poject for ww3.tw
<br>
<a href="https://wiki.ww3.tw/doku.php?id=zh_cn:skimrme" style="color: rgb(188, 188, 255);">关于站长</a>
<a href="{{ url_for('blog.sitemap') }}" style="color: rgb(188, 188, 255);">网页地图</a>
<br>
<br>
联系:
<br>
电子邮件: <a style="color: rgb(188, 188, 255);">master@ww3.tw<a>
<br>
社交:
<br>
暂不提供
</footer>
</body>
</html>
{# css部分 #}
<style>
#navbar {
width: 100%;
text-align: center;
}
#url_ {
margin: 0 5px 0 0;
color: black;
font-weight: bold;
}
#logs_and_page {
margin: 0 0 0 0;
margin-left: 5%;
width: 90%;
height: 640px;
background-color: #93B9FFA4;
}
#wallpaper {
margin-left: 5%;
width: 90%;
height: 640px;
background-color: #93B9FFA4;
background-image: url('{{ wallpaper }}');
background-size: 100% 100%;
background-size: cover;
background-position: center;
}
#navbar1 {
font-size: 125%;
width: 35%;
height: 13px;
background-color: rgba(169, 198, 252, 0);
}
#navbar {
font-size: 125%;
width: 500px;
height: auto;
background-color: rgb(169, 198, 252);
}
html, body {
margin: 0;
}
a {
text-decoration: none;
}
body {
background-color: rgb(92, 92, 92);
}
</style>

View File

@@ -0,0 +1,19 @@
{# navbar 部分 #}
{% set navbar_list = [
{"id":1, "name": "首页", "url": url_for('blog.home')},
{"id":2, "name": "关于", "url": url_for('blog.about')},
{"id":3, "name": "文章", "url": url_for('blog.posts_list')},
{"id":4, "name": "mirrors", "url": url_for('blog.autoindex')},
{"id":5, "name": "study", "url": url_for('study.home')},
]%}
<div id="navbar1">
<br>
</div>
<div id="navbar" style="text-align: left;">
{% for navbar in navbar_list %}
<a href="{{ navbar.url }}" id="url_">{{ navbar.name }}</a></td>
{% endfor %}
<a id="url_" href="https://api.ww3.tw">api</a>
<a id="url_" href="https://gitea.ww3.tw">gitea</a>
</div>

View File

@@ -10,6 +10,17 @@
<br>
<br>
{{ posts['content'].replace('&a&a','<style>a{text-decoration: none;}</style>') | safe}}
<br>
<br>
<br>
<h2>留言区: </h2>
{% for message in message %}
[ {{ message['name'] }} ] >$
{{ message['content'] }}<br>
{{ message['date'] }}
<br>
<br>
{% endfor %}
</body>
</html>
<style>

View File

@@ -0,0 +1,52 @@
{# 壁纸部分 #}
{% set wallpaper_apis =[
'https://www.loliapi.com/acg/pc/',
'https://api.sretna.cn/api/pc.php',
'https://www.api.plus/API/dongman/',
'https://moe.jitsu.top/img/?sort=pc',
'https://www.dmoe.cc/random.php',
'https://api.mtyqx.cn/tapi/random.php'] %}
{% set wallpaper = wallpaper_apis | random %}
<!--'https://api.r10086.com/樱道随机图片api接口.php?图片系列=猫娘1', -->
<head>
<link rel="preload" href="{{ wallpaper }}" as="image">
</head>
<div style="display: none;">
<p>一个致力于分享个人学习到的知识的记录形式的屑站</p>
<p>在这里,我会分享我学到的计算机知识或者记录一些自己经常碰到的问题</p>
</div>
<div id="wallpaper">
{% include 'blog/navbar.html' %}
<br>
<div style="text-align: center;
font-weight: bolder;
text-shadow:
3px 3px 0 rgba(0,0,0,0.2),
6px 6px 0 rgba(0,0,0,0.1);
font-size: 300%;
color: rgb(240, 248, 255);
">
<p>open-ww3-poject</p>
</div>
<div>
<p style="text-align: right; margin: 420px 0 0 0;">图片来源: <a href="{{ wallpaper }}" style="color: rgb(247, 74, 74);">{{ wallpaper }}<a></p>
</div>
<div style="text-align: center; color: rgba(255, 255, 255, 0.664); margin: -400px 0 0 0; text-shadow: 3px 3px 5px rgba(47, 79, 79, 0.7);">
<p>一个致力于分享个人学习到的知识的记录形式的屑站</p>
<p>在这里,我会分享我学到的计算机知识或者记录一些自己经常碰到的问题</p>
</div>
</div>
<style>
#wallpaper {
margin-left: 5%;
width: 90%;
height: 640px;
background-color: #93B9FFA4;
background-image: url('{{ wallpaper }}');
background-size: 100% 100%;
background-size: cover;
background-position: center;
}
</style>