v0.3.23: 去重 — 删除重复模块,统一为单一实现+调用

修复的重复:
- 删除 src/utils/qr-login.service.ts(与 src/cloud/ 完全一致)
- qr-login.service.ts 本地 formatBytes → import { formatBytes } from quark-api
- daily-report.service.ts 本地 CLOUD_LABELS → import from cloud-constants
- 新增 cloudLabel() 本地映射(短标签 vs cloud-constants 全名)

确认无其他重复: 文件级(utils vs cloud)、函数级(export function)、字节解析
This commit is contained in:
2026-05-17 17:59:23 +08:00
parent f9338e5906
commit 1fd64e0788
5 changed files with 7 additions and 423 deletions

View File

@@ -20,6 +20,7 @@ const SESSION_TTL = 5 * 60 * 1000; // 5 minutes
const COOKIE_CHECK_INTERVAL = 1500; // 1.5s between cookie checks
import config from '../config';
import { formatBytes } from './drivers/quark-api';
const CHROMIUM_PATH = config.chromiumPath;
// Clean up old sessions periodically
@@ -393,13 +394,6 @@ export async function getQrLoginStatus(sessionId: string): Promise<{
return { status: session.status };
}
function formatBytes(bytes: number): string {
if (bytes === 0) return '0 B';
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(1024));
return parseFloat((bytes / Math.pow(1024, i)).toFixed(2)) + ' ' + sizes[i];
}
/**
* Cancel a QR login session.
*/