修改主页,感觉还可以

This commit is contained in:
2025-12-27 13:35:20 +08:00
parent 7c94590c40
commit 8ca06abe4a
20 changed files with 353 additions and 337 deletions

83
templates/blog/home.html Normal file
View File

@@ -0,0 +1,83 @@
{# 引入base #}
{% extends 'blog/home_base.html' %}
{# 引入标题 #}
{% block title %}首页{% endblock %}
{% block logs_and_page %}
<h1>欢迎访问open-ww3-project</h1>
<!-- 屑站日志 -->
<h3 style="margin: 10px 0 30px 50px;">屑站日志:<br></h3>
<div id="logs">
<font size="3.2">
<table border="0">
<tbody>
{# 调用数据库 #}
{% for logs in logs %}
<tr>
<td id="td_logs">
<a style='font-size: 18px;'>
{{ logs['date'].replace('.', '-') }}
</a>
<br>
</td>
<td id="td_logs_content">
{{ logs['content'].replace('&&', '<br>') | safe }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</font>
</div>
<!-- 屑站日志 -->
<div id="posts">
<h1>全部文章</h1>
文章如下↓
<br>
<br>
{% for posts in posts %}
文章id:{{ posts['id'] }}
<br>
标题: {{ posts['title'] }}
<br>
日期: {{ posts['date'].replace('.', '-')}}
<a href="{{ url_for('blog.posts_list') }}{{ posts['id'] }}">页面跳转</a>
<br>
<br>
{% endfor %}
</div>
<!-- css 部分 -->
<style>
#posts {
margin: -20% 0 0 60%;
}
/* 日志 */
#logs
{
height: 220px;
width: 460px;
overflow: auto;
background: #ffffffbc;
/* up、right、down、left */
margin: -10px 0px 0px 30px;
}
#td_logs
{
width: 93px;
padding-top: 1.8px;
vertical-align: top;
}
#td_logs_content
{
color: rgb(132, 132, 132);
padding-left: 10px;
padding-bottom: 5px;
}
/* 日志 */
</style>
{% endblock %}

View File

@@ -0,0 +1,142 @@
{# 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

@@ -22,7 +22,7 @@
{% block footer %}
<hr>
<div style="text-align: right; color: #fb8888; background-color: rgba(229, 229, 255, 0); width: 300px; margin: -13.82% 0 0 70.45%;">
<div style="color: #fb8888; text-align: center;">
© 2025 open-ww3-project
</div>
{% endblock %}

19
templates/blog/posts.html Executable file
View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ posts['title'] }}</title>
</head>
<body>
<a href="../">返回上级</a>
<br>
<h1>{{ posts['title'] }}</h1>
<br>
<br>
{{ posts['content'].replace('&a&a','<style>a{text-decoration: none;}</style>') | safe}}
</body>
</html>
<style>
body {
background-color: rgb(175, 223, 255);
}
</style>

29
templates/blog/sitemap.xml Executable file
View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>{{ base_url }}</loc>
<lastmod>2025-12-22</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
{% for post in posts %}
<url>
<loc>{{ base_url }}posts/{{ post['id'] }}/</loc>
<lastmod>{{ post['date'].replace('.', '-') }}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
{% endfor %}
<url>
<loc>{{ base_url }}posts/</loc>
<lastmod>2025-12-23</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>{{ base_url }}mirrors/</loc>
<lastmod>2025-12-23</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
</urlset>

View File

@@ -0,0 +1,19 @@
<title>上传文件</title>
上传文件
<br>
目前只支持jpg, jpeg, png, gif
<form id="upload-form" enctype="multipart/form-data" method="post" action="./">
<input type="file" name="img" required>
<button type="submit">上传文件</button>
</form>
<br>
<br>
已上传图片
<br>
<br>
<br>
{% for image in images %}
<a href="{{ url_for('static', filename='upload/img/' + image) }}">
<img src="{{ url_for('static', filename='upload/img/' + image) }}" style="width: 10%;" alt="{{ image }}">
</a>
{% endfor %}

View File

@@ -1,277 +0,0 @@
<!-- 主页 -->
<html>
<head>
<title>首页 | ww3</title>
<meta charset="utf-8" lang="zh-CN">
<link rel="icon" type="image/x-icon" href="/static/icon/original.ico">
<!-- 引入页面蓝图css -->
<link rel="stylesheet" type="text/css" href="/static/css/main.css">
</head>
<body>
<div id="app-canvas">
<header>
<h1 style="margin: 80px 0 0 0; color:aqua;">open-ww3-project</h1>
</header>
<!-- 导航栏 -->
<div id="navbar1">
<table border="0" style="background-color: rgba(147, 185, 255, 0.644);">
<tbody>
<tr>
<td id="td_navbar_40px"><b><a href="{{ url_for('blog.home') }}" id="url_">首页</a></b></td>
<td id="td_navbar_40px"><b><a href="{{ url_for('blog.about') }}" id="url_">关于</a></b></td>
<td id="td_navbar_40px"><b><a href="{{ url_for('blog.posts_list') }}" id="url_">文章</a></b></td>
<td id="td_navbar_75px"><b><a href="#" id="url_">弹幕留言</a></b></td>
<td id="td_navbar_78px"><b><a href="#" id="url_">短链生成</a></b></td>
<td id="td_navbar_52px"><b><a href="https://gitea.ww3.tw/skimrme/" id="url_">gitea</a></b></td>
<td id="td_navbar_150px"><b><a href="https://ww3.tw/docker-registry/" id="url_">docker-registry</a></b></td>
<td id="td_navbar_40px"><b><a href="https://api.ww3.tw/" id="url_">api</a></b></td>
<td id="td_navbar_40px"><b><a href="https://wiki.ww3.tw/" id="url_">wiki</a></b></td>
<td id="td_navbar_52px"><b><a href="/mirrors" id="url_">mirrors</a></b></td>
</tr>
</tbody>
</table>
</div>
<!-- 倒过来的箱子 真不明白为什么我会称呼箱子为open-ww3-project-->
<div style="margin: 80px -30px -100px 180px;">
<img id="open-ww3-project-img" width="10%" src="/static/img/open-ww3-project.png" alt="open-ww3-project-img">
</div>
<!-- gitea 图标 -->
<a style="background-color: blueviolet; position: absolute;" href="https://gitea.ww3.tw/skimrme/open-ww3-project-ww3-tw">
<img id="gitea-img" src="https://gitea.ww3.tw/assets/img/logo.svg" width="150px" alt="gitea" >
</a>
<!-- 导航栏 -->
<div id="content-area">
<!-- 屑站日志 -->
<h3 style="margin: 70px 0 30px -50px;">屑站日志:<br></h3>
<div id="logs">
<font size="3.2">
<table border="0">
<tbody>
{# 调用数据库 #}
{% for logs in logs %}
<tr>
<td id="td_logs">
<a style='font-size: 18px;'>
{{ logs['date'] }}
</a>
<br>
</td>
<td id="td_logs_content">
{{ logs['content'].replace('&&', '<br>') | safe }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</font>
</div>
<!-- 屑站日志 -->
<div id="post_content">
{#
<?php
//include "post/index.php";
// 设定数据库路径
$db_path = '/var/www/owp/open-ww3-project-ww3-tw/databases/sqlite/owp.db';
try {
// 连接数据库
$db = new SQLite3($db_path);
// 连接成功输出连接成功
echo "<!--数据库连接成功-->";
// 如果连接成功,但是内部状态有问题
if ($db->lastErrorCode() !==0) {
// 依旧显示为连接失败
die("数据库连接失败");
}
// 内容区
// 执行sql命令 查询表单
$select_id_date_title_from_posts_btos /*查询posts表单中的id date title id从大到小排列*/ = $db->query('SELECT id, date, title FROM posts ORDER BY id DESC'); // 执行查询posts表单中的id date title id从大到小排列的命令
// 循环 写入
echo "<center><b><h2>全部文章</h2></b></center>";
echo "<br>";
echo "文章如下↓";
echo "<br>";
echo "<br>";
while ($row = $select_id_date_title_from_posts_btos->fetchArray(SQLITE3_ASSOC)) {
echo "文章id: " . $row['id'] . "<br>";
echo $row['date'] . "&nbsp;&nbsp;&nbsp;" . "文章标题: " . $row['title'] . "<br>";
echo "<a href='https://ww3.tw/blog/post/s/?id=" . $row['id'] . "'>页面跳转</a><br><br>";
}
// 关闭数据库连接
$db->close();
// 捕获php报错
} catch (Exception $e) {
// 依旧显示为连接失败
die("数据库连接失败");
// 关闭数据库连接
$db->close();
}
?>
#}
<center><b><h2>全部文章</h2></b></center>
<br>
文章如下↓
<br>
<br>
{% for posts in posts %}
文章id:{{ posts['id'] }}
<br>
{{ posts['date'] }}
{{ posts['title'] }}
<br>
<a href="{{ url_for('blog.posts_list') }}{{ posts['id'] }}">页面跳转</a>
<br>
<br>
{% endfor %}
</div>
</div>
<!-- 私の娘 -->
<div style="margin: 40px 0 0 0;">
<div id="my_girl" style="margin: -40px 0 0 1100px;"></div>
</div>
<!-- 私の娘 -->
</div>
</body>
</html>
<!-- css 部分 -->
<style>
#navbar1 {
margin: -160px 0 100px -30px;
}
#url_
{
text-decoration: none;
color: rgb(0, 0, 0);
font-size: 18.8px;
}
#td_navbar_40px
{
width: 40px;
}
#td_navbar_52px
{
width: 52px;;
}
#td_navbar_78px
{
width: 78px;
}
#td_navbar_150px
{
width: 150px;
}
/* 日志 */
#logs
{
height: 220px;
width: 450px;
overflow: auto;
background: #ffffffbc;
/* up、right、down、left */
margin: 115px 0px 0px -280px;
}
#td_logs
{
width: 75px;
padding-top: 1.8px;
vertical-align: top;
}
#td_logs_content
{
color: rgb(132, 132, 132);
padding-left: 10px;
padding-bottom: 5px;
}
/* 日志 */
/* 文章 */
#post_content
{
/*text-align: center;*/
height: 450px;
width: 490px;
color: rgb(202, 202, 202);
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
background-color: rgba(27, 27, 27, 0.010);
overflow: auto;
font-size: 19px;
/* up、right、down、left */
margin: 40px 0 0 0;
}
/* 图标 */
#open-ww3-pro1ject-img
{
overflow: auto;
/* up、right、down、left */
margin: 0 0 0 0;
}
#gitea-img
{
margin: -150px 0 0 1150px;
}
</style>
<!-- js 部分-->
<script src="/static/js/main.js"> 引入js页面蓝图 </script>
<!-- 私の娘 -->
<!-- https://cdn.jsdelivr.net/npm/sakana-widget@2.7.1/lib/sakana.min.css -->
<!-- https://cdn.jsdelivr.net/npm/sakana-widget@2.7.1/lib/sakana.min.js -->
<!-- https://cdnjs.cloudflare.com/ajax/libs/sakana-widget/2.7.1/sakana.min.css -->
<!-- https://cdnjs.cloudflare.com/ajax/libs/sakana-widget/2.7.1/sakana.min.js -->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/sakana-widget@2.7.1/lib/sakana.min.css"
/>
<script>
function initSakanaWidget(){
const customImageUrl = "{{ url_for('static', filename='img/my_girl.png') }}";
const baseCharacter = SakanaWidget.getCharacter('chisato');
const myCharacter = {
image: customImageUrl,
initialState: baseCharacter.initialState,
};
SakanaWidget.registerCharacter('my_girl', myCharacter);
new SakanaWidget({
character: 'my_girl',
size: 200,
autoFit: true,
controls: true
})
.setState({ y: 0, t: 0, w: 0, r: 0 })
.mount('#my_girl');
}
</script>
<script
async
onload="initSakanaWidget()"
src="https://cdn.jsdelivr.net/npm/sakana-widget@2.7.1/lib/sakana.min.js">
</script>
<!-- 私の娘 -->

View File

@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ posts['title'] }}</title>
</head>
<body>
<a href="../">返回上级</a>
<br>
{{ posts['title'] }}
<br>
<br>
{{ posts['content'] | safe}}
</body>
</html>

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="www.sitemaps.org">
<url>
<loc>{{ base_url }}</loc>
<lastmod>2025.12.22</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
{% for posts in posts %}
<url>
<loc>{{ base_url }}posts/{{ posts['id'] }}/</loc>
<lastmod>{{ posts['date'] }}</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
{% endfor %}
</urlset>