Compare commits

...
Author SHA1 Message Date
jinghui f420785887 feat(buy): 站内支付页 /buy — 支付成功当场显示卡密;三处购买入口统一改指站内
- 新增 /buy 支付页:读本机机器码、列本项目可售套餐、支付宝/微信/QQ钱包、优惠码选填;
  拉起收银台后本页留守轮询,支付成功显示卡密并自动核验授权
- 购买入口改造:顶栏「永久解锁 13 个功能」、锁定弹窗「购买授权」、授权应用页
  「前往购买卡密」三处统一跳转站内 /buy(原跳外部 auth.88531.cn/#/shop)
- CardAuth 后端:订单支付完成时补发卡密写回订单(原带机器码下单只建授权不发卡)
- CHANGELOG 新增 Version 2026.11.11-it-tools-pro
2026-11-11 18:21:26 +08:00
3970260761 7b22e53d1a fix(layout): IPv6按钮顶栏内正常排版不遮挡 + 窄屏收缩;relay/my-ip/用户菜单等本次改动入库 2026-11-11 15:03:56 +08:00
jinghui ea4e3deb50 docs: README 补充 Docker Compose 部署方式(方式二)
粘贴完整 docker-compose.yml(含全部参数)并给出 up 命令;保留原有 docker run 说明。
2026-11-08 01:45:19 +08:00
personal827 b4c4f5de8a feat(my-ip): 代理/VPN检测(proxycheck.io出口归属判定+WebRTC泄漏实测+本机内网IP) 2026-11-01 11:49:37 +08:00
16 changed files with 2092 additions and 113 deletions

No files matched your search

+10
View File
@@ -2,9 +2,19 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## Version 2026.11.11-it-tools-pro
### 📦 本次更新(2026-11-11)
- **站内支付页 `/buy`(本次核心)**:新增独立支付页——自动读取本机机器码,直接列出本项目可购套餐(名称/价格/时长)、支持支付宝 / 微信支付 / QQ 钱包三种方式、优惠码选填;点击「立即支付」拉起收银台(新标签打开,本页留守轮询),**支付成功当场显示卡密**并自动核验授权,13 个高级功能立即解锁,全程无需人工发货、无需跳出本站
- **购买入口全部改指 `/buy`**:顶栏浮条「永久解锁 13 个功能」、试用用尽锁定弹窗的「购买授权」、授权应用页的「💳 前往购买卡密」,三处统一跳转站内支付页(原先跳外部 `auth.88531.cn/#/shop`);页面未登录即可访问,支付状态本机留存,刷新/误关后自动恢复轮询
- **CardAuth 后端补发卡**:订单支付完成时同步签发一张卡密并写回订单(原先「带机器码下单」只创建授权、不发卡,导致订单查不到卡密、支付结果页无卡可显示);优先取卡池未用卡,卡池不足自动新建,并绑定下单机器码
## Version 2026.11.01-it-tools-pro
### 📦 本次更新(2026-11-01)
- **顶栏排版修复**:「⚡ IPv6 直连」按钮改为顶栏内正常排列(不再绝对定位悬浮),与「授权应用」等控件不重叠;窄屏(≤900px)自动收缩为纯图标并收紧间距,任何窗口宽度都不溢出、不遮挡
- **热门地点扩容 + 测速历史快照**:热门地点延迟新增「百度」与「本省·运营商门户」(按你的 IPv4 归属自动匹配联通 10010 / 电信 189 / 移动 10086 / 广电 10099,悬停显示完整运营商与省份,未知运营商不插行);测速历史表新增「热门地点延迟快照」列——每次测速自动附带当时全部地点延迟(百度/本省运营商/镜像站/海外),跨线路、跨时间直接对照
- **代理 / VPN 检测**(免费不授权):本机IP查询页新增检测区——出口 IP 归属判定(proxycheck.io 数据库,区分家庭宽带/VPN/代理/数据中心/企业网络,IPv4+IPv6 分别判定)+ WebRTC STUN 泄漏实测(浏览器实测公网候选地址,若与主 IP 不一致则提示可能的真实出口,另显示本机内网 IP);浏览器无法直读系统代理开关,判定仅供参考,可一键重新检测
- **本机IP查询**(`/my-ip`,免费不授权):打开即显示**用户自己设备**的公网 IPv4 / IPv6 地址与中文归属地(多源容错、一键复制、不显示任何服务器信息);自动测量到 9 个热门地点(本站/清华TUNA/阿里云/腾讯云/华为云/中科大/香港Fedora/日本JAIST/Cloudflare)的延迟
- **IPv6 直连通道**:新增 `itv6.88531.cn`(4443 端口,双栈 nginx + DDNS);支持 IPv6 的用户页面横幅一键切换直连,访问速度更快;不支持的用户给出五步开启教程
- **网速测试**:测量**你到本站服务器**的真实吞吐(下载/上传/到站延迟),走当前访问线路,浏览器真实收发计时(relay 新增 `/relay/speed` 端点),约 13MB 流量
+72
View File
@@ -84,6 +84,78 @@ docker run -d --name it-tools --restart always --network ittools-net -p 8080:80
**不启动第三步也完全能用**,只是翻译/OCR/格式转换这几个高级功能会显示试用/授权提示,免费工具不受任何影响。
> 注意:relay 与工具站必须在同一 Docker 网络(ittools-net),且先启动 relay 再启动工具站。
### 方式二:Docker Compose部署
上面三步 `docker run` 的等价编排(含全部参数)。前置要求不变:先 `pnpm install && pnpm build` 生成 `dist/`;`docker/it-tools-relay` 的 Dockerfile 需要 `hf-cache/`、`piper-models/`、`ai-models/`、`waifu2x/` 四个模型目录(未入库),没有的话把 relay 的 `build:` 换成现成镜像 `image: 192.168.68.19:3200/jinghui/it-tools-relay:latest`。
```yaml
services:
it-tools-relay:
build: ./docker/it-tools-relay
image: it-tools-relay:latest
container_name: it-tools-relay
restart: always
ports:
- "8091:8091"
env_file:
- ./docker/it-tools-relay/.env
volumes:
- relay-data:/app/data
networks:
- ittools-net
it-tools:
build: .
image: it-tools:custom
container_name: it-tools
restart: always
depends_on:
- it-tools-relay
ports:
- "8080:80"
extra_hosts:
# nginx 反代宿主机上的 rapidocr(5000) / iopaint(8060) 需要
- "host.docker.internal:host-gateway"
networks:
- ittools-net
# 可选:本地 OCR 加速(不部署则图片OCR/PDF文字识别不可用)
# rapidocr:
# image: rapidocr/rapidocr:latest
# container_name: rapidocr
# restart: always
# ports:
# - "5000:5000"
#
# 可选:AI 修图(去水印/抠图/超分/人脸修复)
# iopaint:
# image: sanster/iopaint:latest
# container_name: iopaint
# restart: always
# ports:
# - "8060:8060"
# volumes:
# - iopaint-models:/root/.cache
volumes:
relay-data:
# iopaint-models:
networks:
ittools-net:
driver: bridge
```
```bash
git clone http://192.168.68.19:3200/jinghui/it-tools-pro.git
cd it-tools-pro
pnpm install && pnpm build # 生成 dist/(Dockerfile 不做前端构建)
cd docker/it-tools-relay && cp .env.example .env && cd ../.. # 填 CardAuth 地址与密钥
docker compose up -d --build
```
打开 `http://服务器IP:8080`。只起工具站、不要 relay 时用 `docker compose up -d it-tools`(翻译/OCR/格式转换会显示试用提示,免费工具不受影响)。
### 可选:本地 OCR / AI 修图模型后端
| 服务 | 端口 | 用途 |
+1
View File
@@ -29,6 +29,7 @@ declare module '@vue/runtime-core' {
Bcrypt: typeof import('./src/tools/bcrypt/bcrypt.vue')['default']
BenchmarkBuilder: typeof import('./src/tools/benchmark-builder/benchmark-builder.vue')['default']
Bip39Generator: typeof import('./src/tools/bip39-generator/bip39-generator.vue')['default']
'Buy.page': typeof import('./src/pages/Buy.page.vue')['default']
CAlert: typeof import('./src/ui/c-alert/c-alert.vue')['default']
'CAlert.demo': typeof import('./src/ui/c-alert/c-alert.demo.vue')['default']
CameraRecorder: typeof import('./src/tools/camera-recorder/camera-recorder.vue')['default']
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -385,7 +385,7 @@ tools:
my-ip:
title: My IP address
description: Check your device's public IPv4/IPv6 address and location (with an IPv6 setup guide when unsupported). This site supports IPv6 direct connection. Measure latency to popular places and test your download/upload speed to this server.
description: Check your device's public IPv4/IPv6 address and location (with an IPv6 setup guide when unsupported). Detects proxy/VPN via egress IP database and WebRTC leak test. This site supports IPv6 direct connection. Measure latency to popular places and test your download/upload speed to this server with history.
hash-text:
title: Hash text
+1 -1
View File
@@ -381,7 +381,7 @@ tools:
my-ip:
title: 本机IP查询
description: 查询你设备的公网IPv4/IPv6地址与所属地(IPv6不支持时提供开启教程),本站已支持IPv6直连,测连接热门地点延迟,一键测试你到本站服务器的下载/上传网速。
description: 查询你设备的公网IPv4/IPv6地址与所属地(IPv6不支持时提供开启教程),代理/VPN检测(出口IP归属判定+WebRTC泄漏实测),热门地点延迟实测(百度、本省运营商门户、全国镜像站与海外节点),测速历史自动记录延迟快照,本站已支持IPv6直连,一键测试你到本站服务器的下载/上传网速。
hash-text:
title: Hash 文本
+49 -67
View File
@@ -7,76 +7,34 @@ import { useCloudSync } from '@/composable/cloud-sync';
const { isLoggedIn, username, isAdmin, login, register, logout } = useUserAuth();
const { syncNow } = useCloudSync();
// ---- Cloudflare Turnstile ----
const CF_SITEKEY = '0x4AAAAAAFUO0U-CvL78Vr6y';
const cfToken = ref('');
const cfReady = ref(false);
let cfWidgetId = '';
// ---- 本地图片验证码(服务端出图,不依赖外网) ----
const captchaId = ref('');
const captchaImg = ref('');
const captchaCode = ref('');
declare global {
interface Window {
turnstile?: any;
__cfOnload?: () => void;
}
}
function loadTurnstileScript(): Promise<void> {
if (window.turnstile) {
return Promise.resolve();
}
return new Promise((resolve) => {
window.__cfOnload = () => resolve();
const s = document.createElement('script');
s.src = 'https://challenges.cloudflare.com/turnstile/v0/api.js?onload=__cfOnload&render=explicit';
s.async = true;
document.head.appendChild(s);
});
}
function resetCf() {
cfToken.value = '';
if (window.turnstile && cfWidgetId) {
try {
window.turnstile.reset(cfWidgetId);
async function loadCaptcha() {
captchaCode.value = '';
try {
const res = await fetch('/relay/user/captcha');
const body = await res.json().catch(() => ({} as any));
if (body?.code === 200 && body.data?.id) {
captchaId.value = body.data.id;
captchaImg.value = `data:image/png;base64,${body.data.img}`;
}
catch { /* ignore */ }
}
}
async function mountCf() {
await loadTurnstileScript();
// wait until container is in DOM (modal just opened)
await new Promise(r => setTimeout(r, 80));
const el = document.querySelector('.cf-container');
if (!el || cfWidgetId) {
return;
}
cfWidgetId = window.turnstile.render(el as HTMLElement, {
sitekey: CF_SITEKEY,
theme: 'light',
size: 'flexible',
callback: (token: string) => {
cfToken.value = token;
},
'expired-callback': () => {
cfToken.value = '';
},
'error-callback': () => {
cfToken.value = '';
},
});
cfReady.value = true;
catch { /* 静默:提交时服务端会再校验 */ }
}
const showLogin = ref(false);
watch(showLogin, (v) => {
if (v) {
mountCf().catch(() => {});
loadCaptcha().catch(() => {});
}
else {
cfWidgetId = '';
cfToken.value = '';
captchaId.value = '';
captchaImg.value = '';
captchaCode.value = '';
}
});
const mode = ref<'login' | 'register'>('login');
@@ -105,10 +63,10 @@ async function submit() {
busy.value = true;
try {
if (mode.value === 'login') {
await login(formUser.value.trim(), formPass.value, cfToken.value);
await login(formUser.value.trim(), formPass.value, captchaId.value, captchaCode.value.trim());
}
else {
await register(formUser.value.trim(), formPass.value, cfToken.value);
await register(formUser.value.trim(), formPass.value, captchaId.value, captchaCode.value.trim());
}
showLogin.value = false;
formPass.value = '';
@@ -119,7 +77,8 @@ async function submit() {
}
catch (e: any) {
error.value = String(e?.message || e);
resetCf();
// 验证码单次有效,失败后必须换一张
loadCaptcha().catch(() => {});
}
finally {
busy.value = false;
@@ -182,8 +141,10 @@ function switchMode() {
<input v-model="formPass" class="user-input" type="password" placeholder="密码(至少 6 位)" :autocomplete="mode === 'login' ? 'current-password' : 'new-password'" @keyup.enter="submit">
<input v-if="mode === 'register'" v-model="formPass2" class="user-input" type="password" placeholder="确认密码" autocomplete="new-password" @keyup.enter="submit">
<div class="cf-wrap" :style="{ opacity: cfToken ? 0.4 : 1 }">
<div class="cf-container" />
<div class="captcha-row">
<input v-model="captchaCode" class="user-input captcha-input" placeholder="验证码(4位)" autocomplete="off" @keyup.enter="submit">
<img v-if="captchaImg" class="captcha-img" :src="captchaImg" alt="验证码" title="点击换一张" @click="loadCaptcha">
<a v-else href="javascript:;" class="captcha-reload" @click="loadCaptcha">获取验证码</a>
</div>
<div v-if="error" class="user-error">
@@ -198,7 +159,7 @@ function switchMode() {
<c-button size="small" @click="showLogin = false">
取消
</c-button>
<c-button size="small" type="primary" ml-8px :disabled="busy || !formUser || !formPass || !cfToken" @click="submit">
<c-button size="small" type="primary" ml-8px :disabled="busy || !formUser || !formPass || !captchaCode.trim() || !captchaId" @click="submit">
{{ busy ? '请稍候…' : (mode === 'login' ? '登录' : '注册并登录') }}
</c-button>
</div>
@@ -263,9 +224,30 @@ function switchMode() {
}
}
.cf-wrap {
.captcha-row {
display: flex;
gap: 8px;
align-items: center;
margin: 2px 0 8px;
transition: opacity 0.2s;
.captcha-input {
flex: 1;
margin: 0;
}
.captcha-img {
height: 40px;
border-radius: 4px;
cursor: pointer;
flex-shrink: 0;
}
.captcha-reload {
flex-shrink: 0;
font-size: 13px;
color: #18a058;
white-space: nowrap;
}
}
.user-mask {
+4 -4
View File
@@ -52,11 +52,11 @@ export function useUserAuth() {
const username = computed(() => state.value?.username ?? '');
const isAdmin = computed(() => state.value?.role === 'admin');
async function login(u: string, p: string, cfToken = '') {
async function login(u: string, p: string, captchaId = '', captchaCode = '') {
const { status, body } = await apiFetch('/user/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json', ...licenseHeaders() },
body: JSON.stringify({ username: u, password: p, cf_token: cfToken }),
body: JSON.stringify({ username: u, password: p, captcha_id: captchaId, captcha_code: captchaCode }),
});
if (status !== 200) {
throw new Error(body.message || '登录失败');
@@ -66,11 +66,11 @@ export function useUserAuth() {
return body.data.username;
}
async function register(u: string, p: string, cfToken = '') {
async function register(u: string, p: string, captchaId = '', captchaCode = '') {
const { status, body } = await apiFetch('/user/register', {
method: 'POST',
headers: { 'Content-Type': 'application/json', ...licenseHeaders() },
body: JSON.stringify({ username: u, password: p, cf_token: cfToken }),
body: JSON.stringify({ username: u, password: p, captcha_id: captchaId, captcha_code: captchaCode }),
});
if (status !== 200) {
throw new Error(body.message || '注册失败');
+87
View File
@@ -49,6 +49,51 @@ const tools = computed<ToolCategory[]>(() => [
...toolsByCategory.value,
]);
// ---- 全站 IPv6 切换(公网入口 it.88531.cn ⇄ itv6.88531.cn:4443) ----
const V6_HOST = 'itv6.88531.cn';
const V6_PORT = 4443;
const onV6Host = ref(location.hostname === V6_HOST);
const onPublicHost = ['it.88531.cn', V6_HOST].includes(location.hostname);
const v6ok = ref(false);
const v6Switching = ref(false);
async function probeV6() {
// 结果缓存 10 分钟,避免每次开页都探测
try {
const c = JSON.parse(localStorage.getItem('it_v6_probe') || 'null');
if (c && typeof c.ok === 'boolean' && Date.now() - (c.ts || 0) < 600000) {
v6ok.value = c.ok;
return;
}
}
catch { /* 探测 */ }
let ok = false;
try {
const ctl = new AbortController();
const timer = setTimeout(() => ctl.abort(), 4000);
// api6.ipify.org 仅 AAAA:能连通即说明本机有 IPv6 出口
const r = await fetch('https://api6.ipify.org?format=json', { signal: ctl.signal, cache: 'no-store' });
clearTimeout(timer);
const j = await r.json();
ok = typeof j?.ip === 'string' && j.ip.includes(':');
}
catch { ok = false; }
v6ok.value = ok;
try { localStorage.setItem('it_v6_probe', JSON.stringify({ ok, ts: Date.now() })); }
catch { /* ignore */ }
}
function switchV6() {
if (v6Switching.value) {
return;
}
v6Switching.value = true;
const path = location.pathname + location.search + location.hash;
location.href = onV6Host.value
? `https://it.88531.cn${path}`
: `https://${V6_HOST}:${V6_PORT}${path}`;
}
// 右下角回到顶部火箭
const showTop = ref(false);
// 页面可能有多层 .n-layout-scroll-container(嵌套 n-layout),外层往往不滚、内层才滚;
@@ -70,6 +115,9 @@ function bindTopScroll() {
});
}
onMounted(() => {
if (onPublicHost) {
probeV6().catch(() => {});
}
// 等布局渲染后再绑定滚动容器(内层容器可能晚于挂载出现,多试几次)
let tries = 0;
const timer = setInterval(() => {
@@ -157,6 +205,24 @@ onBeforeUnmount(() => {
</c-button>
</RouterLink>
</c-tooltip>
<!-- 全站右上角:IPv6 直连切换(仅公网域名且探测到本机有 IPv6 时显示) -->
<c-tooltip
v-if="onV6Host || v6ok"
position="bottom"
:tooltip="onV6Host ? '当前 IPv6 直连入口,点击切回 IPv4 中转' : '检测到你的网络支持 IPv6,点击切换 IPv6 直连加速'"
>
<c-button
round
class="v6-switch"
:bordered="false"
:disabled="v6Switching"
@click="switchV6"
>
<template v-if="onV6Host">⇄ IPv4</template>
<template v-else>⚡ <span class="v6-text">IPv6 直连</span></template>
</c-button>
</c-tooltip>
</div>
<slot />
@@ -282,6 +348,27 @@ onBeforeUnmount(() => {
}
// 顶部导航:滚动时固定在最顶部(sticky),通栏贴顶遮挡滚动内容
.v6-switch {
// 顶栏内正常排版(紧跟「授权应用」之后),不悬浮、不遮挡
font-size: 13px;
white-space: nowrap;
flex-shrink: 0;
}
@media (max-width: 900px) {
// 窄屏顶栏放不下完整文字时收缩为纯图标,并收紧间距,避免溢出右边缘
.top-nav {
gap: 4px;
}
.v6-switch {
.v6-text {
display: none;
}
padding-left: 8px;
padding-right: 8px;
}
}
.top-nav {
position: sticky;
// -26px 抵消滚动容器 padding-top 内缩,使导航真正贴到视口最顶(0)
+1 -1
View File
@@ -35,7 +35,7 @@ const groups: { title: string; items: Item[] }[] = [
{
title: '原创工具',
items: [
{ name: '本机IP查询', icon: '网', desc: '仅显示你设备的公网IPv4/IPv6地址与所属地(多源容错+中文归属地+一键复制),IPv6不支持时明示并给出开启教程,本站已支持IPv6直连(速度更快),网速测试为你的设备↔本站服务器真实收发计时,进入页面自动测9个热门地点延迟', tag: '全新' },
{ name: '本机IP查询', icon: '网', desc: '仅显示你设备的公网IPv4/IPv6地址与所属地(多源容错+中文归属地+一键复制),代理/VPN检测(出口IP归属判定+WebRTC泄漏实测+内网IP),热门地点延迟实测(百度、本省运营商门户按归属自动匹配、全国镜像站+海外节点),测速历史自动记录各地点延迟快照(跨线路/跨时间对照),IPv6不支持时明示并给出开启教程,本站已支持IPv6直连(速度更快),网速测试为你的设备↔本站服务器真实收发计时', tag: '全新' },
{ name: 'Base64图片互转', icon: 'B', desc: 'Base64转图片与图片转Base64合一页双 Tab:三种输入形态(裸串/data:URI/CSS url())自动识别、图片类型魔数嗅探、输出三档格式实时切换、互转按钮带结果闭环跳转,纯浏览器本地不上传', tag: '全新' },
{ name: '批量条码生成', icon: '条', desc: 'EAN/UPC/Code128/Code39/DataMatrix 等 12 种码制,批量生成、打包下载,尺寸颜色字号可调', tag: '全新' },
{ name: '二维码条码识别与生成', icon: '扫', desc: '识别:上传/拖拽/粘贴一键解码(多码混合批量输出,本地 WASM 不上传);生成:自定义前景/背景颜色、中间插入本地 Logo 图片,生成后自动自扫验证可下载 PNG', tag: '全新' },
+702
View File
@@ -0,0 +1,702 @@
<script setup lang="ts">
import { useHead } from '@vueuse/head';
import { AUTH_BASE, getMachineId, licenseState, checkAuth } from '@/tools/license/license';
useHead({ title: '购买卡密 - IT-TOOLS-PRO' });
const PROJECT_ID = 6;
const ORDER_KEY = 'it-tools-buy-order';
const POLL_MS = 5000;
interface CardType {
id: number;
name: string;
description: string;
duration_days: number;
price: string;
original_price: string;
}
const machineId = ref('');
const loading = ref(true);
const loadErr = ref('');
const plans = ref<CardType[]>([]);
const selPlan = ref<CardType | null>(null);
const payType = ref('alipay');
const couponCode = ref('');
const ordering = ref(false);
const errMsg = ref('');
const orderNo = ref('');
const payUrl = ref('');
const orderStatus = ref<'pending' | 'paid' | 'expired' | ''>('');
const waitingPay = ref(false);
const cardKey = ref('');
const paidAt = ref('');
const authMsg = ref('');
const copied = ref<'machine' | 'card' | ''>('');
const PAY_METHODS = [
{ key: 'alipay', label: '支付宝', icon: '💳' },
{ key: 'wxpay', label: '微信支付', icon: '💚' },
{ key: 'qqpay', label: 'QQ 钱包', icon: '🐧' },
];
let timer: ReturnType<typeof setInterval> | null = null;
function fmtDays(d: number): string {
if (d >= 999999) return '永久有效';
if (d >= 365) return `${Math.floor(d / 365)} 年`;
if (d >= 30) return `${Math.floor(d / 30)} 个月`;
return `${d} 天`;
}
async function loadPlans(): Promise<void> {
loading.value = true;
loadErr.value = '';
try {
const res = await fetch(`${AUTH_BASE}/public/projects/${PROJECT_ID}/card-types`);
const j = await res.json();
if (j.code !== 200) throw new Error(j.message || '获取套餐失败');
plans.value = (j.data || []) as CardType[];
if (plans.value.length && !selPlan.value) selPlan.value = plans.value[0];
} catch (e: any) {
loadErr.value = e?.message || '加载失败,请刷新重试';
} finally {
loading.value = false;
}
}
function copyText(text: string, tag: 'machine' | 'card'): void {
navigator.clipboard?.writeText(text).then(() => {
copied.value = tag;
setTimeout(() => {
if (copied.value === tag) copied.value = '';
}, 1600);
});
}
function stopPoll(): void {
if (timer) {
clearInterval(timer);
timer = null;
}
waitingPay.value = false;
}
async function pollOnce(): Promise<void> {
if (!orderNo.value) return;
try {
const res = await fetch(
`${AUTH_BASE}/public/orders/query?order_no=${encodeURIComponent(orderNo.value)}`
);
const j = await res.json();
if (j.code !== 200) return;
const d = j.data || {};
orderStatus.value = d.status || '';
if (d.status === 'paid') {
stopPoll();
cardKey.value = d.card_key || '';
paidAt.value = d.paid_at || '';
await refreshAuth();
} else if (d.status === 'expired') {
stopPoll();
errMsg.value = '订单已过期,请重新下单';
}
} catch {
/* 网络抖动忽略,继续轮询 */
}
}
function startPoll(): void {
stopPoll();
waitingPay.value = true;
pollOnce();
timer = setInterval(pollOnce, POLL_MS);
}
async function refreshAuth(): Promise<void> {
authMsg.value = '正在核验授权…';
try {
const ok = await checkAuth();
authMsg.value = ok ? '授权已生效,13 个高级功能已解锁' : '卡密已发放,授权暂未刷新,请点击下方重新核验';
} catch {
authMsg.value = '授权核验失败,请稍后重试';
}
}
async function buy(): Promise<void> {
errMsg.value = '';
if (!selPlan.value) {
errMsg.value = '请先选择套餐';
return;
}
ordering.value = true;
try {
const body: Record<string, any> = {
project_id: PROJECT_ID,
card_type_id: selPlan.value.id,
pay_type: payType.value,
bot_qq: machineId.value,
contact_qq: machineId.value,
};
if (couponCode.value.trim()) body.coupon_code = couponCode.value.trim();
const res = await fetch(`${AUTH_BASE}/public/orders`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
const j = await res.json();
if (j.code !== 200) throw new Error(j.message || '下单失败');
orderNo.value = j.data.order_no;
payUrl.value = j.data.pay_url;
orderStatus.value = 'pending';
cardKey.value = '';
authMsg.value = '';
localStorage.setItem(ORDER_KEY, JSON.stringify({ order_no: orderNo.value }));
// 支付页新窗口打开,本页留守轮询
window.open(payUrl.value, '_blank', 'noopener');
startPoll();
} catch (e: any) {
errMsg.value = e?.message || '下单失败,请稍后重试';
} finally {
ordering.value = false;
}
}
function reopenPay(): void {
if (payUrl.value) window.open(payUrl.value, '_blank', 'noopener');
}
function clearOrder(): void {
stopPoll();
orderNo.value = '';
payUrl.value = '';
orderStatus.value = '';
cardKey.value = '';
authMsg.value = '';
errMsg.value = '';
localStorage.removeItem(ORDER_KEY);
}
onMounted(async () => {
machineId.value = getMachineId();
await loadPlans();
// 恢复未完成订单,继续轮询
try {
const saved = JSON.parse(localStorage.getItem(ORDER_KEY) || 'null');
if (saved?.order_no) {
orderNo.value = saved.order_no;
orderStatus.value = 'pending';
startPoll();
}
} catch {
/* 忽略脏数据 */
}
});
onUnmounted(stopPoll);
</script>
<template>
<div class="px-page">
<div class="hero">
<div class="hero-title">🔐 购买卡密</div>
<div class="hero-sub">
支付成功后本页直接显示卡密,同时本机立即解锁 13 个高级功能
</div>
</div>
<!-- 本机机器码 -->
<div class="box machine-box">
<div class="box-label">本机机器码</div>
<div class="machine-row">
<code class="machine-id">{{ machineId || '读取中…' }}</code>
<c-button size="small" @click="copyText(machineId, 'machine')">
{{ copied === 'machine' ? '已复制 ✓' : '复制' }}
</c-button>
</div>
<div class="box-hint">
下单会自动绑定到这台电脑;换电脑时用支付后得到的卡密重新激活即可。
</div>
</div>
<div v-if="licenseState.authorized" class="box ok-box">
✅ 本机已拥有授权,无需重复购买。
</div>
<!-- 套餐 -->
<div class="section">
<div class="section-title">① 选择套餐</div>
<div v-if="loading" class="tip">套餐加载中…</div>
<div v-else-if="loadErr" class="tip err">{{ loadErr }}</div>
<div v-else class="plan-grid">
<div
v-for="p in plans"
:key="p.id"
class="plan-card"
:class="{ on: selPlan?.id === p.id }"
@click="selPlan = p"
>
<div class="plan-name">{{ p.name }}</div>
<div class="plan-price">
<span class="cur">¥</span>{{ p.price }}
<span v-if="Number(p.original_price) > 0" class="origin">¥{{ p.original_price }}</span>
</div>
<div class="plan-meta">{{ fmtDays(p.duration_days) }} · 13 个高级功能</div>
<div v-if="p.description" class="plan-desc">{{ p.description }}</div>
</div>
<div v-if="!plans.length" class="tip">暂无可售套餐</div>
</div>
</div>
<!-- 支付方式 -->
<div class="section">
<div class="section-title">② 选择支付方式</div>
<div class="pay-grid">
<div
v-for="m in PAY_METHODS"
:key="m.key"
class="pay-card"
:class="{ on: payType === m.key }"
@click="payType = m.key"
>
<span class="pay-icon">{{ m.icon }}</span>{{ m.label }}
</div>
</div>
</div>
<!-- 优惠码 -->
<div class="section">
<div class="section-title">③ 优惠码<span class="opt">(选填)</span></div>
<input
v-model="couponCode"
class="coupon-input"
placeholder="没有可留空"
maxlength="32"
/>
</div>
<div class="buy-bar">
<div class="amount">
应付 <b>¥{{ selPlan ? selPlan.price : '0.00' }}</b>
</div>
<c-button type="primary" size="large" :loading="ordering" @click="buy">
{{ ordering ? '正在创建订单…' : '立即支付' }}
</c-button>
</div>
<div v-if="errMsg" class="tip err">{{ errMsg }}</div>
<!-- 订单状态 -->
<div v-if="orderNo" class="box order-box">
<div class="order-head">
<span>订单号 <code>{{ orderNo }}</code></span>
<a v-if="payUrl && orderStatus === 'pending'" href="javascript:;" class="lnk" @click="reopenPay">
打开支付页 ↗
</a>
</div>
<div v-if="orderStatus === 'pending'" class="order-wait">
<span class="dots" />
等待支付完成…(支付页已在新标签打开,付款后本页会自动刷新)
<a href="javascript:;" class="lnk" @click="pollOnce">刷新状态</a>
<a href="javascript:;" class="lnk dim" @click="clearOrder">取消此单</a>
</div>
<template v-if="orderStatus === 'paid'">
<div class="paid-head">✅ 支付成功</div>
<div class="card-box">
<div class="card-label">你的卡密(请妥善保存)</div>
<div class="card-row">
<code class="card-key">{{ cardKey || '—' }}</code>
<c-button
v-if="cardKey"
size="small"
type="primary"
@click="copyText(cardKey, 'card')"
>
{{ copied === 'card' ? '已复制 ✓' : '复制卡密' }}
</c-button>
</div>
<div v-if="paidAt" class="box-hint">支付时间:{{ paidAt }}</div>
</div>
<div class="auth-line" :class="{ pending: licenseState.authorized === false }">
{{ authMsg || '授权核验中…' }}
</div>
<div class="auth-actions">
<c-button size="small" :loading="licenseState.checking" @click="refreshAuth">
重新核验授权
</c-button>
<c-button size="small" @click="clearOrder">再买一单</c-button>
</div>
</template>
<div v-if="orderStatus === 'expired'" class="tip err">订单已过期</div>
</div>
<div class="notes">
<div class="note-item">🔒 买断制:不按次、不按月,一次付费永久使用。</div>
<div class="note-item">🧭 授权跟随机器码绑定,换电脑用卡密重新激活即可恢复。</div>
<div class="note-item">🎁 支付成功即解锁 13 个高级功能,无需等待人工发货。</div>
<div class="note-item">❓ 卡密丢失可凭订单号联系管理员找回。</div>
</div>
</div>
</template>
<style lang="less" scoped>
.px-page {
max-width: 860px;
margin: 0 auto;
padding: 40px 20px 80px;
}
.hero {
text-align: center;
margin-bottom: 30px;
.hero-title {
font-size: 30px;
font-weight: 800;
background: linear-gradient(48deg, rgba(37, 99, 108, 1) 0%, rgba(59, 149, 111, 1) 55%, rgba(20, 160, 88, 1) 100%);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.hero-sub {
margin-top: 10px;
font-size: 14.5px;
opacity: 0.65;
}
}
.box {
border: 1px solid rgba(128, 128, 128, 0.25);
border-radius: 12px;
padding: 14px 16px;
margin-bottom: 22px;
}
.machine-box {
.box-label,
.card-label {
font-size: 12.5px;
opacity: 0.6;
margin-bottom: 8px;
}
.machine-row {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.machine-id {
font-size: 17px;
font-weight: 700;
letter-spacing: 1px;
user-select: all;
}
}
.box-hint {
margin-top: 8px;
font-size: 12.5px;
opacity: 0.6;
}
.ok-box {
color: #18a058;
font-weight: 600;
}
.section {
margin-bottom: 24px;
.section-title {
font-size: 16px;
font-weight: 700;
margin-bottom: 12px;
}
.opt {
font-size: 12.5px;
font-weight: 400;
opacity: 0.55;
}
}
.tip {
font-size: 13.5px;
opacity: 0.7;
&.err {
color: #d03050;
opacity: 1;
margin-top: 8px;
}
}
.plan-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 12px;
}
.plan-card {
border: 1px solid rgba(128, 128, 128, 0.25);
border-radius: 12px;
padding: 16px;
cursor: pointer;
transition: border-color 0.15s, box-shadow 0.15s;
&:hover {
border-color: rgba(24, 160, 88, 0.5);
}
&.on {
border-color: #18a058;
box-shadow: 0 0 0 1px rgba(24, 160, 88, 0.35), 0 6px 18px rgba(24, 160, 88, 0.12);
}
.plan-name {
font-size: 15.5px;
font-weight: 700;
}
.plan-price {
margin-top: 8px;
font-size: 30px;
font-weight: 800;
color: #18a058;
.cur {
font-size: 16px;
margin-right: 2px;
}
.origin {
margin-left: 8px;
font-size: 13px;
font-weight: 400;
opacity: 0.45;
text-decoration: line-through;
}
}
.plan-meta {
margin-top: 6px;
font-size: 13px;
opacity: 0.7;
}
.plan-desc {
margin-top: 6px;
font-size: 12.5px;
opacity: 0.55;
}
}
.pay-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: 10px;
}
.pay-card {
border: 1px solid rgba(128, 128, 128, 0.25);
border-radius: 10px;
padding: 12px 14px;
font-size: 14px;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
transition: border-color 0.15s, box-shadow 0.15s;
&:hover {
border-color: rgba(24, 160, 88, 0.5);
}
&.on {
border-color: #18a058;
box-shadow: 0 0 0 1px rgba(24, 160, 88, 0.35);
font-weight: 600;
}
.pay-icon {
font-size: 17px;
}
}
.coupon-input {
width: 100%;
max-width: 320px;
padding: 9px 12px;
border: 1px solid rgba(128, 128, 128, 0.3);
border-radius: 8px;
background: transparent;
color: inherit;
font-size: 14px;
outline: none;
&:focus {
border-color: #18a058;
}
}
.buy-bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 16px;
border: 1px solid rgba(128, 128, 128, 0.25);
border-radius: 12px;
margin-bottom: 12px;
flex-wrap: wrap;
.amount {
font-size: 14.5px;
opacity: 0.75;
b {
font-size: 26px;
color: #18a058;
margin-left: 4px;
}
}
}
.order-box {
border-color: rgba(24, 160, 88, 0.45);
}
.order-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
font-size: 13.5px;
opacity: 0.8;
flex-wrap: wrap;
code {
user-select: all;
}
}
.lnk {
color: #18a058;
text-decoration: none;
font-size: 13.5px;
&.dim {
opacity: 0.6;
margin-left: 12px;
}
&:hover {
text-decoration: underline;
}
}
.order-wait {
margin-top: 12px;
font-size: 14px;
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.dots {
width: 10px;
height: 10px;
border-radius: 50%;
background: #f0a020;
animation: blink 1s infinite alternate;
flex-shrink: 0;
}
@keyframes blink {
from { opacity: 0.25; }
to { opacity: 1; }
}
.paid-head {
margin-top: 14px;
font-size: 18px;
font-weight: 800;
color: #18a058;
}
.card-box {
margin-top: 12px;
padding: 14px;
border: 1px dashed rgba(24, 160, 88, 0.55);
border-radius: 10px;
background: rgba(24, 160, 88, 0.06);
.card-label {
font-size: 12.5px;
opacity: 0.7;
margin-bottom: 8px;
}
.card-row {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
}
.card-key {
font-size: 19px;
font-weight: 800;
letter-spacing: 1.2px;
user-select: all;
word-break: break-all;
}
}
.auth-line {
margin-top: 12px;
font-size: 14px;
color: #18a058;
font-weight: 600;
&.pending {
color: #f0a020;
}
}
.auth-actions {
margin-top: 12px;
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.notes {
margin-top: 28px;
border-top: 1px solid rgba(128, 128, 128, 0.2);
padding-top: 18px;
.note-item {
font-size: 13.5px;
opacity: 0.65;
line-height: 1.9;
}
}
</style>
+9 -2
View File
@@ -1,9 +1,16 @@
<script setup lang="ts">
import { useHead } from '@vueuse/head';
import { BUY_URL, PROTECTED_TOOLS, getMachineId } from '@/tools/license/license';
import { PROTECTED_TOOLS, getMachineId } from '@/tools/license/license';
useHead({ title: '授权应用 - IT-TOOLS-PRO' });
const router = useRouter();
/** 「前往购买卡密」→ 站内支付页 /buy */
function goBuy(): void {
router.push('/buy');
}
interface Feature {
path: string;
name: string;
@@ -189,7 +196,7 @@ async function copyMachine() {
</div>
</div>
<div class="cta-right">
<c-button type="primary" class="cta-btn" tag="a" :href="BUY_URL" target="_blank" rel="noopener">
<c-button type="primary" class="cta-btn" @click="goBuy">
💳 前往购买卡密
</c-button>
<div class="cta-hint">
+5
View File
@@ -46,6 +46,11 @@ const router = createRouter({
name: 'pricing',
component: () => import('./pages/Pricing.page.vue'),
},
{
path: '/buy',
name: 'buy',
component: () => import('./pages/Buy.page.vue'),
},
...toolsRoutes,
...toolsRedirectRoutes,
...(config.app.env === 'development' ? demoRoutes : []),
+7 -3
View File
@@ -17,6 +17,11 @@ const props = defineProps<{ path: string }>();
const router = useRouter();
/** 跳转到站内支付页 /buy(未授权状态下所有购买入口统一走这里) */
function goBuy(): void {
router.push('/buy');
}
const displayName = computed(() => PROTECTED_TOOLS[props.path] ?? '');
const protectedTool = computed(() => !!PROTECTED_TOOLS[props.path]);
@@ -161,10 +166,9 @@ onUnmounted(() => {
<template v-if="!licenseState.authorized">
<a
:href="BUY_URL"
target="_blank"
rel="noopener"
class="lg-buy"
title="买断制授权,不按次不按月;一次激活,13 个高级功能全部解锁,授权跟随账号、换电脑可恢复"
@click.prevent="goBuy"
>永久解锁 13 个功能</a>
<a href="javascript:;" class="lg-link" @click="showCardInput = !showCardInput">卡密</a>
</template>
@@ -202,7 +206,7 @@ onUnmounted(() => {
</p>
<div class="lg-modal-actions">
<c-button type="primary" :href="BUY_URL" target="_blank" rel="noopener">
<c-button type="primary" @click="goBuy">
购买授权
</c-button>
<c-button @click="showCardInput = !showCardInput">
+1 -1
View File
@@ -2,7 +2,7 @@ import { reactive } from 'vue';
// ====== 授权服务器 (CardAuth) ======
export const AUTH_BASE = 'https://auth.88531.cn/api';
export const BUY_URL = 'https://auth.88531.cn/#/shop';
export const BUY_URL = '/buy'; // 站内支付页:下单 -> 支付 -> 当场显示卡密
// 受控功能(消耗服务器性能:翻译走服务器代理、OCR 走本机识别服务)
export const PROTECTED_TOOLS: Record<string, string> = {
+290 -5
View File
@@ -1,6 +1,8 @@
<script setup lang="ts">
// 本机IP查询:用户端公网 IPv4/IPv6 + 归属地 + 本站IPv6直连 + 热门地点延迟 + 网速测试(浏览器 <-> 本站服务器真实收发)
type Geo = { country?: string; region?: string; city?: string; isp?: string; as?: string; lan?: boolean } | null;
// 代理/VPN 出口判定(relay /ip-check 返回)
type ChkInfo = { ip?: string; lan?: boolean; proxy?: boolean | null; type?: string; provider?: string; hostname?: string; asn?: string } | null;
// ---------- IP 查询(仅用户端视角,不显示服务器地址) ----------
const ipLoading = ref(true);
@@ -97,6 +99,111 @@ async function loadIps() {
v4Geo.value = g4;
v6Geo.value = g6;
ipLoading.value = false;
ensureIspNode(); // 归属运营商已知 → 插入「本省运营商门户」延迟节点并补测
// 拿到地址后并行做代理/VPN 检测(不阻塞主卡片)
runProxyCheck();
rtcProbe();
}
// ---------- 代理/VPN 检测(出口 IP 判定 + WebRTC 泄漏检测,均免费) ----------
const pcLoading = ref(false);
const chk4 = ref<ChkInfo | null>(null); // v4 出口判定
const chk6 = ref<ChkInfo | null>(null); // v6 出口判定
const rtcPub = ref<string[]>([]); // STUN 实测公网候选(代理漏出的真实地址线索)
const rtcLocal = ref<string[]>([]); // 本机内网候选
const rtcState = ref<'wait' | 'run' | 'done'>('wait');
async function runProxyCheck() {
if (!v4.value && !v6.value) return;
pcLoading.value = true;
const [c4, c6] = await Promise.all([
v4.value ? jfetch(`/relay/ip-check?ip=${encodeURIComponent(v4.value)}`, 12000).catch(() => null) : null,
v6.value ? jfetch(`/relay/ip-check?ip=${encodeURIComponent(v6.value)}`, 12000).catch(() => null) : null,
]);
chk4.value = (c4 && c4.data) || null;
chk6.value = (c6 && c6.data) || null;
pcLoading.value = false;
}
// WebRTC 探测:STUN srflx 候选=公网(代理/VPN 漏洞常见线索);host 候选=本机内网 IP。
// Chrome 会把 host 候选打成 mDNS(.local) 域名,此时内网 IP 显示为「浏览器隐私保护已隐藏」。
async function rtcProbe() {
if (typeof RTCPeerConnection === 'undefined') {
rtcState.value = 'done';
return;
}
rtcState.value = 'run';
const pub = new Set<string>();
const loc = new Set<string>();
let pc: RTCPeerConnection;
try {
pc = new RTCPeerConnection({
iceServers: [
{ urls: 'stun:stun.l.google.com:19302' },
{ urls: 'stun:stun1.l.google.com:19302' },
],
});
} catch {
rtcState.value = 'done';
return;
}
try {
pc.createDataChannel('probe');
pc.onicecandidate = (e) => {
if (!e.candidate) return;
const m = /candidate:\S+ \d+ \S+ \d+ (\S+) \d+ typ (\w+)/.exec(e.candidate.candidate);
if (!m) return;
const ip = m[1].split('%')[0]; // 去 zone id
const typ = m[2];
if (ip.includes('.local')) return; // mDNS 伪地址,忽略
if (typ === 'srflx') pub.add(ip);
else if (typ === 'host') {
const v4m = ip.match(/^(\d+)\./);
const priv4 = v4m && ['10', '172', '192', '169'].includes(v4m[1]);
const priv6 = ip.startsWith('fe80') || ip.startsWith('fc') || ip.startsWith('fd');
if (ip.includes(':') ? priv6 : priv4) loc.add(ip); // 只留私网地址,公网 host 候选归入 pub 语义
else pub.add(ip);
}
};
pc.createOffer().then((o) => pc.setLocalDescription(o)).catch(() => {});
await new Promise<void>((res) => {
const to = setTimeout(res, 6000);
pc.onicecandidate = ((orig) => (e: RTCPeerConnectionIceEvent) => {
orig(e);
if (!e.candidate) {
clearTimeout(to);
res();
}
})(pc.onicecandidate!);
});
} catch {
/* 探测失败按无候选处理 */
}
try {
pc.close();
} catch {
/* ignore */
}
rtcPub.value = [...pub];
rtcLocal.value = [...loc];
rtcState.value = 'done';
}
// WebRTC 公网候选与主 IP 不一致的地址(可能的真实出口)
const rtcMismatch = computed<string[]>(() => {
const known = new Set([v4.value, v6.value].filter(Boolean));
return rtcPub.value.filter((ip) => !known.has(ip));
});
function chkVerdict(c: ChkInfo | null): { icon: string; text: string; cls: string } {
if (pcLoading.value) return { icon: '⏳', text: '检测中…', cls: '' };
if (!c) return { icon: '⚪', text: '无法判定(查询服务暂不可用)', cls: 'px-unknown' };
if (c.lan) return { icon: '🏠', text: '内网地址,不适用代理判定', cls: '' };
if (c.proxy) return { icon: '🔴', text: `检测到代理/VPN(${c.type}${c.provider ? ' · ' + c.provider : ''})`, cls: 'px-bad' };
if (c.type === 'Business' || c.type === 'Hosting') {
return { icon: '🟡', text: `${c.type === 'Hosting' ? '数据中心' : '企业'}网络出口,通常非家庭宽带`, cls: 'px-warn' };
}
return { icon: '🟢', text: `未检测到代理/VPN(${c.type || '家庭宽带线路'}${c.provider ? ' · ' + c.provider : ''})`, cls: 'px-ok' };
}
function geoLine(g: Geo): string {
@@ -131,10 +238,11 @@ async function copyIp(text: string, key: string) {
}
// ---------- 热门地点延迟(你的浏览器到各地点的实测延迟) ----------
type LatNode = { name: string; url: string; ms: number | null; st: 'wait' | 'run' | 'ok' | 'fail' };
type LatNode = { name: string; url: string; ms: number | null; st: 'wait' | 'run' | 'ok' | 'fail'; note?: string };
const latTesting = ref(false);
const nodes = ref<LatNode[]>([
{ name: '本站服务器', url: `${location.origin}/favicon.ico`, ms: null, st: 'wait' },
{ name: '百度', url: 'https://www.baidu.com/favicon.ico', ms: null, st: 'wait' },
{ name: '清华 TUNA(北京)', url: 'https://mirrors.tuna.tsinghua.edu.cn/', ms: null, st: 'wait' },
{ name: '阿里云镜像(杭州)', url: 'https://mirrors.aliyun.com/', ms: null, st: 'wait' },
{ name: '腾讯云镜像(广州)', url: 'https://mirrors.cloud.tencent.com/', ms: null, st: 'wait' },
@@ -145,6 +253,33 @@ const nodes = ref<LatNode[]>([
{ name: 'Cloudflare(海外)', url: 'https://speed.cloudflare.com/__down?bytes=0', ms: null, st: 'wait' },
]);
// 按用户 IPv4 归属运营商动态插入「本省运营商门户」节点(三大运营商+广电,无匹配则不插)
function ensureIspNode() {
if (nodes.value.some((n) => n.name.startsWith('本省'))) return;
const g = v4Geo.value;
const isp = `${g?.isp || ''} ${g?.as || ''}`;
const province = g?.regionName || '';
let portal = '';
let short = '';
if (/联通|Unicom/i.test(isp)) {
portal = 'https://www.10010.com/favicon.ico'; // favicon 直链无 302;首页会被风控挂到超时
short = '联通';
} else if (/电信|Telecom/i.test(isp)) {
portal = 'https://www.189.cn/favicon.ico';
short = '电信';
} else if (/移动|Mobile|铁通|Tietong/i.test(isp)) {
portal = 'https://www.10086.cn/'; // 移动 favicon 不可达,用首页(200 稳定)
short = '移动';
} else if (/广电|Broadnet/i.test(isp)) {
portal = 'https://www.10099.com.cn/favicon.ico';
short = '广电';
}
if (!portal) return; // 未知运营商(教育网/长城等)不插行
const node: LatNode = { name: `本省·${short}`, url: portal, ms: null, st: 'wait', note: province ? `${g?.isp || short} · ${province}` : (g?.isp || '') };
nodes.value.splice(1, 0, node);
ping(node); // 其余节点已在测,单独补测这一项
}
const latSummary = computed(() => {
const ok = nodes.value.filter((n) => n.st === 'ok' && n.ms != null);
if (!ok.length) return '';
@@ -316,6 +451,7 @@ interface SpeedRec {
ms: number; // 到本站延迟
route: 'IPv6 直连' | '公网中转'; // 测试时所走线路
host: string; // 测试时的访问域名
lat?: string; // 测速时点的热门地点延迟快照:"百度5 本省联通6 清华12 …"(空串=当时未测完)
}
const speedHistory = ref<SpeedRec[]>([]);
@@ -338,6 +474,14 @@ function saveSpeedHistory() {
}
}
// 把当前热门地点延迟压成短串快照(写入历史记录):"百度5 本省联通6 清华12 …"
function latSnapshot(): string {
return nodes.value
.filter((n) => n.st === 'ok' && n.ms != null)
.map((n) => `${n.name.replace(/([^)]*)/g, '').replace(/[\s·]/g, '')}${n.ms}`)
.join(' ');
}
function pushSpeedRec() {
speedHistory.value.unshift({
t: Date.now(),
@@ -346,6 +490,7 @@ function pushSpeedRec() {
ms: serverMs.value ?? 0,
route: onV6Host ? 'IPv6 直连' : '公网中转',
host: location.host,
lat: latSnapshot(),
});
speedHistory.value = speedHistory.value.slice(0, 20);
saveSpeedHistory();
@@ -500,6 +645,7 @@ onMounted(() => {
<span>下载 Mbps</span>
<span>上传 Mbps</span>
<span>延迟 ms</span>
<span>热门地点延迟快照</span>
</div>
<div v-for="r in speedHistory" :key="r.t" class="sp-hrow">
<span>{{ fmtTime(r.t) }}</span>
@@ -507,12 +653,61 @@ onMounted(() => {
<span class="c-down">{{ r.down }}</span>
<span class="c-up">{{ r.up }}</span>
<span class="c-ms">{{ r.ms }}</span>
<span class="c-lat">{{ r.lat || '—' }}</span>
</div>
</div>
<div class="sp-hist-tip">对比方法:在当前线路测一次 → 点横幅「切换 IPv6 直连」再测一次,两条线路的下载/上传/延迟直接在表里对照。</div>
<div class="sp-hist-tip">对比方法:在当前线路测一次 → 点横幅「切换 IPv6 直连」再测一次,下载/上传/延迟与各地点(百度/本省运营商/镜像站等)延迟直接在表里对照。</div>
</div>
</div>
<!-- 代理 / VPN 检测(出口 IP 判定 + WebRTC 泄漏检测) -->
<div v-if="v4 || v6" class="sec">
<div class="sec-head">
<h3>🕵 代理 / VPN 检测</h3>
<button class="sec-refresh" :disabled="pcLoading" @click="runProxyCheck()">
{{ pcLoading ? '检测中…' : '重新检测' }}
</button>
</div>
<div class="px-rows">
<div class="px-row">
<span class="px-k">IPv4 出口判定</span>
<span class="px-v" :class="chkVerdict(chk4).cls">{{ chkVerdict(chk4).icon }} {{ chkVerdict(chk4).text }}</span>
</div>
<div v-if="v6" class="px-row">
<span class="px-k">IPv6 出口判定</span>
<span class="px-v" :class="chkVerdict(chk6).cls">{{ chkVerdict(chk6).icon }} {{ chkVerdict(chk6).text }}</span>
</div>
<div class="px-row">
<span class="px-k">WebRTC 实测公网地址</span>
<span class="px-v">
<template v-if="rtcState === 'run'">⏳ 探测中…</template>
<template v-else-if="rtcPub.length">
<code v-for="ip in rtcPub" :key="ip" class="px-ip">{{ ip }}</code>
<template v-if="rtcMismatch.length">
<span class="px-bad">⚠ 与上方 IP 不一致:{{ rtcMismatch.join('、') }} —— 浏览器经 STUN 拿到的另一公网地址,若你在用代理/VPN,这可能才是你的实际网络出口</span>
</template>
<template v-else>
<span class="px-ok">✓ 与上方一致</span>
</template>
</template>
<template v-else>未检出(浏览器已禁用 WebRTC,或被代理软件/网络阻断 STUN)</template>
</span>
</div>
<div class="px-row">
<span class="px-k">本机内网 IP</span>
<span class="px-v">
<template v-if="rtcState === 'run'">⏳ 探测中…</template>
<template v-else-if="rtcLocal.length">
<code v-for="ip in rtcLocal" :key="ip" class="px-ip">{{ ip }}</code>
</template>
<template v-else-if="rtcState === 'done'">浏览器隐私保护已隐藏(现代 Chrome 默认用虚拟域名代替)</template>
<template v-else>—</template>
</span>
</div>
</div>
<p class="px-note">说明:浏览器无法直接读取系统代理软件的开关状态;判定依据为出口 IP 归属数据库(proxycheck.io)与 WebRTC 泄漏实测——高级代理/VPN 可能伪装归属地或阻断 STUN,结果仅供参考。</p>
</div>
<!-- 热门地点延迟 -->
<div class="sec">
<div class="sec-head">
@@ -522,7 +717,7 @@ onMounted(() => {
</div>
<div class="lat-grid">
<div v-for="n in nodes" :key="n.name" class="lat-card" :class="latCls(n)">
<span class="lat-name">{{ n.name }}</span>
<span class="lat-name" :title="n.note || ''">{{ n.name }}</span>
<span class="lat-ms">
{{ n.st === 'run' ? '测速中…' : n.st === 'fail' ? '超时' : n.st === 'ok' ? `${n.ms} ms` : '待测' }}
</span>
@@ -876,6 +1071,88 @@ onMounted(() => {
margin-top: 10px;
}
/* ---------- 代理/VPN 检测 ---------- */
.px-rows {
font-size: 14px;
.px-row {
display: flex;
align-items: baseline;
gap: 10px;
padding: 7px 0;
border-bottom: 1px dashed rgba(128, 128, 128, 0.18);
&:last-child {
border-bottom: none;
}
.px-k {
flex: 0 0 150px;
opacity: 0.75;
font-weight: 600;
font-size: 13px;
}
.px-v {
flex: 1;
min-width: 0;
line-height: 1.6;
}
}
}
.px-ip {
font-family: monospace;
background: rgba(128, 128, 128, 0.12);
padding: 1px 8px;
border-radius: 6px;
margin-right: 8px;
font-size: 13px;
word-break: break-all;
}
.px-ok {
color: #18a058;
}
.px-warn {
color: #d0a000;
}
.px-bad {
color: #d03050;
}
.px-unknown {
opacity: 0.6;
}
.px-note {
margin-top: 8px;
font-size: 12.5px;
opacity: 0.65;
line-height: 1.7;
}
.sec-refresh {
border: 1px solid rgba(128, 128, 128, 0.35);
background: transparent;
color: inherit;
border-radius: 8px;
padding: 5px 14px;
font-size: 13px;
cursor: pointer;
&:disabled {
opacity: 0.5;
cursor: default;
}
&:hover:not(:disabled) {
border-color: rgba(128, 128, 128, 0.7);
}
}
/* ---------- 测速历史 ---------- */
.sp-history {
margin-top: 14px;
@@ -904,7 +1181,7 @@ onMounted(() => {
.sp-hrow {
display: grid;
grid-template-columns: 1.1fr 1.1fr 1fr 1fr 0.9fr;
grid-template-columns: 1.1fr 1.1fr 1fr 1fr 0.9fr 2.4fr;
gap: 6px;
padding: 6px 4px;
align-items: center;
@@ -972,8 +1249,16 @@ onMounted(() => {
}
}
.sp-hist-table .sp-hrow {
grid-template-columns: 1fr 1fr 1fr 1fr 0.8fr;
grid-template-columns: 0.9fr 1fr 0.8fr 0.8fr 0.7fr 2.6fr;
font-size: 12.5px;
}
.sp-hist-table .c-lat {
font-family: monospace;
font-size: 11.5px;
opacity: 0.85;
line-height: 1.6;
word-break: break-all;
}
}
</style>