修复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:
53
examples/test_paths.py
Normal file
53
examples/test_paths.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
测试路径构建
|
||||
|
||||
验证rclone路径和CDN路径的正确构建。
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# 添加项目根目录到路径
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
from config_man.core import ConfigManager
|
||||
|
||||
|
||||
def main():
|
||||
"""测试路径构建"""
|
||||
print("测试路径构建")
|
||||
print("=" * 50)
|
||||
|
||||
# 创建配置管理器
|
||||
config_manager = ConfigManager()
|
||||
|
||||
# 测试不同版本的路径构建
|
||||
versions = ["0.29", "0.30"]
|
||||
platforms = ["android", "ios"]
|
||||
|
||||
print(f"存储配置:")
|
||||
print(f" rclone_remote: {config_manager.storage_config.get('rclone_remote', 'remote')}")
|
||||
print(f" storage_path: {config_manager.storage_path}")
|
||||
print()
|
||||
|
||||
print(f"CDN配置:")
|
||||
print(f" base_url: {config_manager.cdn_base_url}")
|
||||
print()
|
||||
|
||||
for version in versions:
|
||||
for platform in platforms:
|
||||
# 获取rclone路径
|
||||
rclone_path = config_manager.get_rclone_path(version, platform)
|
||||
|
||||
# 获取CDN URL
|
||||
cdn_url = config_manager.get_cdn_url(version, platform)
|
||||
|
||||
print(f"版本: {version}, 平台: {platform}")
|
||||
print(f"Rclone路径: {rclone_path}")
|
||||
print(f"CDN URL: {cdn_url}")
|
||||
print()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user