diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eb3caa..2cff0a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. See [standa ## Version 2026.10.30-it-tools-pro ### ✨ 新功能 +- **测速历史记录(多线路对比)**:每次测速完成自动记录时间、所走线路(公网中转/IPv6 直连)、下载/上传速度与到站延迟,以表格展示在测速卡片下方(仅存本机浏览器 localStorage,最多 20 条,可一键清空);切换 IPv6 直连前后各测一次即可直接对照两条线路差距 - **文档翻译支持扫描件/图片自动 OCR**:非纯文字文档(扫描版 PDF、截图、照片、带文字图片)先自动 OCR 识别文字再整篇翻译,扫描版 PDF 逐页渲染识别(单文档最多 30 页),图片可直接上传翻译;结果标注「已OCR识别 N 页」,页面附处理说明 - **修复「改版后用户看到旧页面」缓存问题**:nginx 对 `index.html`/`sw.js`/`manifest` 强制 `Cache-Control: no-cache, must-revalidate`(每次重新校验,杜绝 PWA 预缓存赖旧),对内容哈希静态资源 `immutable` 长缓存(加载更快),部署后无需用户强刷即见新版 - **新增「本机IP查询」**(`/my-ip`,Network 分组,免费不授权):仅显示**用户端**公网 IPv4/IPv6 地址与所属地(多源容错、中文归属地、一键复制),不显示服务器地址;IPv6 不支持时明示「不支持 IPv6」并给出五步开启教程 diff --git a/src/tools/my-ip/my-ip.vue b/src/tools/my-ip/my-ip.vue index 016f9fc..fa996be 100644 --- a/src/tools/my-ip/my-ip.vue +++ b/src/tools/my-ip/my-ip.vue @@ -268,6 +268,7 @@ async function runSpeedTest() { upMbps.value = Math.round((sent * 8) / uel / 1e4) / 100; spPct.value = 100; sp.value = 'done'; + pushSpeedRec(); // 记入本机测速历史,方便多线路对比 } catch (e: any) { sp.value = 'error'; spMsg.value = @@ -306,9 +307,65 @@ function grade(mbps: number): string { return '🐢 较慢:建议检查网络或更换线路'; } +// ---------- 测速历史(存本机浏览器 localStorage,按线路对比,最多 20 条) ---------- +const SPEED_HISTORY_KEY = 'itp_my_ip_speed_history'; +interface SpeedRec { + t: number; // 时间戳 + down: number; // 下载 Mbps + up: number; // 上传 Mbps + ms: number; // 到本站延迟 + route: 'IPv6 直连' | '公网中转'; // 测试时所走线路 + host: string; // 测试时的访问域名 +} +const speedHistory = ref([]); + +function loadSpeedHistory() { + try { + const arr = JSON.parse(localStorage.getItem(SPEED_HISTORY_KEY) || '[]'); + speedHistory.value = Array.isArray(arr) + ? arr.filter((r) => r && typeof r.down === 'number' && typeof r.t === 'number').slice(0, 20) + : []; + } catch { + speedHistory.value = []; + } +} + +function saveSpeedHistory() { + try { + localStorage.setItem(SPEED_HISTORY_KEY, JSON.stringify(speedHistory.value.slice(0, 20))); + } catch { + /* 隐私模式下写入失败则仅本次会话展示 */ + } +} + +function pushSpeedRec() { + speedHistory.value.unshift({ + t: Date.now(), + down: downMbps.value, + up: upMbps.value, + ms: serverMs.value ?? 0, + route: onV6Host ? 'IPv6 直连' : '公网中转', + host: location.host, + }); + speedHistory.value = speedHistory.value.slice(0, 20); + saveSpeedHistory(); +} + +function clearSpeedHistory() { + speedHistory.value = []; + saveSpeedHistory(); +} + +function fmtTime(t: number): string { + const d = new Date(t); + const p = (n: number) => String(n).padStart(2, '0'); + return `${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`; +} + onMounted(() => { loadIps(); runAllLatency(); + loadSpeedHistory(); }); @@ -429,6 +486,31 @@ onMounted(() => {
{{ spMsg }}
+ + +
+
+ 📋 测速历史(仅存于你的浏览器,共 {{ speedHistory.length }} 条,最多保留 20 条) + 清空历史 +
+
+
+ 时间 + 线路 + 下载 Mbps + 上传 Mbps + 延迟 ms +
+
+ {{ fmtTime(r.t) }} + {{ r.route }} + {{ r.down }} + {{ r.up }} + {{ r.ms }} +
+
+
对比方法:在当前线路测一次 → 点横幅「切换 IPv6 直连」再测一次,两条线路的下载/上传/延迟直接在表里对照。
+
@@ -794,11 +876,104 @@ onMounted(() => { margin-top: 10px; } +/* ---------- 测速历史 ---------- */ +.sp-history { + margin-top: 14px; + border: 1px solid var(--n-border, rgba(128, 128, 128, 0.25)); + border-radius: 10px; + padding: 10px 14px 12px; + background: rgba(128, 128, 128, 0.05); +} + +.sp-hist-head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + margin-bottom: 8px; + flex-wrap: wrap; + + .sp-hist-t { + font-size: 14px; + font-weight: 600; + } +} + +.sp-hist-table { + font-size: 13.5px; + + .sp-hrow { + display: grid; + grid-template-columns: 1.1fr 1.1fr 1fr 1fr 0.9fr; + gap: 6px; + padding: 6px 4px; + align-items: center; + border-bottom: 1px dashed rgba(128, 128, 128, 0.2); + + &:last-child { + border-bottom: none; + } + + &.sp-hhead { + font-weight: 600; + opacity: 0.75; + font-size: 12.5px; + border-bottom: 1px solid rgba(128, 128, 128, 0.3); + } + + .c-down { + color: #18a058; + font-weight: 600; + font-variant-numeric: tabular-nums; + } + + .c-up { + color: #2080f0; + font-weight: 600; + font-variant-numeric: tabular-nums; + } + + .c-ms { + font-variant-numeric: tabular-nums; + } + } +} + +.tag-v4, +.tag-v6 { + font-style: normal; + font-size: 12px; + padding: 1px 8px; + border-radius: 999px; + white-space: nowrap; +} + +.tag-v4 { + background: rgba(32, 128, 240, 0.14); + color: #2080f0; +} + +.tag-v6 { + background: rgba(24, 165, 88, 0.15); + color: #18a058; +} + +.sp-hist-tip { + margin-top: 8px; + font-size: 12.5px; + opacity: 0.7; + line-height: 1.6; +} + @media (max-width: 900px) { .sec-head { h3 { width: 100%; } } + .sp-hist-table .sp-hrow { + grid-template-columns: 1fr 1fr 1fr 1fr 0.8fr; + font-size: 12.5px; + } }