From 8a7fa8b9da3bd3e7f6f9a88e793a2817b06e0a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=87=E8=B6=A3=E4=BF=9D=E7=BD=97?= Date: Mon, 24 Jun 2024 01:26:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=AC=E5=8F=B8=E5=AE=98=E7=BD=91?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E9=93=BE=E6=8E=A5=E8=B7=B3=E8=BD=AC=E5=92=8C?= =?UTF-8?q?=E6=9C=89=E6=95=88=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 内容 --- homepage-rewrite-test.js | 121 ++++++++++++++++++++++++++++----------- 1 file changed, 86 insertions(+), 35 deletions(-) diff --git a/homepage-rewrite-test.js b/homepage-rewrite-test.js index ca394d0..9ecc570 100644 --- a/homepage-rewrite-test.js +++ b/homepage-rewrite-test.js @@ -2,10 +2,16 @@ const https = require('https'); +const locale = 'zh-TW'; + const homeUrl = 'https://felo.me'; const meetUrl = 'https://meet.felo.me'; const imUrl = 'https://im.felo.me'; +// const homeUrl = 'https://home-dev.felo.me'; +// const meetUrl = 'https://meet-dev.felo.me'; +// const imUrl = 'https://im-dev.felo.me'; + const urls = [ // 301 检测 { @@ -16,30 +22,68 @@ const urls = [ }, { url: `${homeUrl}/pricing`, - code: 301, - comment: '跳转检测', - location: `${meetUrl}/pricing`, + code: 200, + comment: '不跳转检测', + }, + { + url: `${homeUrl}/${locale}/pricing`, + code: 200, + comment: '不跳转检测', + }, + { + url: `${homeUrl}/security`, + code: 200, + comment: '不跳转检测', + }, + { + url: `${homeUrl}/${locale}/security`, + code: 200, + comment: '不跳转检测', + }, + { + url: `${homeUrl}/translator`, + code: 200, + comment: '不跳转检测', + }, + { + url: `${homeUrl}/${locale}/translator`, + code: 200, + comment: '不跳转检测', + }, + { + url: `${homeUrl}/download`, + code: 200, + comment: '不跳转检测', + }, + { + url: `${homeUrl}/${locale}/download`, + code: 200, + comment: '不跳转检测', + }, + { + url: `${homeUrl}/contact`, + code: 200, + comment: '不跳转检测', + }, + { + url: `${homeUrl}/${locale}/contact`, + code: 200, + comment: '不跳转检测', }, - // { - // url: `${homeUrl}/download`, - // code: 301, - // comment: '跳转检测(可不做', - // location: `${meetUrl}/download`, - // }, - // { - // url: `${homeUrl}/contact`, - // code: 301, - // comment: '跳转检测(可不做', - // location: `${meetUrl}/contact`, - // }, - // { - // url: `${homeUrl}/security`, - // code: 301, - // comment: '跳转检测(可不做', - // location: `${imUrl}/security`, - // }, // Meet + { + url: `${meetUrl}`, + code: 200, + matcher: /\/homepage\/umi.js/, + comment: '会议首页,命中官网', + }, + { + url: `${meetUrl}/home`, + code: 200, + matcher: /You need to enable/, + comment: '会议系统,命中系统' + }, { url: `${meetUrl}/contact`, code: 200, @@ -47,7 +91,7 @@ const urls = [ comment: '联系我们', }, { - url: `${meetUrl}/zh-TW/contact`, + url: `${meetUrl}/${locale}/contact`, code: 200, matcher: /\/homepage\/umi.js/, comment: '联系我们(限定语言)', @@ -59,7 +103,7 @@ const urls = [ comment: '收费', }, { - url: `${meetUrl}/zh-TW/pricing`, + url: `${meetUrl}/${locale}/pricing`, code: 200, matcher: /\/homepage\/umi.js/, comment: '收费(限定语言)', @@ -71,17 +115,11 @@ const urls = [ comment: '下载', }, { - url: `${meetUrl}/zh-TW/download`, + url: `${meetUrl}/${locale}/download`, code: 200, matcher: /\/homepage\/umi.js/, comment: '下载(限定语言)', }, - { - url: `${meetUrl}/home`, - code: 200, - matcher: /You need to enable/, - comment: '会议首页' - }, // IM { @@ -91,7 +129,19 @@ const urls = [ comment: '安全', }, { - url: `${imUrl}/zh-TW/security`, + url: `${imUrl}/${locale}/security`, + code: 200, + matcher: /\/homepage\/umi.js/, + comment: '安全(限定语言)', + }, + { + url: `${imUrl}/contact`, + code: 200, + matcher: /\/homepage\/umi.js/, + comment: '安全', + }, + { + url: `${imUrl}/${locale}/contact`, code: 200, matcher: /\/homepage\/umi.js/, comment: '安全(限定语言)', @@ -113,22 +163,23 @@ const promises = urls.map((item, index) => { resolve({ url: urlItem.url, - status: status === urlItem.code ? '匹配' : '不匹配', + status: status === urlItem.code ? '✅' : '❌', statusShould: urlItem.code, statusActual: status, locationShould: urlItem.location || '/', locationActual: res.headers.location || '/', location: urlItem.location ? ( - urlItem.location === res.headers.location ? '匹配' : '不匹配' + urlItem.location === res.headers.location ? '✅' : '❌' ) : '/', match: urlItem.matcher ? ( - chunkRes.match(urlItem.matcher) ? '内容匹配' : '内容不匹配' + chunkRes.match(urlItem.matcher) ? '✅' : '❌' ) : '/', comment: urlItem.comment, }); }); - res.on('error', () => { + res.on('error', (err) => { + console.log(err, item.url); reject(); }) });