修复CDN URL和路径构建逻辑

- 修复CDN URL构建,正确处理路径重复问题
- 修复rclone路径构建,使用正确的格式: {rclone_remote}:{storage_path}/{version_path}/{filename}
- 修复CDN路径构建,使用正确的格式: {cdn_base_url}/{version_path}/{filename}
- 修复CDN内容解密处理,支持加密和解密后的内容
- 添加路径构建测试示例
- 完善错误处理和空内容处理
This commit is contained in:
2025-08-07 18:03:16 +08:00
parent 4cb6c4eab7
commit 9eddb3133c
13 changed files with 675 additions and 32 deletions

View File

@@ -4,6 +4,7 @@ from rich.table import Table
from rich.panel import Panel
from rich.text import Text
import json
from ..utils.config import config
class DisplayManager:
@@ -11,6 +12,7 @@ class DisplayManager:
def __init__(self):
self.console = Console()
self.display_config = config.get_display_config()
def display_config_comparison(self, version: str, platform: str,
storage_config: Dict, cdn_config: Dict,
@@ -29,16 +31,17 @@ class DisplayManager:
table.add_column("状态", style="red", width=10)
# 添加数据行
truncate_length = self.display_config.get('truncate_length', 25)
for key, data in differences.items():
storage_value = str(data["storage"])
cdn_value = str(data["cdn"])
status = "❌ 不同" if data["different"] else "✅ 一致"
# 截断过长的值
if len(storage_value) > 25:
storage_value = storage_value[:22] + "..."
if len(cdn_value) > 25:
cdn_value = cdn_value[:22] + "..."
if len(storage_value) > truncate_length:
storage_value = storage_value[:truncate_length-3] + "..."
if len(cdn_value) > truncate_length:
cdn_value = cdn_value[:truncate_length-3] + "..."
table.add_row(key, storage_value, cdn_value, status)