Some checks failed
CD Pipeline / deploy (push) Failing after 59s
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml) - 部署模式: rsync Python 檔案至 188 → docker restart (volume mount) - Dockerfile/requirements 變動時自動重建 Docker image - 部署通知: Telegram (開始/成功/失敗) - 健康檢查: https://mo.wooo.work/health (最多 5 次重試) - 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
94 lines
2.7 KiB
Python
94 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
將導航列改為深灰色調,與淺色背景更協調
|
|
"""
|
|
import os
|
|
import re
|
|
from pathlib import Path
|
|
|
|
def apply_dark_gray_navbar(file_path):
|
|
"""將導航列改為深灰色調"""
|
|
try:
|
|
with open(file_path, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
original_content = content
|
|
|
|
# 將 bg-dark 改為自定義類別
|
|
content = re.sub(
|
|
r'<nav class="navbar navbar-expand-xl navbar-dark bg-dark([^"]*)"',
|
|
r'<nav class="navbar navbar-expand-xl navbar-dark bg-custom-dark\1"',
|
|
content
|
|
)
|
|
|
|
# 檢查是否需要添加自定義樣式
|
|
if 'bg-custom-dark' in content and '.navbar.bg-custom-dark' not in content:
|
|
# 在 </style> 之前添加自定義樣式
|
|
custom_navbar_style = """ /* Custom Dark Gray Navbar */
|
|
.navbar.bg-custom-dark {
|
|
background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
|
border-bottom: 1px solid rgba(255,255,255,0.1);
|
|
}
|
|
|
|
.navbar.bg-custom-dark .navbar-brand {
|
|
color: #ffffff;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.navbar.bg-custom-dark .navbar-nav .nav-link {
|
|
color: rgba(255, 255, 255, 0.85);
|
|
font-weight: 500;
|
|
}
|
|
|
|
.navbar.bg-custom-dark .navbar-nav .nav-link:hover {
|
|
color: #ffffff;
|
|
}
|
|
|
|
.navbar.bg-custom-dark .navbar-nav .nav-link.active {
|
|
color: #ffffff;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.navbar.bg-custom-dark .navbar-text {
|
|
color: rgba(255, 255, 255, 0.75);
|
|
}
|
|
|
|
"""
|
|
content = content.replace(' </style>', custom_navbar_style + ' </style>')
|
|
|
|
# 只有內容改變時才寫入
|
|
if content != original_content:
|
|
with open(file_path, 'w', encoding='utf-8') as f:
|
|
f.write(content)
|
|
return True
|
|
return False
|
|
|
|
except Exception as e:
|
|
print(f"處理 {file_path} 時發生錯誤: {e}")
|
|
return False
|
|
|
|
def main():
|
|
"""主程序"""
|
|
base_dir = Path(__file__).parent
|
|
html_files = list(base_dir.glob("*.html"))
|
|
|
|
updated_count = 0
|
|
|
|
print(f"找到 {len(html_files)} 個 HTML 文件")
|
|
print("=" * 60)
|
|
|
|
for html_file in html_files:
|
|
if apply_dark_gray_navbar(html_file):
|
|
print(f"✅ 已更新: {html_file.name}")
|
|
updated_count += 1
|
|
else:
|
|
print(f"⏭️ 跳過: {html_file.name}")
|
|
|
|
print("=" * 60)
|
|
print(f"✅ 完成!共更新 {updated_count} 個文件為深灰色導航列")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|