本项目是一个轻量级的导航页生成工具,旨在通过简单的 YAML 配置文件(conf.yml)动态生成美观的导航页面。用户可以轻松管理常用链接,并通过 Docker 容器和 Cloudflare 固定隧道实现本地或公网访问。
图标采用简化的熊猫脸部图案,底部新增的熊猫脸部以几何方式呈现,耳朵、眼斑与鼻部以黑白配色设计,富有辨识度但不具象。图案下方有象征着支持的设计,寓意着我妻子对项目的坚实支持与托举。整体风格仍保持扁平化设计,使用蓝白主调并加入黑白点缀,确保视觉平衡且富有情感深度。
conf.yml 生成响应式 HTML 页面,支持自定义标题、链接和图标。conf.yml,定义导航页标题和链接。
title: 我的导航页面
groups:
- name: 常用工具
links:
- name: Google
url: https://www.google.com
icon: https://www.google.com/favicon.ico
desc: 搜索引擎
- name: GitHub
url: https://github.com
icon: https://github.com/favicon.ico
desc: 代码托管平台
docker build --no-cache -t my-nav-image .
docker run -d --restart=unless-stopped -p 8080:8080 --name my-nav-container my-nav-image
conf.yml 后,重新运行脚本,或使用以下常用命令合集:
# 进入容器
docker exec -it wine bash
# 激活 / 退出 Python 虚拟环境
source /tmp/venv/bin/activate
. /tmp/venv/bin/activate
deactivate
# 修改文件权限
chown appuser:appuser /tmp/hfactive_private.py
chmod 664 /tmp/navpage/generate_nav.py
chmod +x /tmp/run_nav_update.sh
# 递归修改目录属主与权限
chown -R appuser:appuser /tmp/navpage
chmod -R u+rwX,go+rX /tmp/navpage
# 查看日志
cat /tmp/logs/hfactive.log
cat /var/log/cron.log
# 定时任务管理
crontab -u appuser -l
crontab -u appuser -e
# 测试文件
python /tmp/navpage/generate_nav.py
单次测试文件:su - appuser -c "/tmp/venv/bin/python3 /tmp/navpage/generate_nav.py"
单次测试.sh脚本:su - appuser -c "bash /tmp/run_nav_update.sh"
su - appuser -c "bash /tmp/wedav.sh"
su - appuser -c "bash /tmp/wedav_sub.sh"
su - appuser -c "bash /tmp/txt_to_html.sh"
# 写入文件(保持权限与属主)
cat /tmp/lun.txt | tee /etc/logrotate.d/cloudflared > /dev/null
rm /tmp/navpage/index.html.txt
nano /tmp/navpage/index.html.txt
cat /tmp/navpage/index.html.txt | tee /tmp/navpage/index.html > /dev/null
rm /tmp/navpage/conf.yml.txt
nano /tmp/navpage/conf.yml.txt
cat /tmp/navpage/conf.yml.txt | tee /tmp/navpage/conf.yml > /dev/null
rm /tmp/fetch_icons.sh.txt
nano /tmp/fetch_icons.sh.txt
cat /tmp/fetch_icons.sh.txt | tee /tmp/fetch_icons.sh > /dev/null
su - appuser -c "bash /tmp/fetch_icons.sh"
rm /tmp/update_hosts.sh.txt
nano /tmp/update_hosts.sh.txt
cat /tmp/update_hosts.sh.txt | tee /tmp/update_hosts.sh > /dev/null
su - appuser -c "bash /tmp/update_hosts.sh"
rm /tmp/download_from_github_gist.sh.txt
nano /tmp/download_from_github_gist.sh.txt
cat /tmp/download_from_github_gist.sh.txt | tee /tmp/download_from_github_gist.sh > /dev/null
su - appuser -c "bash /tmp/download_from_github_gist.sh"
rm /tmp/download_from_github_gist_tmp.sh.txt
nano /tmp/download_from_github_gist_tmp.sh.txt
cat /tmp/download_from_github_gist_tmp.sh.txt | tee /tmp/download_from_github_gist_tmp.sh > /dev/null
su - appuser -c "bash /tmp/download_from_github_gist_tmp.sh"
# 搜索引用
grep -r "index.html" /tmp/*.sh /tmp/navpage/*.py