feat: 沙香科技官网 v2.2 基线(深色科技风/双语/局域网+公网双部署)

This commit is contained in:
dafe
2026-11-02 14:57:08 +08:00
commit 924bca9f98
91 changed files with 1632 additions and 0 deletions

25
tools/deploy.sh Normal file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
# 官网统一部署脚本:bump 静态资源版本号(击穿浏览器缓存)+ 同步双服务器
# 用法: bash tools/deploy.sh
set -euo pipefail
cd "$(dirname "$0")/.."
STAMP=$(date "+%Y%m%d%H%M")
# bump 资源版本参数:HTML 更新(no-cache)会带新 URL,旧缓存自然失效
python3 - "$STAMP" <<'PYEOF'
import re, sys
stamp = sys.argv[1]
path = 'index.html'
html = open(path, encoding='utf-8').read()
# 正则一次性规范化:无论已有无版本参数,统一替换为当前时间戳
html = re.sub(r'assets/css/style\.css(?:\?v=\d+)?\d*', 'assets/css/style.css?v=' + stamp, html)
html = re.sub(r'assets/js/main\.js(?:\?v=\d+)?\d*', 'assets/js/main.js?v=' + stamp, html)
open(path, 'w', encoding='utf-8').write(html)
PYEOF
echo "[deploy] 版本号 ${STAMP},同步公网 + 局域网"
# 注意:assets 不带尾斜杠(带斜杠会把目录拍平,曾导致整站 404)
rsync -a --delete index.html assets ubuntu3:/var/www/shashann-homepage/
rsync -a --delete index.html assets ubuntu:/home/ubuntu/homepage-site/
echo "[deploy] 完成: https://www.shashann.com/ 与 https://192.168.51.66/homepage/"