新增paint页面,暂时放弃api来fetch数据构建页面,预计可能还有大量问题,暂时打算先整理所有的文件
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -10,7 +10,7 @@
|
|||||||
databases/*
|
databases/*
|
||||||
|
|
||||||
# flask folder
|
# flask folder
|
||||||
mirrors/*
|
folders/*
|
||||||
blueprint/kami_views.py
|
blueprint/kami_views.py
|
||||||
blueprint/massage_views.py
|
blueprint/massage_views.py
|
||||||
templates/kami/*
|
templates/kami/*
|
||||||
|
|||||||
@@ -21,21 +21,21 @@ def get_message_db_conn():
|
|||||||
|
|
||||||
blog_bp = Blueprint('blog', __name__)
|
blog_bp = Blueprint('blog', __name__)
|
||||||
|
|
||||||
index_path = '/var/open-ww3-project-ww3-tw/mirrors/'
|
index_path = '/var/open-ww3-project-ww3-tw/folders/'
|
||||||
index = AutoIndex(blog_bp, browse_root=index_path, add_url_rules=False)
|
index = AutoIndex(blog_bp, browse_root=index_path, add_url_rules=False)
|
||||||
|
|
||||||
# 重定向
|
# 重定向
|
||||||
@blog_bp.route('/mirrors/re/')
|
@blog_bp.route('/folders/re/')
|
||||||
def re():
|
def re():
|
||||||
return('404 not found<br><a style="color: white;">这是你不该知道的地方</a><br><iframe src="//player.bilibili.com/player.html?isOutside=true&aid=115578442356850&bvid=BV12CCdBkEL6&cid=34120008494&p=1&autoplay=0" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="width: 100%; height: 100%;"></iframe>')
|
return('404 not found<br><a style="color: white;">这是你不该知道的地方</a><br><iframe src="//player.bilibili.com/player.html?isOutside=true&aid=115578442356850&bvid=BV12CCdBkEL6&cid=34120008494&p=1&autoplay=0" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="width: 100%; height: 100%;"></iframe>')
|
||||||
|
|
||||||
@blog_bp.route('/mirrors/paint/2024.2.13/临摹出来的乐色/不好说的人物/')
|
@blog_bp.route('/folders/paint/2024.2.13/临摹出来的乐色/不好说的人物/')
|
||||||
@blog_bp.route('/mirrors/paint/2024.2.13/临摹出来的乐色/不好说的人物/<path:subpath>')
|
@blog_bp.route('/folders/paint/2024.2.13/临摹出来的乐色/不好说的人物/<path:subpath>')
|
||||||
def no_say_man(subpath=None):
|
def no_say_man(subpath=None):
|
||||||
return redirect(url_for('blog.re'))
|
return redirect(url_for('blog.re'))
|
||||||
|
|
||||||
@blog_bp.route('/mirrors/game/')
|
@blog_bp.route('/folders/game/')
|
||||||
@blog_bp.route('/mirrors/game/<path:subpath>')
|
@blog_bp.route('/folders/game/<path:subpath>')
|
||||||
def no_game(subpath=None):
|
def no_game(subpath=None):
|
||||||
return redirect(url_for('blog.re'))
|
return redirect(url_for('blog.re'))
|
||||||
# 重定向
|
# 重定向
|
||||||
@@ -143,11 +143,11 @@ def test_db():
|
|||||||
|
|
||||||
@blog_bp.route('/robots.txt/')
|
@blog_bp.route('/robots.txt/')
|
||||||
def robots():
|
def robots():
|
||||||
return send_from_directory(current_app.static_folder, 'robots.txt')
|
return send_from_directory(current_app.static_folders, 'robots.txt')
|
||||||
|
|
||||||
@blog_bp.route('/google02f6a3f6004a32c6.html')
|
@blog_bp.route('/google02f6a3f6004a32c6.html')
|
||||||
def google02f6a3f6004a32c6():
|
def google02f6a3f6004a32c6():
|
||||||
return send_from_directory(blog_bp.static_folder, 'google02f6a3f6004a32c6.html')
|
return send_from_directory(blog_bp.static_folders, 'google02f6a3f6004a32c6.html')
|
||||||
|
|
||||||
|
|
||||||
@blog_bp.route('/sitemap.xml/')
|
@blog_bp.route('/sitemap.xml/')
|
||||||
@@ -165,10 +165,10 @@ def sitemap():
|
|||||||
def kami():
|
def kami():
|
||||||
return redirect(url_for('kami.home'))
|
return redirect(url_for('kami.home'))
|
||||||
|
|
||||||
@blog_bp.route('/mirrors/')
|
@blog_bp.route('/folders/')
|
||||||
@blog_bp.route('/mirrors/<path:path>')
|
@blog_bp.route('/folders/<path:path>')
|
||||||
def autoindex(path='.'):
|
def autoindex(path='.'):
|
||||||
return index.render_autoindex(path, template='blog/mirrors.html')
|
return index.render_autoindex(path, template='blog/folders.html')
|
||||||
|
|
||||||
|
|
||||||
@blog_bp.route('/upload/', methods=['POST' , 'GET'])
|
@blog_bp.route('/upload/', methods=['POST' , 'GET'])
|
||||||
@@ -187,19 +187,8 @@ def upload():
|
|||||||
def messages():
|
def messages():
|
||||||
return render_template('message/home.html')
|
return render_template('message/home.html')
|
||||||
|
|
||||||
@blog_bp.route('/paint/')
|
|
||||||
def paint():
|
|
||||||
paint_path = "/var/open-ww3-project-ww3-tw/static/upload/paint_data"
|
|
||||||
paint_json = f"{paint_path}/paint.json"
|
|
||||||
paint_open = json.load(open(paint_json, 'r', encoding='utf-8'))
|
|
||||||
return render_template('blog/paint.html', paint_open=paint_open)
|
|
||||||
|
|
||||||
@blog_bp.route('/paint/upload/', methods=['POST',])
|
@blog_bp.route('/class')
|
||||||
def paint_upload():
|
def class_page():
|
||||||
if request.method == "POST":
|
# return ("this is Class_page")
|
||||||
return "POST"
|
return render_template('blog/class.html')
|
||||||
|
|
||||||
@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')
|
|
||||||
|
|||||||
@@ -4,6 +4,15 @@ import os
|
|||||||
|
|
||||||
index_bp = Blueprint('/', __name__)
|
index_bp = Blueprint('/', __name__)
|
||||||
|
|
||||||
|
db_path = "/var/open-ww3-project-ww3-tw/databases/sqlite/owp.db"
|
||||||
|
|
||||||
|
def get_paint_db_conn():
|
||||||
|
conn = sqlite3.connect(db_path)
|
||||||
|
conn.row_factory = sqlite3.Row
|
||||||
|
return conn
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@index_bp.route('/')
|
@index_bp.route('/')
|
||||||
def repage():
|
def repage():
|
||||||
return redirect(url_for('blog.home'))
|
return redirect(url_for('blog.home'))
|
||||||
@@ -14,4 +23,23 @@ def mirrors():
|
|||||||
|
|
||||||
@index_bp.route('/greet/<name>/')
|
@index_bp.route('/greet/<name>/')
|
||||||
def greet(name):
|
def greet(name):
|
||||||
return f'Hello, {name}!'
|
return f'Hello, {name}!'
|
||||||
|
|
||||||
|
@index_bp.route('/paint/')
|
||||||
|
def paint_home():
|
||||||
|
conn = get_paint_db_conn()
|
||||||
|
select_sql = "SELECT * FROM paint;"
|
||||||
|
data = conn.execute(select_sql).fetchall()
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
# 展示图片
|
||||||
|
img_url = "https://open-ww3-project.ww3.tw/blog/folders/paint/new/"
|
||||||
|
|
||||||
|
# 查询tags和class
|
||||||
|
db_cursor = sqlite3.connect(db_path).cursor()
|
||||||
|
tags_sql = "SELECT DISTINCT tags FROM paint;"
|
||||||
|
class_sql = "SELECT DISTINCT class FROM paint;"
|
||||||
|
|
||||||
|
for class_data in db_cursor.execute(class_sql).fetchall():
|
||||||
|
for tags_data in db_cursor.execute(tags_sql).fetchall():
|
||||||
|
return render_template('paint/home.html', data = data, tags_data = tags_data[0], class_data = class_data[0], img_url = img_url)
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<!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> -->
|
|
||||||
24
templates/blog/class.html
Normal file
24
templates/blog/class.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>分类页面 | ww3</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
this is Class_Page
|
||||||
|
<br>
|
||||||
|
<div>
|
||||||
|
<b>这里是用来存放关于分类的页面</b>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<b>lfs</b>
|
||||||
|
<br>
|
||||||
|
<b>自建linux</b>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: lightblue;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
<br>
|
<br>
|
||||||
来源: <a href="https://greendam.icu/">https://greendam.icu/</a>
|
来源: <a href="https://greendam.icu/">https://greendam.icu/</a>
|
||||||
</form>
|
</form>
|
||||||
<a href="./paint/">
|
<a href="/paint/">
|
||||||
<button>paint</button>
|
<button>paint</button>
|
||||||
</a>
|
</a>
|
||||||
<p style="margin: 870px 0 0 0; text-align: center; color: white;">
|
<p style="margin: 870px 0 0 0; text-align: center; color: white;">
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
{"id":1, "name": "首页", "url": url_for('blog.home')},
|
{"id":1, "name": "首页", "url": url_for('blog.home')},
|
||||||
{"id":2, "name": "关于", "url": url_for('blog.about')},
|
{"id":2, "name": "关于", "url": url_for('blog.about')},
|
||||||
{"id":3, "name": "文章", "url": url_for('blog.posts_list')},
|
{"id":3, "name": "文章", "url": url_for('blog.posts_list')},
|
||||||
{"id":4, "name": "mirrors", "url": url_for('blog.autoindex')},
|
{"id":4, "name": "folders", "url": url_for('blog.autoindex')},
|
||||||
{"id":5, "name": "study", "url": url_for('study.home')},
|
{"id":5, "name": "study", "url": url_for('study.home')},
|
||||||
]%}
|
]%}
|
||||||
<div id="navbar1">
|
<div id="navbar1">
|
||||||
@@ -16,4 +16,5 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
<a id="url_" href="https://api.ww3.tw">api</a>
|
<a id="url_" href="https://api.ww3.tw">api</a>
|
||||||
<a id="url_" href="https://gitea.ww3.tw">gitea</a>
|
<a id="url_" href="https://gitea.ww3.tw">gitea</a>
|
||||||
</div>
|
<a id="url_" href="./class">class</a>
|
||||||
|
</div>
|
||||||
|
|||||||
20
templates/blog/include/navbar2.html
Normal file
20
templates/blog/include/navbar2.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{# 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": "folders", "url": url_for('blog.autoindex')},
|
||||||
|
{"id":5, "name": "study", "url": url_for('study.home')},
|
||||||
|
]%}
|
||||||
|
<div id="navbar1">
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
<div id="navbar2" 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>
|
||||||
|
<a id="url_" href="./class">class</a>
|
||||||
|
</div>
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
{# 壁纸部分 #}
|
{# 壁纸部分 #}
|
||||||
{% set wallpaper_apis =[
|
{% set wallpaper_apis =[
|
||||||
'https://www.loliapi.com/acg/pc/',
|
'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://moe.jitsu.top/img/?sort=pc',
|
||||||
'https://www.dmoe.cc/random.php',
|
'https://www.dmoe.cc/random.php',
|
||||||
'https://api.mtyqx.cn/tapi/random.php'] %}
|
'https://api.mtyqx.cn/tapi/random.php'] %}
|
||||||
|
|||||||
53
templates/paint/home.html
Normal file
53
templates/paint/home.html
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{# 引入base #}
|
||||||
|
{% extends 'blog/extension/base.html' %}
|
||||||
|
|
||||||
|
{% include 'blog/include/head.html' %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{# 引入标题 #}
|
||||||
|
{% block title %}paint{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
hr {
|
||||||
|
background-color: black;
|
||||||
|
height: 2px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
#navbar2 {
|
||||||
|
font-size: 125%;
|
||||||
|
width: 500px;
|
||||||
|
height: auto;
|
||||||
|
background-color: rgb(169, 198, 252);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
{% include 'blog/include/navbar2.html' %}
|
||||||
|
</div>
|
||||||
|
<a href="/blog/">返回主页</a>
|
||||||
|
<h2>这里是关于本人的绘画学习及其临摹的记录和展示页面</h2>
|
||||||
|
<hr>
|
||||||
|
<a href="https://ww3.tw/blog/folders/paint/old">旧作列表</a>
|
||||||
|
<br>
|
||||||
|
{% for data in data %}
|
||||||
|
<br>
|
||||||
|
<img src="{{img_url}}{{data['date']}}/{{data['name']}}.jpg" alt="{{data['name']}}" width="15%">
|
||||||
|
<br>
|
||||||
|
{{data['name']}}__
|
||||||
|
{{data['date']}}
|
||||||
|
{% endfor %}
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<!-- tags: __{{tags_data}}
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
class: __{{class_data}} -->
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user