Skip to content

Commit f37ba98

Browse files
LightLight
authored andcommitted
feat: 实现功能
0 parents  commit f37ba98

File tree

112 files changed

+46085
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+46085
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Light
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<p align="center">
2+
<img src="img/[email protected]" />
3+
</p>
4+
5+
<h1 align="center">WebStack 网址导航 Typecho 主题</h1>
6+
7+
<p align="center">
8+
<a href="https://github.com/LightAPIs/WebStackTypechoTheme/releases/latest">
9+
<img src="https://img.shields.io/github/v/release/LightAPIs/WebStackTypechoTheme.svg?color=orange" alt="Release" />
10+
</a>
11+
<a href="./LICENSE">
12+
<img src="https://img.shields.io/badge/license-MIT-green.svg" alt="MIT License" />
13+
</a>
14+
</p>
15+
16+
> Typecho 网址导航主题
17+
18+
## 简介
19+
20+
这是一个基于开源项目[WebStack](https://github.com/WebStackPage/WebStackPage.github.io)[WebStack_钻芒二开版](https://github.com/wclk/WebStack_ZMKI)而制作的 Typecho 网址导航主题。
21+
22+
该项目主要是为了构建一个更适合~~~~个人使用的网址导航站点,一切从简,以简约实用为原则做个简单纯粹的网址导航。
23+
24+
因此对比一些其他的网址导航程序,本导航程序可能也更适合搭建在像 NAS 这样的私人服务器上面去使用。
25+
26+
## 预览
27+
28+
### 主页预览
29+
30+
- ![index_day](img/index_day.jpg)
31+
- ![index_dark](img/index_dark.jpg)
32+
33+
### 主题设置预览
34+
35+
- ![config](img/config.jpg)
36+
37+
## 安装
38+
39+
1. 前往 [Typecho](https://typecho.org/download) 下载 Typecho 博客程序,参照安装环境要求及[安装文档](http://docs.typecho.org/install),根据安装过程中的安装向导依次完成安装即可。
40+
2. 前往 [Releases](https://github.com/LightAPIs/WebStackTypechoTheme/releases/latest) 下载主题文件压缩包,解压得到 `WebStack` 目录,将其上传至服务器 Typecho 主题目录 `/usr/themes/`
41+
3. 在浏览器里打开 Typecho 后台页面(默认:`/admin/index.php`),点击"更换外观"进入外观设置页面,找到 WebStack Typecho Theme 主题并点击启用即可。此时回到博客首页便能看到导航主题效果了。
42+
43+
## 使用
44+
45+
### 添加分类
46+
47+
在后台的分类管理页面(默认:`/admin/manage-categories.php`)中可以添加或编辑分类,其对应导航页中左侧边栏里的菜单项,一般可以按照网址的类别来进行分类。
48+
49+
### 添加项目
50+
51+
在后台的文章管理页面(默认:`/admin/manage-posts.php`)中可以添加或编辑具体的网址导航项目。
52+
53+
![add](img/add.jpg)
54+
55+
其中可以填写的项目包括:
56+
57+
- 标题:即导航的标题
58+
- 跳转链接:即导航到的网址
59+
- 链接描述:可以补充一些关于该导航的信息描述
60+
- 链接 Logo:即导航显示的图标地址,也可以自行在附件中上传图标并将地址填入
61+
- 分类:选择导航网址的分类,不勾选则为默认分类
62+
- *排序:同分类下的导航项目默认按照创建时间进行排序,可以通过填写此值使该导航项目排序更靠前*(**注:该功能需要另外安装 [EnablePostsOrder](https://github.com/LightAPIs/EnablePostsOrder) 插件才能实现**)
63+
64+
### 主题设置
65+
66+
在后台的外观设置页面(默认:`/admin/options-theme.php`)中可以调整设置关于本主题的其他功能。
67+
68+
## 插件
69+
70+
一些提供功能增强的 Typecho 插件:
71+
72+
- [LightAPIs/EnablePostsOrder](https://github.com/LightAPIs/EnablePostsOrder):用于支持排序导航项目,推荐安装使用
73+
- [LightAPIs/EncryptYourSite](https://github.com/LightAPIs/EncryptYourSite):用于加密导航站点,若导航为私人使用且不想每个知道导航域名的都能看到站点内容,则可以安装使用该插件
74+
75+
## 相关项目
76+
77+
本项目的诞生离不开以下这些优秀的项目:
78+
79+
- [wclk/WebStack_ZMKI](https://github.com/wclk/WebStack_ZMKI)
80+
- [WebStackPage/WebStackPage.github.io](https://github.com/WebStackPage/WebStackPage.github.io)
81+
82+
## License
83+
84+
[MIT](./LICENSE) license

build.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# -*- coding: utf-8 -*-
2+
import os
3+
import tarfile
4+
import zipfile
5+
import argparse
6+
import json
7+
8+
9+
def make_zipfile(output_filename, source_dir, package_dir_name):
10+
with zipfile.ZipFile(output_filename, mode="w", compression=zipfile.ZIP_DEFLATED) as zf:
11+
for root, dirs, files in os.walk(source_dir):
12+
zf.write(root, os.path.join(package_dir_name, os.path.relpath(root, source_dir)))
13+
for file in files:
14+
filename = os.path.join(root, file)
15+
if os.path.isfile(filename):
16+
arcname = os.path.join(package_dir_name, os.path.relpath(filename, source_dir))
17+
zf.write(filename, arcname)
18+
19+
20+
if __name__ == "__main__":
21+
ap = argparse.ArgumentParser(description="打包项目")
22+
ap.add_argument("-s", "--src", required=False, help="自定义项目源文件所在目录")
23+
ap.add_argument("-i", "--info", required=False, help="自定义项目信息文件路径")
24+
25+
args = vars(ap.parse_args())
26+
build_dir = "build"
27+
print("************************************************")
28+
src_path = os.path.join(os.getcwd(), "src")
29+
if args["src"] and os.path.exists(args["src"]):
30+
src_path = args["src"]
31+
print("INFO:: 源文件路径: " + src_path)
32+
work_path = os.path.abspath(os.path.dirname(src_path))
33+
print("INFO:: 工作路径: " + work_path)
34+
35+
build_path = os.path.join(work_path, build_dir)
36+
if not os.path.exists(build_path):
37+
os.makedirs(build_path)
38+
39+
info_file = os.path.join(work_path, "info.json")
40+
if args["info"]:
41+
info_file = args["info"]
42+
if not os.path.exists(info_file):
43+
print("ERROR:: 没有找到需要打包的信息文件!")
44+
exit()
45+
46+
info = {"name": "unknow", "version": "0.1", "package": "src"}
47+
with open(info_file, encoding="utf-8") as load_f:
48+
info = json.load(load_f)
49+
50+
build_filename = info["name"] + "_v" + info["version"]
51+
print("INFO:: 打包文件名称: " + info["name"])
52+
print("INFO:: 打包文件版本: " + info["version"])
53+
print("INFO:: 压缩包根目录: " + info["package"])
54+
55+
build_tar_file = os.path.join(build_path, build_filename + ".tar.gz")
56+
if os.path.exists(build_tar_file):
57+
os.remove(build_tar_file)
58+
with tarfile.open(build_tar_file, mode="w:gz") as tar:
59+
tar.add(src_path, arcname=info["package"])
60+
print("INFO:: 打包 tar: " + src_path)
61+
tar.close()
62+
print("INFO:: 已经生成打包文件至: " + build_tar_file)
63+
64+
build_zip_file = os.path.join(build_path, build_filename + ".zip")
65+
if os.path.exists(build_zip_file):
66+
os.remove(build_zip_file)
67+
make_zipfile(build_zip_file, src_path, info["package"])
68+
print("INFO:: 已经生成打包文件至: " + build_zip_file)
69+
70+
print("SUCCESS:: 打包操作已经完成。")
71+
print("************************************************")

img/add.jpg

216 KB
Loading

img/config.jpg

289 KB
Loading

img/index_dark.jpg

347 KB
Loading

img/index_day.jpg

377 KB
Loading

img/logo.png

1.46 KB
Loading

img/[email protected]

3.58 KB
Loading

0 commit comments

Comments
 (0)